]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: support ccache via a WITH_CCACHE build option 6875/head
authorJohn Coyle <dx9err@gmail.com>
Wed, 9 Dec 2015 17:55:30 +0000 (12:55 -0500)
committerJohn Coyle <dx9err@gmail.com>
Wed, 9 Dec 2015 18:01:37 +0000 (13:01 -0500)
When -DWITH_CCACHE=ON is specified, try to find and use ccache.

Signed-off-by: John Coyle <dx9err@gmail.com>
CMakeLists.txt

index cb41d3ea286bf5b0e583aad487ebba995e09fd61..4ec6f3bdcbdecae01f07ce73c63f3865e345747a 100644 (file)
@@ -10,6 +10,18 @@ endif(NOT (CMAKE_MAJOR_VERSION LESS 3))
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 
+option(WITH_CCACHE "Build with ccache.")
+if(WITH_CCACHE)
+  find_program(CCACHE_FOUND ccache)
+  if(CCACHE_FOUND)
+    message(STATUS "Building with ccache: ${CCACHE_FOUND}, CCACHE_DIR=$ENV{CCACHE_DIR}")
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+  else(CCACHE_FOUND)
+    message(FATAL_ERROR "Can't find ccache. Is it installed?")
+  endif(CCACHE_FOUND)
+endif(WITH_CCACHE)
+
 include_directories(  
   ${PROJECT_BINARY_DIR}/src/include
   ${OFED_PREFIX}/include