I happened to stumble acrosss this today. I fixed it by adding another find_package to the last project but this seems to defeat the purpose of transitive dependencies. What am I doing wrong?
Here's a more detailed example (https://github.com/toomuchatonce/cmake_transient_issue.git) ------------------------------- app - CMakeLists.txt cmake_minimum_required(VERSION 3.0.2) add_executable(app main.cpp) # uncomment to fix link error #find_package( a NO_MODULE REQUIRED ) find_package( b NO_MODULE REQUIRED ) target_link_libraries(app b) install(TARGETS app RUNTIME DESTINATION bin) ------------------------------- libb - CMakeLists.txt cmake_minimum_required (VERSION 3.0.2) project(b) find_package(a NO_MODULE REQUIRED ) add_library(b lib.cpp) target_link_libraries(b a) target_include_directories(b PUBLIC "$<INSTALL_INTERFACE:include/b>") install(TARGETS b EXPORT bConfig ARCHIVE DESTINATION lib/b ) install(FILES b.h DESTINATION include/b) install(EXPORT bConfig DESTINATION lib/cmake/b ) -------------------------------------- liba - CMakeLists.txt cmake_minimum_required (VERSION 3.0.2) project(a) add_library(a lib.cpp) target_include_directories(a INTERFACE "$<INSTALL_INTERFACE:include/a>") install(TARGETS a EXPORT aConfig ARCHIVE DESTINATION lib/a ) install(FILES a.h DESTINATION include/a) install(EXPORT aConfig DESTINATION lib/cmake/a ) -------------------------------------- superbuild - CMakeLists.txt cmake_minimum_required( VERSION 3.0.2 ) include(ExternalProject) set(DEVROOT ${CMAKE_BINARY_DIR}/devroot) set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEVROOT}) ExternalProject_Add( a CMAKE_ARGS ${CMAKE_ARGS} SOURCE_DIR ${CMAKE_SOURCE_DIR}/../liba ) ExternalProject_Add( b DEPENDS a CMAKE_ARGS ${CMAKE_ARGS} SOURCE_DIR ${CMAKE_SOURCE_DIR}/../libb ) ExternalProject_Add( app DEPENDS b CMAKE_ARGS ${CMAKE_ARGS} SOURCE_DIR ${CMAKE_SOURCE_DIR}/../app ) Regards, Adam On Tue, Mar 17, 2015 at 4:50 AM, Stephen Kelly <[email protected]> wrote: > Richard Taylor wrote: > > > > > http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file > > > > Prefer the official documentation instead of the wiki wherever official > documentation exists (especially if it is well-formatted; that means it's > probably recent and maintained). > > http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html > > > However, only the names of dependent targets are set (via > > INTERFACE_LINK_LIBRARIES in <targetname>Targets.cmake) > > > > I guess that's where the problem lies, I'm just not sure how to fix it.. > > The above link documents a find_dependency macro, which you might make use > of. > > Thanks, > > Steve. > > > -- > > 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 >
-- 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
