[CMake] add_subdirectory and build directory

David Cole david.cole at kitware.com
Sat Sep 12 06:51:13 EDT 2009


On Sat, Sep 12, 2009 at 2:45 AM, Michael Wild <themiwi at gmail.com> wrote
>
>
> True, but then you wouldn't point it at a binary directory. AFAIK, if you
> point project A at an out-of-source source, say project B, that project B
> will be built completely within the binary tree of A.
>
>
The second argument to add_subdirectory allows you to put the binary tree of
"project B's build tree within project A" anywhere you want...

Of course, it should not be the same as a build tree of "standalone project
B".... Because that's a different build.

Perhaps that's where the confusion is in this case?

Pierre-Julien, is that what you are expecting? When you use
add_subdirectory, you should typically leave off the 2nd argument unless you
just want to organize things differently than CMake does by default. But if
you do use it, make sure that the directory you give it is unique across all
other projects that you build. "B built within A" is different than
"standalone B" -- do not try to mix and match builds with add_subdirectory
-- use it as a convenient way of building a project as a component of
another project...

Does that help?

Hope so,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090912/c4fbbd06/attachment.htm>


More information about the CMake mailing list