[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Get target name from command line for IF statement
From:       yann suisini <yannsuisini () gmail ! com>
Date:       2015-12-30 10:29:13
Message-ID: CA+qGvKzTnHUsiV0Jm2wHjCE=Es+UoPKjNc0uxv7XZ9pdmEK7OQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.

[Attachment #5 (text/html)]

<div dir="ltr">Hi,<div><br></div><div>I have a cmake file with 2 targets defined \
inside.</div><div>For each target I have to specify a different scatter file for my \
linker</div><div><br></div><div>so I want to use :</div><div><div>if (TARGET \
target_1)</div><div><span class="" style="white-space:pre">	</span>SET \
(LINKER_SCATTER_FILE file_1)</div><div>else ()</div><div><span class="" \
style="white-space:pre">	</span>SET (LINKER_SCATTER_FILE file_2)</div><div>endif \
()</div></div><div><br></div><div>add_executable(target_1 \
${srcs_target_1})<br></div><div>add_executable(target_2 \
${srcs_target_2})<br></div><div><br></div><div><br></div><div>But if I&#39;m calling \
cmake from my IDE to build my target using the --target command line \
option</div><div>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 \
?</div><div><br></div><div>Regards,</div><div><br></div><div>Yann.</div><div><br></div><div><br></div><div><br></div><div><br></div></div>




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic