diff options
author | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2019-10-30 20:29:27 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2019-10-30 20:29:27 +0300 |
commit | 7b36b329ef7bc2eed195f3bb9ebdeff11ad6dc1b (patch) | |
tree | 3d10366f874f1fde778c9ba2906fed4b6bf5f87b /CMakeLists.txt | |
parent | e53a46ae214a244e2d11e5b93bec17315a8943c8 (diff) |
Use ccache for faster compilation if available. (#525)
* Use ccache only when requested via cmake -DUSE_CCACHE=on
* Add link to https://ccache.dev in comment about using ccache.
* Issue success / missing ccache message when ccache is requested during the CCACHE run
* Issue cmake warning instead of cmake status message when use of ccache is requested but ccache cannot be found.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a914b701..d0761665 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,18 @@ option(COMPILE_TESTS "Compile tests" OFF) option(COMPILE_SERVER "Compile marian-server" OFF) option(USE_DOXYGEN "Build documentation with Doxygen" ON) +option(USE_CCACHE "Use ccache compiler cache (https://ccache.dev)" OFF) + +# use ccache (https://ccache.dev) for faster compilation if requested and available +if(USE_CCACHE) +find_program(CCACHE_PROGRAM ccache) +if(CCACHE_PROGRAM) + message(STATUS "Found and will be using ccache for faster repeat compilation (use cmake -DUSE_CCACHE=off to disable).") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") +else(CCACHE_PROGRAM) + message(WARNING "Compilation with ccache requested but no ccache found.") +endif(CCACHE_PROGRAM) +endif(USE_CCACHE) # Project versioning find_package(Git QUIET) |