[CMake] Two-stage build - how to include and know existing targets

Patrick Boettcher patrick.boettcher at posteo.de
Mon May 9 10:52:55 EDT 2016


Hi list,

In my project I have to build things in two stages (different compilers
and different flags between the two stages). Both are built with CMake.

I'm looking for a way of how to correctly include the generated
products from one project (libraries in my case) in the other
project's build.

Right now I'm using export(TARGETS ... FILE something.cmake) in project
1 which gives me everything I need (a file I can include in the other
build). 

With the exception of not knowing targets I have to consider. Project 1
can freely define one or more targets with any name. I need to consider
all of them in the project 2.

How can I do it nicely?

Currently I'm thinking of adding manually a variable containing a list
of all targets to "something.cmake" once created with export.

Thanks,
--
Patrick.


More information about the CMake mailing list