From 49c98bbc34902d2f5d66518341cfd41ac2d7bef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 20 Sep 2017 16:39:41 +0200 Subject: CMake: Better ccache configuration EthCcache module taken from cpp-ethereum. --- cmake/EthCcache.cmake | 15 +++++++++++++++ cmake/EthCompilerSettings.cmake | 8 -------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 cmake/EthCcache.cmake (limited to 'cmake') 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) -- cgit v1.2.3