MantisBT - CMake
View Issue Details
0012552CMakeCMakepublic2011-11-02 10:062012-02-08 13:51
bert 
Rolf Eike Beer 
normalminoralways
closedno change required 
x86_64Ubuntu10.10
CMake-2-8 
 
0012552: CMake ignores toolchain file
CMake seems to ignore a (possibly faulty) toolchain file. Regardless whether I use the CMAKE_TOOLCHAIN_FILE option or not, the exact same Makefile is generated. Furthermore, CMake doesn't even throw errors on faulty or non-exisiting toolchain files. I'm not sure whether this is intended behavior, though.
$ cmake .
-- Entering Project Cmake File...
-- Configuring the ... Library...
-- Configuring for Standard-Linux...
-- Configuring done
-- Generating done
-- Build files have been written to: ...
$ cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-that-should-work.cmake .
-- Entering Project Cmake File...
-- Configuring the ... Library...
-- Configuring for Standard-Linux...
-- Configuring done
-- Generating done
-- Build files have been written to: ...
$ echo fubar > dummy-toolchain.cmake
$ cmake -DCMAKE_TOOLCHAIN_FILE=dummy-toolchain.cmake .
-- Entering Project Cmake File...
-- Configuring the ... Library...
-- Configuring for Standard-Linux...
-- Configuring done
-- Generating done
-- Build files have been written to: ...
$ cmake -DCMAKE_TOOLCHAIN_FILE=nonexisting-file.cmake .
-- Entering Project Cmake File...
-- Configuring the ... Library...
-- Configuring for Standard-Linux...
-- Configuring done
-- Generating done
-- Build files have been written to: ...

A diff on all the generated Makefiles shows no differences.
$ uname -a
Linux PC 2.6.35-30-generic 0000061-Ubuntu SMP Tue Oct 11 17:52:57 UTC 2011 x86_64 GNU/Linux
$ cmake --version
cmake version 2.8.2
No tags attached.
Issue History
2011-11-02 10:06bertNew Issue
2011-11-02 10:13Eric NOULARDNote Added: 0027709
2011-11-02 11:34bertNote Added: 0027710
2011-11-04 18:50Eric NOULARDNote Added: 0027729
2012-02-08 13:51Rolf Eike BeerStatusnew => closed
2012-02-08 13:51Rolf Eike BeerAssigned To => Rolf Eike Beer
2012-02-08 13:51Rolf Eike BeerResolutionopen => no change required

Notes
(0027709)
Eric NOULARD   
2011-11-02 10:13   
Hi Bert,

This is because you've already done one CMake run in the same build dir
so that CMake is using previously cached vars values.

Could you retry the faulty toolchain case in a pristine build dir?


As a side note you'd better use out-of-source build:
http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees [^]
(0027710)
bert   
2011-11-02 11:34   
Ok, this was obviously my fault. After removing the CMakeCache.txt, CMake does not ignore the CMAKE_TOOLCHAIN_OPTION anymore. Thanks for the hints and sorry for sort of abusing the bug tracker.

Maybe some kind of "--force" option could make this behavior more transparent to the user? Or maybe a warning, that one is trying to screw up a previously generated build tree with build files that would actually belong into a new, seperate build tree. But just ignoring user inputs doesn't feel right to me.
(0027729)
Eric NOULARD   
2011-11-04 18:50   
Suggest the requested behavior on the mailing thus you'll get
more feedback on your suggestion.

That said it's very convenient to be able to call
"cmake <path-to-existing-build>" in a previously configured directory

and cached values are not overwritten by the value in the toolchain.