From 4e020c14a310f9a51d6e9348be236cb44923d8cf Mon Sep 17 00:00:00 2001 From: Jacob Oursland Date: Thu, 30 Nov 2023 18:33:12 -0700 Subject: [PATCH] CMake: Use /Z7 instead of /Zi when ccache is used. --- .../SetGlobalCompilerAndLinkerSettings.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake b/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake index f70ba715b3..29961c3fa7 100644 --- a/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake +++ b/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake @@ -42,6 +42,13 @@ macro(SetGlobalCompilerAndLinkerSettings) set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHa") endif() endif(FREECAD_RELEASE_SEH) + if(CCACHE_PROGRAM) + # By default Visual Studio generators will use /Zi which is not compatible + # with ccache, so tell Visual Studio to use /Z7 instead. + string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + endif(CCACHE_PROGRAM) option(FREECAD_USE_MP_COMPILE_FLAG "Add /MP flag to the compiler definitions. Speeds up the compile on multi processor machines" ON) if(FREECAD_USE_MP_COMPILE_FLAG)