[CMake] CMAKE_CXX_COMPILER and the cache

Fernando Cacciola fernando.cacciola at gmail.com
Tue Jul 15 13:18:44 EDT 2008


Hi people,

I'm trying to understand a user report which says that load_cache ignores 
CMAKE_CXX_COMPILER (and I need it to load it!!)

While playing around with this unfortunate fact, it became apparent that 
this particular variable is not read from the cache at all (not even from 
the current cache).

I can tell because I can read in the current CMakeCache.txt that in fact it 
contains the value which should have been loaded from the saved cache, yet a 
MESSAGE commands reveals that this cached value is not the same as the 
in-memory value of the variable.

Is that so?? is this a memory-only variable whose cache value is never read 
in (thus can end up being completely incoherent, as in my case) ?

I know a user can set the enviroment variable CXX in order to specify the 
compiler, but, are there other magical variables like this I should know 
about, that is, which not being internal nor static nor excluded are 
nevertheless not read in via load_cache?

And a related question:  can a user pass a sort of "uninitialized" value via 
the -D command line switch?
I am using cmake in an automated context where the call cmake is done by a 
script.
If I use someting like this:

   cmake -DCMAKE_CXX_COMPILER=${USER_CXX_COMPILER}

it won't work when the intention is NOT to specify that (the usual case), 
unless a value of NOTFOUND or "" is interpreted as such.

TIA

Fernando Cacciola




More information about the CMake mailing list