View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009465CMakeCMakepublic2009-08-31 18:102012-03-06 08:37
ReporterSteve King 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in VersionCMake 2.8.4 
Summary0009465: target names should resolve correctly in COMMAND statements
DescriptionCommands should be able to substitute the target name for build output location of that target. In other words, commands like this fail:

add_executable( foo foo.cpp )
add_custom_command( OUTPUT new_foo COMMAND $(CMAKE_COMMAND) -E copy foo new_foo )

Cmake should recognize 'foo' as a target and implicitly substitute foo's build output.

Currently, the LOCATION property of the target must be used, which is much more cumbersome.
TagsNo tags attached.
Attached Files

 Relationships
related to 0011209closedBrad King Support generator expression everywhere they make sense 
related to 0009974closedBrad King CMake should support custom commands that can vary by configuration. 

  Notes
(0017501)
Brad King (manager)
2009-09-14 18:24

CMake does recognize targets if they are the COMMAND executable:

  add_executable(mycopy ...)
  add_custom_command(
    OUTPUT out.txt
    DEPENDS in.txt
    COMMAND mycopy ...
    )

We cannot automatically convert the plain string "foo" in the middle of an argument list...it is ambiguous. However, there does need to be a way to get CMake to replace a token in an argument with information about the target location.

In CMake HEAD from CVS, the add_test() command has a new signature that support a "generator expression" syntax for just this purpose. An argument of this syntax:

  $<TARGET_FILE:myexe>

is replaced with the per-configuration target location which is not known until generate time. I've been meaning to teach add_custom_command about this syntax but it's not yet done. I'll update this issue when it is.
(0027525)
David Cole (manager)
2011-10-05 10:17

The fix for 0011209 added "generator expressions" to CMake 2.8.4

You may use generator expressions to get target file and directory names using CMake 2.8.4 and later.
(0027526)
David Cole (manager)
2011-10-05 12:54

This was fixed at the same time as related bug 0011209 - the fix for that one provides a superset of the functionality needed to fix this one...

Use the generator expressions available in 2.8.4 and later to provide custom commands with arguments derived from the target properties.
(0028819)
David Cole (manager)
2012-03-06 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2009-08-31 18:10 Steve King New Issue
2009-09-11 17:25 Bill Hoffman Status new => assigned
2009-09-11 17:25 Bill Hoffman Assigned To => Bill Hoffman
2009-09-11 17:25 Bill Hoffman Assigned To Bill Hoffman => Brad King
2009-09-14 18:24 Brad King Note Added: 0017501
2011-10-05 10:15 David Cole Relationship added related to 0011209
2011-10-05 10:15 David Cole Relationship added parent of 0009974
2011-10-05 10:15 David Cole Relationship deleted parent of 0009974
2011-10-05 10:16 David Cole Relationship added related to 0009974
2011-10-05 10:17 David Cole Note Added: 0027525
2011-10-05 12:54 David Cole Note Added: 0027526
2011-10-05 12:54 David Cole Status assigned => resolved
2011-10-05 12:54 David Cole Fixed in Version => CMake 2.8.4
2011-10-05 12:54 David Cole Resolution open => fixed
2012-03-06 08:37 David Cole Note Added: 0028819
2012-03-06 08:37 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team