[CMake] Multiple projects in a single repo

Dushara Jayasinghe dushara at successful.com.au
Sun Jun 18 22:02:17 EDT 2017


Hi all,

Here's a little puzzle that's got me scratching my head a bit. I've got 
a CMake project that is composed of two separate applications - let's 
call them system and recovery - that share a common library framework. 
I'd like to keep it all within a single repository.

The applications are composed of multiple executables and shared 
libraries. What I would like to be able to do is to produces two install 
trees for the two applications with their respective library dependencies.

Things I have attempted so far are:

 1. Perform the build + install in sub-directories of each application:
    With this approach, the shared library files that the applications
    depend on don't get installed (they're in a sibling directory of the
    applications)
 2. Creating two top level custom targets with the the application
    binaries as their dependencies: The build part works great (only the
    required binaries and libraries are built), but the install rule
    causes everything to be built (due to it's dependency on ALL)

Method 2 seems promising if I can have a rule such as install/recovery 
or some such, but that doesn't seem possible for a custom target that 
doesn't generate anything.

Has anyone else solved something like this before? Any suggestions?

Thank you,

Dushara



More information about the CMake mailing list