Support ccache on Windows.
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Jun 2020 09:28:03 +0000 (11:28 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Jun 2020 09:28:03 +0000 (11:28 +0200)
cdist

diff --git a/cdist b/cdist
index 2474307b0f8397595d5c089fc303531c1cd9c2ef..84814ac1751b8b09f0ab23074a59c3eda657a9cc 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -627,8 +627,6 @@ class WindowsTarget(DockerTarget):
         self.set('PKG_CONFIG_LIBDIR', '%s/lib/pkgconfig' % self.environment_prefix)
         self.set('PKG_CONFIG_PATH', '%s/lib/pkgconfig:%s/bin/pkgconfig' % (self.directory, self.directory))
         self.set('PATH', '%s/bin:%s:%s' % (self.environment_prefix, self.tool_path, os.environ['PATH']))
-        self.set('CC', '%s-gcc' % self.name)
-        self.set('CXX', '%s-g++' % self.name)
         self.set('LD', '%s-ld' % self.name)
         self.set('RANLIB', '%s-ranlib' % self.name)
         self.set('WINRC', '%s-windres' % self.name)
@@ -643,6 +641,15 @@ class WindowsTarget(DockerTarget):
         if environment_version is not None:
             self.image += '_%s' % environment_version
 
+    def setup(self):
+        super().setup()
+        if self.ccache:
+            self.set('CC', '"ccache %s-gcc"' % self.name)
+            self.set('CXX', '"ccache %s-g++"' % self.name)
+        else:
+            self.set('CC', '%s-gcc' % self.name)
+            self.set('CXX', '%s-g++' % self.name)
+
     @property
     def library_prefix(self):
         log_normal('Deprecated property library_prefix: use environment_prefix')