MantisBT - CMake
View Issue Details
0013388CMakeCMakepublic2012-07-10 04:252013-01-09 10:56
Andreas Mohr 
Brad King 
normalmajoralways
closedfixed 
x86LinuxRHEL5
CMake 2.8.8 
CMake 2.8.9CMake 2.8.9 
0013388: include("${NONEXISTENT_FILE_VARIABLE}" OPTIONAL) will add bogus dir dependency, causing frequent reconfigure runs
A bogus include with an empty string (which may happen very frequently, namely whenever a user uses a variable-based include() and does not bother to set the variable)
will cause very wasteful CMake re-configure runs due to inserting a bogus directory dependency (empty file argument seems to get evaluated to the current source directory during module file lookup algorithms) for the build system to consider for CMake re-configuration evaluation.
CMakeLists.txt:
#include("" OPTIONAL)

Enabling that bogus include() and generating a Ninja build tree will cause the following line in build.ninja:

# Re-run CMake if any of its inputs changed.
build build.ninja: RERUN_CMAKE | /home/amoh/Projects/cmake_tests/include_hook_bug_test /home/amoh/Projects/cmake_tests/include_hook_bug_test/CMakeLists.txt /home/amoh/Projects/cmake_tests/include_hook_bug_test/build/CMakeFiles/CMakeCCompiler.cmake /home/amoh/Projects/cmake_tests/include_hook_bug_test/build/CMakeFiles/CMakeCXXCompiler.cmake /home/amoh/Projects/cmake_tests/include_hook_bug_test/build/CMakeFiles/CMakeSystem.cmake /usr/local/share/cmake-2.8/Modules/CMakeCInformation.cmake /usr/local/share/cmake-2.8/Modules/CMakeCXXInformation.cmake /usr/local/share/cmake-2.8/Modules/CMakeCommonLanguageInclude.cmake /usr/local/share/cmake-2.8/Modules/CMakeGenericSystem.cmake /usr/local/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake /usr/local/share/cmake-2.8/Modules/Compiler/GNU-C.cmake /usr/local/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake /usr/local/share/cmake-2.8/Modules/Compiler/GNU.cmake /usr/local/share/cmake-2.8/Modules/Platform/Linux-GNU-C.cmake /usr/local/share/cmake-2.8/Modules/Platform/Linux-GNU-CXX.cmake /usr/local/share/cmake-2.8/Modules/Platform/Linux-GNU.cmake /usr/local/share/cmake-2.8/Modules/Platform/Linux.cmake /usr/local/share/cmake-2.8/Modules/Platform/UnixPaths.cmake CMakeCache.txt

Pay special attention to the mentioning of /home/amoh/Projects/cmake_tests/include_hook_bug_test

Now if you actually modify the "stat" status quo of this source directory (say, by editing a file in it via vim), then this will trigger - potentially VERY lengthy! - CMake re-configure runs once re-running the build (via "ninja").


Same effect with Makefile generator.

Thank you!
No tags attached.
Issue History
2012-07-10 04:25Andreas MohrNew Issue
2012-07-10 08:36Brad KingAssigned To => Peter Kuemmel
2012-07-10 08:36Brad KingStatusnew => assigned
2012-07-10 08:36Brad KingSummaryinclude("${NONEXISTENT_FILE_VARIABLE}" OPTIONAL) will add bogus dir dependency, causing frequent reconfigure runs => Ninja: include("${NONEXISTENT_FILE_VARIABLE}" OPTIONAL) will add bogus dir dependency, causing frequent reconfigure runs
2012-07-10 10:15Peter KuemmelNote Added: 0030012
2012-07-10 10:15Peter KuemmelStatusassigned => closed
2012-07-10 10:15Peter KuemmelResolutionopen => fixed
2012-07-10 10:21Andreas MohrNote Added: 0030013
2012-07-10 10:21Andreas MohrStatusclosed => feedback
2012-07-10 10:21Andreas MohrResolutionfixed => reopened
2012-07-10 10:34Brad KingNote Added: 0030015
2012-07-10 10:39Peter KuemmelNote Added: 0030016
2012-07-10 10:40Andreas MohrNote Added: 0030017
2012-07-10 10:40Andreas MohrStatusfeedback => assigned
2012-07-10 10:41Brad KingSummaryNinja: include("${NONEXISTENT_FILE_VARIABLE}" OPTIONAL) will add bogus dir dependency, causing frequent reconfigure runs => include("${NONEXISTENT_FILE_VARIABLE}" OPTIONAL) will add bogus dir dependency, causing frequent reconfigure runs
2012-07-10 10:43Brad KingAssigned ToPeter Kuemmel => Brad King
2012-07-10 10:44Brad KingNote Added: 0030018
2012-07-10 10:46Peter KuemmelNote Added: 0030019
2012-07-10 10:52Peter KuemmelNote Edited: 0030019bug_revision_view_page.php?bugnote_id=30019#r740
2012-07-10 10:54Peter KuemmelNote Edited: 0030019bug_revision_view_page.php?bugnote_id=30019#r741
2012-07-10 10:56Brad KingNote Added: 0030020
2012-07-10 10:59Peter KuemmelNote Added: 0030021
2012-07-10 11:07Brad KingNote Added: 0030023
2012-07-10 11:07Brad KingStatusassigned => resolved
2012-07-10 11:07Brad KingResolutionreopened => fixed
2012-08-09 19:43David ColeFixed in Version => CMake 2.8.9
2012-08-09 19:43David ColeTarget Version => CMake 2.8.9
2013-01-09 10:56Robert MaynardNote Added: 0032036
2013-01-09 10:56Robert MaynardStatusresolved => closed

Notes
(0030012)
Peter Kuemmel   
2012-07-10 10:15   
Empty files names are ignored and cmake warns about it.

http://public.kitware.com/pipermail/cmake-commits/2012-July/013024.html [^]
(0030013)
Andreas Mohr   
2012-07-10 10:21   
Sorry, I'm afraid due to having missed some important information in my report, the fix - while quite nice - does not fully cut it.

Problem is that the non-OPTIONAL include() case will _also_ work without erroring out, thereby adding the bogus directory dependency as well in that case.

IOW, this misbehaviour is not specific to OPTIONAL only.

Thank you very much for your lightning-fast handling of this issue!
(0030015)
Brad King   
2012-07-10 10:34   
Re 0013388:0030012: I assigned this to you Peter because it appears to be Ninja-specific. A fix up in include() is not appropriate unless discussed first.

Andreas, I was not able to reproduce this with 2.8.9-rc1. Does it happen with the Makefile generator too?
(0030016)
Peter Kuemmel   
2012-07-10 10:39   
I think it is a bug that empty file names without OPTIONAL are accepted.
(0030017)
Andreas Mohr   
2012-07-10 10:40   
"Same effect with Makefile generator." ;-)
[ok, my initial description probably was a wee bit long]
(0030018)
Brad King   
2012-07-10 10:44   
Re 0013388:0030016: Okay, it's not Ninja-specific. Sorry for the confusion. I'll take over the fix. Thanks.
(0030019)
Peter Kuemmel   
2012-07-10 10:46   
(edited on: 2012-07-10 10:54)
Only OPTIONAL would accept empty file names:

http://public.kitware.com/pipermail/cmake-commits/2012-July/013025.html [^]

Sorry, haven't noticed "appropriate unless discussed first."

(0030020)
Brad King   
2012-07-10 10:56   
Re 0013388:0030019: Note in 0013388:0030018 I said I would take over this fix. Please do not commit more changes.
(0030021)
Peter Kuemmel   
2012-07-10 10:59   
Then please also fix the line length in 39.
(0030023)
Brad King   
2012-07-10 11:07   
Okay, I rewrote the topic (effectively reverting the changes in 0013388:0030012 and 0013388:0030019). Here is the new fix:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e99949c [^]
(0032036)
Robert Maynard   
2013-01-09 10:56   
Closing resolved issues that have not been updated in more than 4 months.