Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit a66c005

Browse files
Merge pull request #933 from karczex/add_ccache_support
cmake: add ccache support
2 parents 19b0f3d + ba16ff5 commit a66c005

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ option(CHECK_CPP_STYLE "check code style of C++ sources" OFF)
5050
option(TRACE_TESTS "more verbose test outputs" OFF)
5151
option(USE_ASAN "enable AddressSanitizer (debugging)" OFF)
5252
option(USE_UBSAN "enable UndefinedBehaviorSanitizer (debugging)" OFF)
53+
option(USE_CCACHE "Use ccache if it is available in the system" ON)
5354

5455
option(TESTS_USE_FORCED_PMEM "run tests with PMEM_IS_PMEM_FORCE=1" OFF)
5556
option(TESTS_USE_VALGRIND "enable tests with valgrind (if found)" ON)
@@ -81,6 +82,12 @@ option(INSTALL_CONCURRENT_MAP "enable installation of pmem::obj::experimental::c
8182
option(INSTALL_SELF_RELATIVE_POINTER "enable installation of pmem::obj::experimental::self_relative_ptr" ON)
8283
option(INSTALL_RADIX_TREE "enable testing of pmem::obj::experimental::radix_tree" ON)
8384

85+
# Configure the ccache as compiler launcher
86+
find_program(CCACHE_FOUND ccache)
87+
if(USE_CCACHE AND CCACHE_FOUND)
88+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
89+
endif()
90+
8491
# Do not treat include directories from the interfaces
8592
# of consumed Imported Targets as SYSTEM by default.
8693
set(CMAKE_NO_SYSTEM_FROM_IMPORTED 1)

0 commit comments

Comments
 (0)