[cmake-developers] [CMake 0014699]: Implicity dependency scanner does not not update depend.make in succeeding incremental make builds if a #include was missing

Mantis Bug Tracker mantis at public.kitware.com
Wed Jan 15 02:54:26 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14699 
====================================================================== 
Reported By:                Christian Meyer
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14699
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-01-15 02:54 EST
Last Modified:              2014-01-15 02:54 EST
====================================================================== 
Summary:                    Implicity dependency scanner does not not update
depend.make in succeeding incremental make builds if a #include was missing
Description: 
If a #included header is not found on disk by the dependency scanner, that file
will be absent from depend.make, which is fine, because the build will fail
anyway. If during a succeeding build that header is added to the project and
that build succeeds, CMake will fail to update depend.make with the now
available header and will also not update depend.make with any other #included
files that may have been added to the source file in question.

This means that the generated build system is corrupted and the only remedy I
was able to find is deleting all CMake generated files and starting over.

This is curious, because CMake will happily update depend.make with newly added
#included files in incremental builds if it was able to find all #included files
before.

I added a script that demonstrates this behavior.

Steps to Reproduce: 
#!/bin/bash

# Test script to demonstrate lack of dependency updating in cmake after users
forgot to commit header files to repositories

cmake --version
echo "### Create a minimal test project"
echo "#include \"main.h\"" > main.cpp
echo "int main() {return 0;}" >> main.cpp
echo "add_executable(TestApp main.cpp)" > CMakeLists.txt
echo "### Run CMake and build the project (fails because main.h is
missing)"
mkdir build
cd build
cmake ..
make
echo "### Need to wait for a sec or there might be no timestamp difference on
main.cpp"
sleep 1
echo "### Add previously missing main.h and a new header aux.h"
touch ../main.h
touch ../aux.h
echo "### Update main.cpp with the new header"
echo "#include \"aux.h\"" > ../main.cpp
echo "#include \"main.h\"" >> ../main.cpp
echo "int main() {return 0;}" >> ../main.cpp
echo "### Run make (main.cpp is rebuilt)"
make
echo "### Display depend.make and observe that both main.h and aux.h are
missing"
cat CMakeFiles/TestApp.dir/depend.make
# Clean up for retest
cd ..
rm -rf build
rm main.cpp
rm CMakeLists.txt
rm aux.h
rm main.h

Additional Information: 
I have mentioned this in another bug report -
(http://www.cmake.org/Bug/view.php?id=14697#c34937) - but I seem to have
emphasized the wrong part of the problem.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-01-15 02:54 Christian MeyerNew Issue                                    
======================================================================



More information about the cmake-developers mailing list