MantisBT - CMake
View Issue Details
0011209CMakeCMakepublic2010-09-07 02:102011-05-02 14:45
Michael Wild 
Brad King 
normalfeatureN/A
closedfixed 
CMake-2-8 
CMake 2.8.4CMake 2.8.4 
0011209: Support generator expression everywhere they make sense
It would be very convenient if CMake supported the generator expressions available in the ADD_TEST command in all user-definable commands that run at build time. ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET spring to mind.
No tags attached.
related to 0009974closed Brad King CMake should support custom commands that can vary by configuration. 
related to 0009465closed Brad King target names should resolve correctly in COMMAND statements 
Issue History
2010-09-07 02:10Michael WildNew Issue
2010-12-15 12:02David ColeAssigned To => Brad King
2010-12-15 12:02David ColeStatusnew => assigned
2010-12-15 14:28Brad KingRelationship addedrelated to 0009974
2010-12-15 15:36Brad KingNote Added: 0024189
2010-12-15 15:42Brad KingNote Added: 0024190
2010-12-15 15:43Brad KingStatusassigned => resolved
2010-12-15 15:43Brad KingResolutionopen => fixed
2011-01-12 07:37David ColeFixed in Version => CMake 2.8.4
2011-01-12 07:37David ColeTarget Version => CMake 2.8.4
2011-05-02 14:45David ColeNote Added: 0026331
2011-05-02 14:45David ColeStatusresolved => closed
2011-10-05 10:15David ColeRelationship addedrelated to 0009465

Notes
(0024189)
Brad King   
2010-12-15 15:36   
I've wanted to do this feature for a long time. I finally got my chance this month and have been working on it for a couple weeks.

The main commit is

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0cdb600 [^]

but a lot of refactoring and cleanup was needed to get to that point. The full commit range produced by this effort was

  git log --graph afc89064..f0cdb600
(0024190)
Brad King   
2010-12-15 15:42   
Commit f0cdb600 adds support for generator expressions in add_custom_command and add_custom target. They already work in add_test.

The only other place I can think that non-C++ (pure CMake) code can define commands is the Makefile generator rule variables like CMAKE_<lang>_COMPILE_OBJECT. These are very specific to one generator though. Actually the placeholder syntax they use, such as "<TARGET>", was one of the reasons we chose $<> syntax for generator expressions in the first place. We anticipated adding them elsewhere beyond add_test. However, since rule variables are already expanded with per-configuration substitution I don't currently see a use case for generator expressions there. Although it may help cleanup our builtin rule variables we would always have to support the old-style placeholders so I don't want to add extra code until we have a good reason.
(0026331)
David Cole   
2011-05-02 14:45   
Closing resolved issues that have not been updated in more than 3 months.