MantisBT - CMake
View Issue Details
0015923CMakeCMakepublic2016-01-18 07:202016-06-10 14:31
Mads Brix 
Kitware Robot 
normalminoralways
closedmoved 
Linux
CMake 3.4.1 
 
0015923: Makefile is written/updated even if there are errors in cmake.
If there is an error when running cmake (e.g. because of misspelled source file name) the Makefile will be written.
This means that the next time one runs make, compilation is attempted (since the Makefile is up-to-date), and therefore the output is a compilation error, and not the (root cause) error from running cmake.

With ninja this does not happen - the build.ninja is only written/updated if cmake execution is error free.

Another situation is where a succesful build has been done, and error is then introduced (e.g. by spelling mistake when adding new source file).

Correction would be to change Makefile generator to work like Ninja generator and only write/update Makefile if cmake is error free.

Found with cmake 3.3.2, also present in 3.4.1.
1) create directories source, build.Ninja, build.Make.
2) create simple CMakeLists.txt in source directory:
project (TestMakefileError)
add_executable(TestMakefileError NonExistentFile.cc)
3) In build.Make run: "cmake ../source/"
Error from cmake is reported, but Makefile is written, so when running make the cmake error is not reported.
4) In build.Ninja run. "cmake -G Ninja ../source/"
Error from cmake is reported, but build.ninja is not written.
No tags attached.
Issue History
2016-01-18 07:20Mads BrixNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042914
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042914)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.