summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexander Kutsan <AKutsan@luxoft.com>2016-10-10 15:55:54 +0300
committerSergey Levchenko (GitHub) <slevchenko.work@gmail.com>2016-11-11 10:30:01 +0200
commitddb1fc1ef21b744ecffcafc5c43b62972aa50952 (patch)
tree13b2589802ade82d799b0735c3cc95b755ae5a74 /CMakeLists.txt
parenta1438a408364c6d52be01f612d3a8c7714dd85e0 (diff)
downloadsdl_core-ddb1fc1ef21b744ecffcafc5c43b62972aa50952.tar.gz
Add distcc and ccache as cmake options
Related to: APPLINK-29754
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35b17a7564..deddd75cd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,8 @@ option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON)
option(ENABLE_EXTENDED_POLICY "Turns extended flow which requires embedded system interaction" ON)
option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON)
option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
+option(USE_CCACHE "Turn on ccache usage" ON)
+option(USE_DISTCC "Turn on distributed build_usage" ON)
set(OS_TYPE_OPTION "$ENV{OS_TYPE}")
set(DEBUG_OPTION "$ENV{DEBUG}")
@@ -199,6 +201,37 @@ if (USE_GOLD_LD)
endif()
endif(USE_GOLD_LD)
+if (USE_CCACHE)
+# Configure CCache if available
+ find_program(CCACHE_FOUND ccache)
+ if(CCACHE_FOUND)
+ get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
+ set(RULE_LAUNCH_COMPILE "${RULE_LAUNCH_COMPILE} ccache")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${RULE_LAUNCH_COMPILE})
+
+ get_property(RULE_LAUNCH_LINK GLOBAL PROPERTY RULE_LAUNCH_LINK)
+ set(RULE_LAUNCH_LINK "${RULE_LAUNCH_LINK} ccache")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${RULE_LAUNCH_LINK})
+
+ message(INFO " Used CCache for compilation.")
+ else(CCACHE_FOUND)
+ message(WARNING " CCache was not found.")
+ endif(CCACHE_FOUND)
+endif(USE_CCACHE)
+
+if (USE_DISTCC)
+# Configure distributed compilation if available
+ find_program(DISTCC_FOUND distcc)
+ if(DISTCC_FOUND)
+ get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
+ set(RULE_LAUNCH_COMPILE "${RULE_LAUNCH_COMPILE} distcc")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${RULE_LAUNCH_COMPILE})
+ message(INFO " Used distributed build.")
+ else(CCACHE_FOUND)
+ message(WARNING " distcc was not found. Distributed compilation is impossible.")
+ endif(DISTCC_FOUND)
+endif(USE_DISTCC)
+
if(ENABLE_SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()