We do it like this:

- in projectA/CMakeLists.txt:
----
set( ProjectA_IN_TREE TRUE CACHE INTERNAL "" )
----

- in projectA/ProjectA-config.cmake.in (which is converted to ProjectA-config.cmake by a call to configure_package_config_file from the CMakePackageConfigHelpers module):
----
if( ProjectA_IN_TREE )
    add_library( ProjectA_LibraryName ALIAS LibraryName )
else()
    include("${CMAKE_CURRENT_LIST_DIR}/ProjectA-targets.cmake")
endif()
----

The superbuild then just add_subdirectory(projectA) before add_subdirectory(pojectB), and projectB uses libraries from projectA just like it would if there was no superbuild.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to