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

2012-05-18 Thread Nicolas Desprès
On Fri, May 18, 2012 at 1:15 AM, David Doria daviddo...@gmail.com wrote: Yeah. Well, in that case I'd simply check for the TestB target thats defined in TestB/CMakeLists.txt as condition for the top-levels add_subdirectory: if(NOT TARGET TestB)   add_subdirectory(TestB) endif() That

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

2012-05-17 Thread David Doria
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

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

2012-05-17 Thread Andreas Pakulat
Hi, On Thu, May 17, 2012 at 11:20 PM, David Doria daviddo...@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

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

2012-05-17 Thread David Doria
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.

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

2012-05-17 Thread Andreas Pakulat
Hi, On Thu, May 17, 2012 at 11:36 PM, David Doria daviddo...@gmail.com wrote: 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

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

2012-05-17 Thread David Doria
Yeah. Well, in that case I'd simply check for the TestB target thats defined in TestB/CMakeLists.txt as condition for the top-levels add_subdirectory: if(NOT TARGET TestB) add_subdirectory(TestB) endif() That should work. Andreas Awesome, that seems to do the trick. Thanks! David