[CMake] add_custom_command and $<...>

Michael Hertling mhertling at online.de
Tue Oct 4 19:56:54 EDT 2011


On 10/04/2011 09:20 PM, Jaime Frey wrote:
> Hi.
> I'm having some trouble with the add_custom_command() function in cmake 2.8.3. I'm using it to run a POST_BUILD command on a target. The docs say I can use $<TARGET_FILE:tgt> in the arguments to COMMAND to get the filename of the generated target file. But no substitution occurs and "$<TARGET_FILE:tgt>" gets plopped into the generated makefiles, where make happily replaces $< with one of the dependencies and the build fails.
> 
> Bug 9465 (http://public.kitware.com/Bug/view.php?id=9465) suggests that $<...> in add_custom_command() hasn't been implemented, but the ticket is 2 years old now. I don't see any mention of this in the Changelog for versions after 2.8.3.
> 
> Am I missing something, or are the docs in error?

AFAIK, generator expressions for custom commands have been introduced in
2.8.4. A possible error - rather an omission - in the documentation is
that they also work for custom targets which isn't mentioned at all.

Regards,

Michael


More information about the CMake mailing list