[CMake] Changing link flags for one target

2018-07-03 Thread Andrew White
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 2'". Is there an easy way to set this flag for every executable except one, for which I set

[CMake] Adding a target to 'all' that was previously excluded

2018-07-03 Thread Andrew White
How do I add an excluded (executable) target to the build. I know that if I add a library EXCLUDE_FROM_ALL and then create a dependency on that library then that the library will be built anyway. How do I trigger similar behaviour from an executable target? Example: Directory A contains a

[CMake] Different INSTALL target settings per project

2018-07-03 Thread Andrew White
We have a number of projects that include other projects. Some of the parent projects are cross-compile projects with various odd settings. Example project: add_subdirectory(a) add_subdirectory(b) I want to go: Install(TARGETS target_a program_b

[CMake] Null alias targets?

2018-06-13 Thread Andrew White
I have a library that needs to be built on some platforms but on others is part of the OS. I'd like to avoid putting "if platform" conditional code in the places it is used, but instead hide it away in my platform-specific code. One way to do this is define a variable mylib_targetname in each

Re: [CMake] CMakeLists.txt in different place than source

2018-06-13 Thread Andrew White
J Decker wrote: You can define a variable to define the base of the sources set( SOURCE_ROOT /some/path ) could be set relative to the current cmake path per cmake that uses those souces... and then just prefix it add_library(my_lib ${SOURCE_ROOT}/src/a.c

[CMake] CMakeLists.txt in different place than source

2018-06-12 Thread Andrew White
I have a situation where I want my CMakeLists.txt in a different place than my source. e.g.: /some/path/project/CMakeLists.txt /other/path/source/src/a.c /other/path/source/include/a.h Is there an easy way to say "process this CMakeLists.txt as if it were in /other/path/source" (at least as