From: John Coyle Date: Wed, 9 Dec 2015 17:55:30 +0000 (-0500) Subject: cmake: support ccache via a WITH_CCACHE build option X-Git-Tag: v10.0.4~145^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae114aea034babdc4fb88543150d069963181eda;p=ceph.git cmake: support ccache via a WITH_CCACHE build option When -DWITH_CCACHE=ON is specified, try to find and use ccache. Signed-off-by: John Coyle --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cb41d3ea286..4ec6f3bdcbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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