[CMake] Nesting a cmake project

Nathan Huesken cmake at lonely-star.org
Mon Jun 7 14:14:00 EDT 2010


On Mon, 7 Jun 2010 10:48:30 -0700
Tyler Roscoe <tyler at cryptio.net> wrote:

> On Mon, Jun 07, 2010 at 11:54:12AM -0400, Nathan Huesken wrote:
> > 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 don't have any experience with external projects so I can't help you
> there, but two suggestsions/ideas:
> 
> 1. Why do you need to nest one project inside the other? I think you
> will have less trouble if you treat each one as its own independent
> project.

Because it the outer projects depends on the inner and they are
strongly connected. It does not make sense to ship the outer without
the inner.

> 2. Use add_subdirectory() instead of add_external_project() to hook
> these two projects together.

I tried that, I got trouble because of duplicated target names ...
> 
> tyler
> 



More information about the CMake mailing list