From 2c93184a54c3efd048c27494b65cfa3e9629cebb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 9 Jul 2011 23:44:49 +0200
Subject: Set CCache flags last in the compile settings.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 4a4f9ab..2f85786 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -105,13 +105,6 @@ if env.get("distcc", False) :
 		env["ENV"]["DISTCC_HOSTS"] = env["distcc_hosts"]
 	env["CC"] = "distcc gcc"
 	env["CXX"] = "distcc g++"
-if env.get("ccache", False) :
-	env["ENV"]["HOME"] = os.environ["HOME"]
-	for var in os.environ :
-		if var.startswith("CCACHE_") :
-			env["ENV"][var] = os.environ[var]
-	env["CC"] = "ccache gcc"
-	env["CXX"] = "ccache g++"
 if "cc" in env :
 	env["CC"] = env["cc"]
 if "cxx" in env :
@@ -277,6 +270,21 @@ if target in ["iphone-device", "iphone-simulator", "xcode"] :
 	# Bit of a hack, because BOOST doesn't know the endianness for ARM
 	env.Append(CPPDEFINES = ["_LITTLE_ENDIAN"]) 
 
+# CCache
+if env.get("ccache", False) :
+	env["ENV"]["HOME"] = os.environ["HOME"]
+	for var in os.environ :
+		if var.startswith("CCACHE_") :
+			env["ENV"][var] = os.environ[var]
+	if env.get("CC", "") != "" :
+		env["CC"] = "ccache " + env["CC"]
+	else :
+		env["CC"] = "ccache gcc"
+	if env.get("CXX", "") != "" :
+		env["CXX"] = "ccache " + env["CXX"]
+	else :
+		env["CC"] = "ccache g++"
+
 conf_env = env.Clone()
 
 Export("env")
-- 
cgit v0.10.2-6-g49f6