CMake: Better ccache configuration

EthCcache module taken from cpp-ethereum.
This commit is contained in:
Paweł Bylica 2017-09-20 16:39:41 +02:00
parent 137b214be4
commit 49c98bbc34
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
3 changed files with 18 additions and 8 deletions

View File

@ -13,6 +13,9 @@ project(solidity VERSION ${PROJECT_VERSION})
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF) option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
# Setup cccache.
include(EthCcache)
# Let's find our dependencies # Let's find our dependencies
include(EthDependencies) include(EthDependencies)
include(jsoncpp) include(jsoncpp)

15
cmake/EthCcache.cmake Normal file
View File

@ -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()

View File

@ -14,14 +14,6 @@
# #
# These settings then end up spanning all POSIX platforms (Linux, OS X, BSD, etc) # 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) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fstack-protector-strong have_stack_protector_strong) check_cxx_compiler_flag(-fstack-protector-strong have_stack_protector_strong)