[CMake] add_custom_command and $<...>

Jaime Frey jfrey at cs.wisc.edu
Tue Oct 4 15:20:39 EDT 2011


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?

+--------------------------------+-----------------------------------+
|           Jaime Frey           | I used to be a heavy gambler.     |
|       jfrey at cs.wisc.edu        | But now I just make mental bets.  |
|                                | That's how I lost my mind.        |
+--------------------------------+-----------------------------------+



More information about the CMake mailing list