summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--CMakeOptions.txt1
2 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93ab94c5cf..50288264f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1107,8 +1107,18 @@ include(ConfigureChecks.cmake)
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
+# Global properties
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+if(ENABLE_CCACHE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang"))
+ # http://stackoverflow.com/a/24305849/82195
+ find_program(CCACHE_EXECUTABLE ccache)
+ if(CCACHE_EXECUTABLE)
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXECUTABLE}")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_EXECUTABLE}")
+ endif()
+endif()
+
# The top level checkAPIs target, add before subdirectory calls so it's avaiable to all
add_custom_target(checkAPI)
set_target_properties(checkAPI
diff --git a/CMakeOptions.txt b/CMakeOptions.txt
index f1aacd098f..41a8ab69cd 100644
--- a/CMakeOptions.txt
+++ b/CMakeOptions.txt
@@ -26,6 +26,7 @@ option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables
option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_CHECKHF_CONFLICT "Enable hf conflict check for debugging (start-up may be slower)" OFF)
+option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF)
#
# Leave GTK2 the default on Windows, looks better than GTK3