[CMake] Changing link flags for one target
Andrew White
andrew.white at audinate.com
Tue Jul 3 22:27:58 EDT 2018
In my cross-compile environment for an embedded platform, I need to set the stack size for each executable. The linker flag to set the stack size is (for example) "-Wl,-elf2flt='-s 20000'".
Is there an easy way to set this flag for every executable except one, for which I set "-Wl,-elf2flt='-s 40000'"? Obviously I can call
Set_target_properties(<target> PROPERTIES LINK_FLAGS "-Wl,-elf2flt='-s 20000'")
on each target, but is there a mechanism to make this the default and then set a different value on a single target?
If necessary, I suspect "-Wl,-elf2flt='-s 20000' -Wl,-elf2flt='-s 40000'" will produce the correct result.
* can I avoid doing it like this?
* how can I be sure that the more specific option will follow the general one?
(Assume all the targets are added via add_subdirectory commands that are common across multiple platforms, and that I'm adding platform-specific build rules in the project CMakeLists.txt)
Thanks
--
Andrew
More information about the CMake
mailing list