[cmake-developers] [CMake 0015923]: Makefile is written/updated even if there are errors in cmake.

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 18 07:20:32 EST 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15923 
====================================================================== 
Reported By:                Mads Brix
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15923
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-01-18 07:20 EST
Last Modified:              2016-01-18 07:20 EST
====================================================================== 
Summary:                    Makefile is written/updated even if there are errors
in cmake.
Description: 
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.


Steps to Reproduce: 
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.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-01-18 07:20 Mads Brix      New Issue                                    
======================================================================



More information about the cmake-developers mailing list