[cmake-developers] [CMake 0012877]: Support generator expressions in OUTPUT

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 16 03:49:15 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12877 
====================================================================== 
Reported By:                Petr Kmoch
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12877
Category:                   CMake
Reproducibility:            N/A
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-01-16 09:49 CET
Last Modified:              2012-01-16 09:49 CET
====================================================================== 
Summary:                    Support generator expressions in OUTPUT
Description: 
While $<...> generator expressions in the COMMAND portion of
add_custom_command() are useful, I find their use is limited by the fact they
cannot be used in other parts of add_custom_command(), such as OUTPUT. For
example, in my project, I need a custom command to copy some files to the
directory where a target's executable resides. In other words, I need the
following:

add_custom_command(
 OUTPUT "$<TARGET_FILE_DIR:MyTarget>/TheExtraFile"
 COMMAND "${CMAKE_EXECUTABLE}" -E copy Path_To/TheExtraFile
"$<TARGET_FILE_DIR:MyTarget>/TheExtraFile"
 VERBATIM
)

While in the COMMAND part, the generator expression is interpreted correctly, in
OUTPUT it's not, and CMake produces an error: "add_custom_command called with
OUTPUT containing a "<".  This character is not allowed."

I saw http://public.kitware.com/Bug/view.php?id=9974 which would offer a
superset od the above functionality, but the above would offer simpler syntax
for this more specific class of uses.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-16 09:49 Petr Kmoch     New Issue                                    
======================================================================




More information about the cmake-developers mailing list