Skip to content
Snippets Groups Projects
Commit 4cbba1ff authored by Lars Bilke's avatar Lars Bilke Committed by Lars Bilke
Browse files

[CMake] Check for required ccache config.

parent 5a185073
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ include(scripts/cmake/Functions.cmake)
include(scripts/cmake/CMakeSetup.cmake)
include(scripts/cmake/CompilerSetup.cmake)
include(scripts/cmake/Find.cmake)
include(scripts/cmake/CCacheSetup.cmake)
include(scripts/cmake/SubmoduleSetup.cmake)
include(scripts/cmake/ProjectSetup.cmake)
include(scripts/cmake/DocumentationSetup.cmake)
......
if(NOT CCACHE_TOOL_PATH)
return()
endif()
# Set ccache as the compiler launcher
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
if(COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
endif()
# Check ccache pre-compiled headers config
execute_process(COMMAND ${CCACHE_TOOL_PATH} --print-config
OUTPUT_VARIABLE CCACHE_CONFIG
ERROR_VARIABLE CCACHE_CONFIG
)
# Regex should be "sloppiness.*time_macros.*pch_defines.*" but due to bug fixed
# in https://ccache.samba.org/releasenotes.html#_ccache_3_2_5 we have to leave
# out pch_defines. Ubuntu 16.04 comes with ccache 3.2.4 ...
string(REGEX MATCH "sloppiness.*time_macros.*"
COTIRE_CCACHE_CONFIG ${CCACHE_CONFIG}
)
if(NOT COTIRE_CCACHE_CONFIG)
message(FATAL_ERROR "CCache not configured! You must set sloppiness to pch_defines,time_macros. See https://docs.opengeosys.org/docs/devguide/advanced/using-ccache")
endif()
......@@ -54,15 +54,7 @@ find_program(CURL_TOOL_PATH curl DOC "The curl-tool")
find_program(S3CMD_TOOL_PATH s3cmd DOC "S3cmd tool for uploading to Amazon S3")
## CCache
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
if(COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
endif()
endif(CCACHE_FOUND)
find_program(CCACHE_TOOL_PATH ccache)
# Tools for web
find_program(VTKJS_CONVERTER vtkDataConverter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment