[CMake] Get target name from command line for IF statement

yann suisini yannsuisini at gmail.com
Wed Dec 30 05:29:13 EST 2015


Hi,

I have a cmake file with 2 targets defined inside.
For each target I have to specify a different scatter file for my linker

so I want to use :
if (TARGET target_1)
SET (LINKER_SCATTER_FILE file_1)
else ()
SET (LINKER_SCATTER_FILE file_2)
endif ()

add_executable(target_1 ${srcs_target_1})
add_executable(target_2 ${srcs_target_2})


But if I'm calling cmake from my IDE to build my target using the --target
command line option
does it set the TARGET variable ? If not the case how I can link the targer
name from the command line to my IF statement ?

Regards,

Yann.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151230/f152532b/attachment.html>


More information about the CMake mailing list