[CMake] $<TARGET_FILE:tgt> in the add_custom_command()

aaron.meadows at thomsonreuters.com aaron.meadows at thomsonreuters.com
Tue Feb 14 10:36:32 EST 2012


Looks like '+' is not a valid character for the target name. 

 

Specifically, cmGeneratorExpression.cxx does not have it as part of the
regular expression to match target names: (line 23 on)

 

 

  this->TargetInfo.compile("^\\$<TARGET"

                           "(|_SONAME|_LINKER)"  // File with what
purpose?

                           "_FILE(|_NAME|_DIR):" // Filename component.

                           "([A-Za-z0-9_.-]+)"   // Target name.

                           ">$");

 

(In case you're unfamiliar with regular expressions, that + is just to
denote 1 or more of the things between the [ and ] . )

 

I tried adding + to that list, but I'm not sure how (if it's possible)
to escape it (and it resulted in a regular expression compile error
(runtime)).  I'd suggest using something else instead of a + in your
target name.

 

Aaron Meadows

 

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of Kozlovskiy, Alexey
Sent: Tuesday, February 14, 2012 5:38 AM
To: cmake at cmake.org
Subject: [CMake] $<TARGET_FILE:tgt> in the add_custom_command()

 

Hi,

 

If the project name has a symbols "-" or "+" the $<TARGET_FILE:tgt> in
the add_custom_command() return Error: "Error evaluating generator
expression"

 

For example:

SET ( PROJECT_NAME "00010-Liquid+Gas_as_capture " )

set ( SRCS_MAIN_CPT main.c      )

add_executable ( ${ PROJECT_NAME } ${SRCS_MAIN_CPT} )

 

add_custom_command ( TARGET ${ PROJECT_NAME } POST_BUILD 

                                            COMMAND "$<TARGET_FILE:${
PROJECT_NAME }>" 

                                            ARGS "$<TARGET_FILE_DIR:${
PROJECT_NAME }>/110.cnf"

                                            COMMENT "Running cpt.exe..."

 


)

 

When I run the CMake I received the following error:

 

"CMake Error at problems.rt.Cmake:114 (add_custom_command):

  Error evaluating generator expression:

    $<TARGET_FILE:00010-Liquid+Gas_as_capture>

Expression syntax not recognized."

 

Is this a bug or some syntax limitation?

 

Regards,

Alexey

 

 


This email was sent to you by Thomson Reuters, the global news and information company. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120214/93bb3f71/attachment.htm>


More information about the CMake mailing list