The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15605 
====================================================================== 
Reported By:                Lekensteyn
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15605
Category:                   Documentation
Reproducibility:            N/A
Severity:                   text
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-06-07 15:52 EDT
Last Modified:              2015-06-07 15:52 EDT
====================================================================== 
Summary:                    Mention TARGET_FILE for COMMAND option of
add_custom_command
Description: 
While trying to set an environment variable in an add_custom_command target, I
found http://www.cmake.org/pipermail/cmake/2006-March/008522.html which
describes this syntax:

    add_custom_command(TARGET foo
      COMMAND ${CMAKE_COMMAND} -E env
      VAR=VAL somecommand ...)

This works when somecommand is a system command, but in my case it was an
executable which was previously added by add_executable(somecommand ...).

The documentation at
http://www.cmake.org/cmake/help/v3.2/command/add_custom_command.html describes
how this special behavior works:

    "If COMMAND specifies an executable target (created by the add_executable()
command) it will automatically be replaced by the location of the executable
created at build time."

While the following paragraph mentions generator expressions (thanks again Nils
Gladitz!), it would help if $<TARGET_FILE:somecommand> was mentioned in the same
sentence for cases like the above (cmake -E env).
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-06-07 15:52 Lekensteyn     New Issue                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to