Fix Windows builds with ccache. ccache
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Jun 2020 08:38:17 +0000 (10:38 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Jun 2020 08:49:03 +0000 (10:49 +0200)
cscript

diff --git a/cscript b/cscript
index f6887a7d08dd3aa547c5ce322aea194c89ecc6bd..d13b778426d5bc245838437583d58c5fbdc7a137 100644 (file)
--- a/cscript
+++ b/cscript
@@ -8,7 +8,12 @@ def build(target, options):
         target.set('PATH', '%s:%s' % (target.tool_path, os.environ['PATH']))
         f = open('mingw.cmake', 'w')
         print("SET(CMAKE_SYSTEM_NAME Windows)", file=f)
-        print("SET(CMAKE_C_COMPILER %s/%s)" % (target.tool_path, target.get('CC')), file=f)
+        cc = target.get('CC')
+        cc = cc.replace("ccache ", "")
+        cc = cc.replace("\"", "")
+        if target.ccache:
+            print("set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)", file=f)
+        print("SET(CMAKE_C_COMPILER %s/%s)" % (target.tool_path, cc), file=f)
         print("SET(CMAKE_RC_COMPILER %s/%s)" % (target.tool_path, target.get('WINRC')), file=f)
         all = "%s " % target.library_prefix
         print("SET(CMAKE_ROOT_FIND_PATH %s %s)" % (all, target.tool_path), file=f)