MantisBT - CMake
View Issue Details
0015467CMakeCMakepublic2015-03-21 22:042015-11-02 09:13
Zhihao Yuan 
 
highminoralways
closedno change required 
FreeBSD
CMake 3.1.3 
 
0015467: add_custom_target ALL option regression
It seems that the ALL option is not making the target to run before other targets after cmake 3.1.

The cmake file is here:

  https://github.com/lichray/nvi2/blob/master/build/CMakeLists.txt#L49 [^]

I'm generating header files with add_custom_commend and using add_custom_target to run those commands.
See https://github.com/lichray/nvi2/issues/29 [^]
No tags attached.
related to 0015366closed Brad King set_source_files_properties OBJECT_DEPENDS broken after normalization 
related to 0015470closed Kitware Robot Clarify behavior for relative paths in custom command DEPENDS 
Issue History
2015-03-21 22:04Zhihao YuanNew Issue
2015-03-23 09:39Brad KingNote Added: 0038275
2015-03-23 09:39Brad KingStatusnew => resolved
2015-03-23 09:39Brad KingResolutionopen => no change required
2015-03-23 11:56Zhihao YuanNote Added: 0038279
2015-03-23 13:01Brad KingRelationship addedrelated to 0015366
2015-03-23 13:06Brad KingNote Added: 0038281
2015-03-23 13:12Brad KingRelationship addedrelated to 0015470
2015-03-23 13:13Brad KingNote Added: 0038282
2015-11-02 09:13Robert MaynardNote Added: 0039744
2015-11-02 09:13Robert MaynardStatusresolved => closed

Notes
(0038275)
Brad King   
2015-03-23 09:39   
The ALL option just means that "make" with no other arguments will build the custom target even if it is not a dependency of anything else. No order of custom targets is defined with respect to other targets. You need to use

 add_dependencies(target-that-needs-custom-target custom-target)

to specify target ordering dependencies.
(0038279)
Zhihao Yuan   
2015-03-23 11:56   
I tried

  add_dependencies(nvi headers)

where nvi is the executable target, headers is the custom target depends on headers generated by custom commands, still doesn't work.
(0038281)
Brad King   
2015-03-23 13:06   
The project in question uses lots of relative paths in its DEPENDS options. It looks like our documentation fails to specify that DEPENDS must be either absolute paths or target names.

Likely relative DEPENDS values resolve differently after this change in CMake 3.1:

 add_custom_command: Normalize OUTPUT and DEPENDS paths.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4af46b4 [^]
(0038282)
Brad King   
2015-03-23 13:13   
I've opened 0015470 to track the fact that we've never documented well-defined behavior for relative paths in DEPENDS.
(0039744)
Robert Maynard   
2015-11-02 09:13   
Closing resolved issues that have not been updated in more than 4 months.