[CMake] How to handle a submodule existing twice in a project?

Andreas Pakulat apaku at gmx.de
Thu May 17 17:31:55 EDT 2012


Hi,

On Thu, May 17, 2012 at 11:20 PM, David Doria <daviddoria at gmail.com> wrote:

> I have a main project (called Test) that has two submodules, TestA and
> TestB. TestA also has a submodule, which is exactly the same TestB.
>
> So there is a directory Test/TestB as well as Test/TestA/TestB
>
> In TestA/CMakeLists.txt, I have add_subdirectory(TestB).
> In Test/CMakeLists.txt, I have add_subdirectory(TestA) as well
> as add_subdirectory(TestB).
>

Why are you doing that? If TestB is always available as sub-dir under TestA
it doesn't make much sense to also add it as a subdirectory of the parent
of TestA - IMHO. Test/CMakeLists.txt can still use all targets from TestB,
since target names are always valid across the complete project.

Since TestA is a submodule, it should always be present in the sources
anyway.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120517/33a68e9f/attachment.htm>


More information about the CMake mailing list