[CMake] Setting the cmake compiler...

Peter Soetens peter.soetens at fmtc.be
Mon Oct 23 10:30:10 EDT 2006


On Friday 20 October 2006 17:52, John Biddiscombe wrote:
> >> Another 'bug' is that you can edit the CMAKE_CXX_COMPILER field in
> >> ccmake, but when you run 'c', the field is overwritten again. All
> >> very annoying. Maybe a SET( LOCKED ...) flag could be added such that
> >> fields are not user editable.
> >
> > You could enter a bug in the bugtracker if it's not there already.
>
> It's not quite a bug.

From a cmake developer's perspective it isn't but...

> The first time ccmake is run the compiler tests are performed and the
> results are written into the cmakefiles subdir in the build tree, along
> with relevant cache variables. When you change the compiler, the new one
> doesn't match the one used to generate the initial info and it gets
> reset - even though you have told the cache to have a new value. This is
> an obscure and hard to track down things, but wiping the cmakefiles
> cache will make it go away.(and this is why you need to wipe the build
> tree - but you can keep you main cache if you want - and are careful)

... this 'reasoning' is utterly meaningless for any 'cmake' user. Actually, I
don't care about the cache. Or a user can modify it in the GUI or he can't.
Or it is visible in the GUI or it isn't. Anything more complex leads to 
frustration. INTERNAL, FORCE, CACHE,... ? Three not orthogonal parameters 
influence the behaviour of an option.

From the manual: "If  TYPE  is INTERNAL, then the VALUE is always written into 
the cache, replacing any values existing in the cache.  If it is not a cache 
variable, then this always writes into the current  makefile.  The FORCE 
option will overwrite the cache value removing any changes by the user."

Although it correctly describes what is happening (I think!), it does not help 
much in building a mental model of what cmake can do for you. What about:

CALCULATED: The user can *not* modify this variable in the GUI, a macro does 
it for him
INTERNAL: The user can *not* see this variable in the GUI.

...and cache anything that is not calculated. Deprecate all other SET options.

I happen to know that the ecos buildsystem uses such definitions to create a 
build configuration. It works.

I've added a 'note' to the Wiki, 
<http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools>

But it shouldn't be needed in the first place.

Peter

-- 
Peter Soetens -- FMTC -- <http://www.fmtc.be>


More information about the CMake mailing list