From 7c8329aa2efd8d89ea100772620f10b40a589406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Thu, 21 Oct 2010 20:11:38 +0200
Subject: Added ccache option to SCons.

Resolves: #650

diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index a43d2c5..4723755 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -11,6 +11,7 @@ vars.Add('cc', "C compiler")
 vars.Add('cxx', "C++ compiler")
 vars.Add('ccflags', "Extra C(++) compiler flags")
 vars.Add('linkflags', "Extra linker flags")
+vars.Add(BoolVariable("ccache", "Use CCache", "no"))
 vars.Add(BoolVariable("distcc", "Use DistCC", "no"))
 vars.Add('distcc_hosts', "DistCC hosts (overrides DISTCC_HOSTS)")
 vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
@@ -86,6 +87,13 @@ 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 :
-- 
cgit v0.10.2-6-g49f6