CMake: setting CCache before calling the project command

as the comment and https://crascit.com/2016/04/09/using-ccache-with-cmake/
suggest, setting CCache should be done before project command,
because then CMake checks if the compiler can be invoked through CCache
This commit is contained in:
Markus Reitboeck
2019-04-11 21:46:34 +02:00
committed by wmayer
parent 487544d393
commit 78fe9b570e

View File

@@ -16,6 +16,12 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0072 OLD)
endif(POLICY CMP0072)
endif(COMMAND cmake_policy)
find_program(CCACHE_PROGRAM ccache) #This check should occur before project()
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
project(FreeCAD)
set(PACKAGE_VERSION_NAME "Vulcan")
@@ -27,11 +33,6 @@ set(FREECAD_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}")
find_program(CCACHE_PROGRAM ccache) #This check should occur before project()
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
# include local modules
include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake)