Hi.
When changing compiler from clang to gcc, I have the following message:
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= gcc
CMAKE_CXX_COMPILER= g++
That seems good by it seems also that my user defined variable are lost.
To be more specific, my CMakeList contains:
set(SANITIZE "Off" CACHE STRING "Sanitize (On/Off <default>)")
IF (SANITIZE STREQUAL "Off")
MESSAGE("Debug Sanitize Off")
ELSE()
MESSAGE("Debug Sanitize On")
ENDIF()
I set SANITIZE On from command line but when running with the compiler change, I have following behavior:
Debug Sanitize On
...
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= clang
CMAKE_CXX_COMPILER= clang++
...
-- The CXX compiler identification is Clang
...
Debug Sanitize Off
Is there a way, when CMake deletes its cache, to ensure that cache variable are reset to the values given on command line?
Or, possible workaround, make cmake fail in this situation, which I may detect, then I may “manually” clean the cache and relaunch my command line?
Regards
A.