[CMake] How to determine the current target?
Alexander Neundorf
a.neundorf-work at gmx.net
Thu Apr 9 16:30:02 EDT 2009
On Thursday 09 April 2009, Jeremy Cowgar wrote:
> When I type:
>
> $ make abc_xyz
>
> I'd like to be able to do some tests against that value, "abc_xyz". How
> can I do that? For instance:
>
> IF( ${CURRENT_MAKE_TARGET} MATCHES "abc_xyz" )
> MESSAGE( "Hello World!" )
> ENDIF()
>
> but I don't know what the var name is and I seem to be missing it in the
> docs.
No, that's wrong in principle.
In the cmake files there is no current target, they describe all targets.
If you want to do something when some target is built, you have to do this via
dependencies, either via add_custom_command() or add_custom_target().
Alex
More information about the CMake
mailing list