diff options
author | Paweł Bylica <chfast@gmail.com> | 2017-09-21 16:52:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-21 16:52:41 +0800 |
commit | ab8b1bcc72d33a5aaf8dd2c932496e27733d6f83 (patch) | |
tree | 620b776b1780c6e41e70cb7cc8870ee88262cf3c | |
parent | 725b4fc28cbdd09b5c160e044ccc7017da33d7d7 (diff) | |
parent | 49c98bbc34902d2f5d66518341cfd41ac2d7bef3 (diff) | |
download | dexon-solidity-ab8b1bcc72d33a5aaf8dd2c932496e27733d6f83.tar.gz dexon-solidity-ab8b1bcc72d33a5aaf8dd2c932496e27733d6f83.tar.zst dexon-solidity-ab8b1bcc72d33a5aaf8dd2c932496e27733d6f83.zip |
Merge pull request #2938 from ethereum/cmake-ccache
CMake: Better ccache configuration
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | cmake/EthCcache.cmake | 15 | ||||
-rw-r--r-- | cmake/EthCompilerSettings.cmake | 8 |
3 files changed, 18 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89d627dc..139d4fd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ project(solidity VERSION ${PROJECT_VERSION}) option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF) +# Setup cccache. +include(EthCcache) + # Let's find our dependencies include(EthDependencies) include(jsoncpp) diff --git a/cmake/EthCcache.cmake b/cmake/EthCcache.cmake new file mode 100644 index 00000000..9410cbcd --- /dev/null +++ b/cmake/EthCcache.cmake @@ -0,0 +1,15 @@ +# Setup ccache. +# +# The ccache is auto-enabled if the tool is found. +# To disable set -DCCACHE=OFF option. +if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER) + find_program(CCACHE ccache DOC "ccache tool path; set to OFF to disable") + if(CCACHE) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) + if(COMMAND cotire) + # Change ccache config to meet cotire requirements. + set(ENV{CCACHE_SLOPPINESS} pch_defines,time_macros) + endif() + message(STATUS "[ccache] Enabled: ${CCACHE}") + endif() +endif() diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 117dd319..1a00ae70 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -14,14 +14,6 @@ # # These settings then end up spanning all POSIX platforms (Linux, OS X, BSD, etc) -# Use ccache if available -find_program(CCACHE_FOUND ccache) -if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) - message("Using ccache") -endif(CCACHE_FOUND) - include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fstack-protector-strong have_stack_protector_strong) |