[CMake] make a project also a subproject

Andreas Pakulat apaku at gmx.de
Fri Jun 22 12:40:15 EDT 2012


Hi,

On Fri, Jun 22, 2012 at 6:10 PM, Leif Walsh <leif.walsh at gmail.com> wrote:

> Suppose I have two projects, A and B.  A builds a shared lib that links
> with a static lib in B.
>
> Sometimes, I want to build and test B by itself.  Other times I want to
> build A, which requires building B.
>
> For now, I manually (or with a script) build B, then set an environment
> variable to say where the built static lib is, and then build A (which uses
> the environment variable).  This is...not superb.
>
> If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error
> when it hit B's project(B).


What makes you think that having 2 project() invocations in the same cmake
source tree causes a problem for cmake? Or maybe this was a problem in some
older versions of cmake, my 2.8.8 here groks a sample with 2 project()
calls in a setup as you describe just fine.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120622/0983ee63/attachment.htm>


More information about the CMake mailing list