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). CMake complains that it cannot create TestB because another target with the same name already exists (which it does). What is the right way to handle this? I always assume that TestB is identical in both places (which might not be a great assumption...), so I guess I just want, in both places, to say "include TestB if it already hasn't been included." I tried to do that by replacing the add_subdirectory(TestB) calls with: if(NOT TestB_SOURCE_DIR) add_subdirectory(TestB) endif() but then the linker complains that it can't find TestB. I have uploaded a demo project here: http://homepages.rpi.edu/~doriad/Upload/TestCMake2.tar.gz Thanks! David
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake