<div dir="ltr">LINK_FLAGS property do not support generator expressions.<div><br></div><div>In CMake 3.13, directory and target properties LINK_OPTIONS, supporting generator expressions, managed by commands add_link_options and target_link_options are introduced, .</div><div><br></div><div>For earlier versions you can use global variables to set flags for all targets (CMAKE_*_LINKER_FLAGS) and use target property LINK_FLAGS to override default settings (options specified by LINK_FLAGS are defined <font size="2"><b>after</b> those coming from global variable).</font></div><div><font size="2"><br></font></div></div><br><div class="gmail_quote"><div dir="ltr">Le mer. 4 juil. 2018 à 05:06, Hendrik Sattler <<a href="mailto:post@hendrik-sattler.de">post@hendrik-sattler.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You could try a generator expression with a custom target property.<br>
<br>
Am 4. Juli 2018 04:27:58 MESZ schrieb Andrew White <<a href="mailto:andrew.white@audinate.com" target="_blank">andrew.white@audinate.com</a>>:<br>
>In my cross-compile environment for an embedded platform, I need to set<br>
>the stack size for each executable. The linker flag to set the stack<br>
>size is (for example) "-Wl,-elf2flt='-s 20000'".<br>
><br>
>Is there an easy way to set this flag for every executable except one,<br>
>for which I set "-Wl,-elf2flt='-s 40000'"? Obviously I can call<br>
> Set_target_properties(<target> PROPERTIES LINK_FLAGS "-Wl,-elf2flt='-s<br>
>20000'")<br>
>on each target, but is there a mechanism to make this the default and<br>
>then set a different value on a single target?<br>
><br>
>If necessary, I suspect "-Wl,-elf2flt='-s 20000' -Wl,-elf2flt='-s<br>
>40000'" will produce the correct result.<br>
>* can I avoid doing it like this?<br>
>* how can I be sure that the more specific option will follow the<br>
>general one?<br>
><br>
>(Assume all the targets are added via add_subdirectory commands that<br>
>are common across multiple platforms, and that I'm adding<br>
>platform-specific build rules in the project CMakeLists.txt)<br>
><br>
>Thanks<br>
><br>
>--<br>
>Andrew<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>