MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0014697 | CMake | CMake | public | 2014-01-14 08:07 | 2014-06-02 08:38 | |||||
Reporter | Christian Meyer | |||||||||
Assigned To | ||||||||||
Priority | normal | Severity | major | Reproducibility | always | |||||
Status | closed | Resolution | not fixable | |||||||
Platform | OS | linux | OS Version | |||||||
Product Version | CMake 2.8.7 | |||||||||
Target Version | Fixed in Version | |||||||||
Summary | 0014697: CMake does not add files to depend.make which are referenced by #include but not present on disk | |||||||||
Description | I added a bash script which should reproduce the problem on any system with a working cmake installation when generating Makefiles. It boils down to CMake omitting to add a #included file to the depend.make if that include is not present on the hard drive at build time. Unfortunately it does not fix this when that file is added afterwards. Use Case: 1. User commits new source to a repository but omits a header file (fairly common) 2. Build server initiates an incremental build which fails because the header file is missing 3. User commits the missing header 4. Build server starts incremental build, build succeeds 5. User modifies the header 6. Expected: Build server rebuilds the source file which included the header; Actual: Build server does nothing | |||||||||
Steps To Reproduce | #!/bin/bash # Test script to check for correct dependency updating in cmake when users forget to commit header files to repositories # Returns a non-zero exit code on test failure. 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 (should fail because main.h is missing)" cmake . make echo "### At this point the build fails because the header is missing" echo "# Create the header and make (now the build should pass)" touch main.h make echo "### Now the build passes normally" echo "# Touch the header and make (now main.cpp should be rebuilt)" touch main.h make echo "### The build does not recompile main.cpp even though I touched main.h" echo "# Display depend.make and observe that main.h is missing" cat CMakeFiles/TestApp.dir/depend.make grep -q main.h CMakeFiles/TestApp.dir/depend.make TEST_PASSED=$? # Clean up for retest make clean rm main.h exit ${TEST_PASSED} | |||||||||
Additional Information | Script output on my local machine: cmake version 2.8.7 ### Create a minimal test project ### Run CMake and build the project (should fail because main.h is missing) -- Configuring done -- Generating done -- Build files have been written to: /scratch/gridbox/cmake-test [100%] Building CXX object CMakeFiles/TestApp.dir/main.cpp.o /scratch/gridbox/cmake-test/main.cpp:1:18: fatal error: main.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/TestApp.dir/main.cpp.o] Error 1 make[1]: *** [CMakeFiles/TestApp.dir/all] Error 2 make: *** [all] Error 2 ### At this point the build fails because the header is missing # Create the header and make (now the build should pass) [100%] Building CXX object CMakeFiles/TestApp.dir/main.cpp.o Linking CXX executable TestApp [100%] Built target TestApp ### Now the build passes normally # Touch the header and make (now main.cpp should be rebuilt) [100%] Built target TestApp ### The build does not recompile main.cpp even tough I touched main.h # Display depend.make and observe that main.h is missing # CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 2.8 CMakeFiles/TestApp.dir/main.cpp.o: main.cpp | |||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | ||||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2014-01-14 08:07 | Christian Meyer | New Issue | ||||||||
2014-01-14 09:18 | Brad King | Note Added: 0034937 | ||||||||
2014-01-14 09:18 | Brad King | Status | new => resolved | |||||||
2014-01-14 09:18 | Brad King | Resolution | open => not fixable | |||||||
2014-01-15 09:31 | Brad King | Relationship added | has duplicate 0014699 | |||||||
2014-06-02 08:38 | Robert Maynard | Note Added: 0036079 | ||||||||
2014-06-02 08:38 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|