[CMake] Difficult 'make install' problem
Marcel Loose
loose at astron.nl
Mon Sep 14 05:47:27 EDT 2009
Hi all,
I am facing a difficult 'make install' problem. I'll try to explain my
project setup.
The main project consists of parts and subsystems. Parts contain source
code; subsystems do not contain source code, but define a certain subset
of all available parts.
Here is a simplified version of my source code tree.
main
subsystems
subsys_1 (depends on part_1b, part_2a)
subsys_2 (depends on part_1a, part_1c, part_2b)
part_1
part_1a
part_1b (depends on part_1a)
part_1c (depends on part_1a)
part_2
part_2a (depends on part_1c)
part_2b (depends on part_1b)
Each leaf-directory contains a CMake project. The subsystems tree does
not contain any source code; it merely contains CMakeLists.txt files
that record the subsystem's dependencies. Only the part_* directories
contain source code files.
For each project, a custom target is defined with the same name as that
of the project. That way, you can easily define project dependencies
(which may reach a bit further than just library dependencies).
With this setup, it is straightforward to build, say, subsys_1. This
will trigger a build of the (sub)projects part_1a, part_1b, part_1c, and
part_2a.
There's one caveat, though: you can only build a subsystem from the
top-level build directory! When typing 'make' in the subsystems/subsys_1
directory, nothing happens. This is different from the behaviour you see
when typing 'make' in, e.g., the directory part_1/part_1c.
This isn't a big deal when simply building the target subsys_1. However,
it is a problem if you want to install subsys_1, where installing means,
installing all the "products" (i.e. libraries, binaries, etc.) that
subsys_1 consists of.
What I would like is that, if I type 'make install' in the directory
subsystems/subsys_1, the result would be the same as if I had
subsequently typed 'make install' in the directories part_1/part_1a,
part_1/part_1b, part_1/part_1c, and part_2/part_2a.
Does anyone know how I could achieve this in CMake?
Best regards,
Marcel Loose.
More information about the CMake
mailing list