From 78fe9b570e9710816f841945bc6e5abf194c621e Mon Sep 17 00:00:00 2001 From: Markus Reitboeck Date: Thu, 11 Apr 2019 21:46:34 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30cd89d48b..cfe1612b0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)