On 02/14/2012 04:36 PM, aaron.mead...@thomsonreuters.com wrote: > *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-boun...@cmake.org [mailto:cmake-boun...@cmake.org] *On > Behalf Of *Kozlovskiy, Alexey > *Sent:* Tuesday, February 14, 2012 5:38 AM > *To:* cmake@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
As a work-around use a different target name which is "clean" and then use the OUTPUT_NAME target property to get the desired file name. Michael -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake