[CMake] Nesting a cmake project

Nathan Huesken cmake at lonely-star.org
Mon Jun 7 11:54:12 EDT 2010


Hi,

I have a cmake project into which I want to nest another cmake project.
The nested cmake project is a complete project working on its own, and
the outer cmake project depends on it.
So when the outer cmake project is build, the inner one should be build
first.
The inner, as well as the outer cmake project have several targets,
such as
- doc
- test
...

I want the corresponding target of the inner project to be build when
the target of the outer cmake project is build.

What I tried:
In the "lib" directory, I have in my CMakeLists.txt
EXTERNALPROJECT_ADD(
   inner
   PREFIX inner
   URL ${CMAKE_CURRENT_SOURCE_DIR}/inner
)

And the complete inner projects lies in "lib/inner".

This seems to work, but:
- when I do a simple "make" (with no target name), it seems that all
  targets (including install) if the inner project are build.
- The install prefix of the outer project is not set in the inner
  project.

How do I do that?

Thanks!
Nathan


More information about the CMake mailing list