<div dir="ltr"><div><div>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?<br><br></div><div>Here's a more detailed example <br>(<a href="https://github.com/toomuchatonce/cmake_transient_issue.git">https://github.com/toomuchatonce/cmake_transient_issue.git</a>)<br></div><div><br>-------------------------------<br>app - CMakeLists.txt<br>cmake_minimum_required(VERSION 3.0.2)<br>add_executable(app main.cpp)<br># uncomment to fix link error<br>#find_package( a NO_MODULE REQUIRED )<br>find_package( b NO_MODULE REQUIRED )<br>target_link_libraries(app b)<br>install(TARGETS app RUNTIME DESTINATION bin)<br>-------------------------------<br>libb - CMakeLists.txt<br>cmake_minimum_required (VERSION 3.0.2)<br>project(b)<br>find_package(a NO_MODULE REQUIRED )<br>add_library(b lib.cpp)<br>target_link_libraries(b a)<br>target_include_directories(b PUBLIC "$<INSTALL_INTERFACE:include/b>")<br>install(TARGETS b EXPORT bConfig ARCHIVE DESTINATION lib/b )<br>install(FILES b.h DESTINATION include/b)<br>install(EXPORT bConfig DESTINATION lib/cmake/b )<br>--------------------------------------<br></div>liba - CMakeLists.txt<br>cmake_minimum_required (VERSION 3.0.2)<br>project(a)<br>add_library(a lib.cpp)<br>target_include_directories(a INTERFACE "$<INSTALL_INTERFACE:include/a>")<br>install(TARGETS a EXPORT aConfig ARCHIVE DESTINATION lib/a )<br>install(FILES a.h DESTINATION include/a)<br>install(EXPORT aConfig DESTINATION lib/cmake/a )<br>--------------------------------------<br></div><div>superbuild - CMakeLists.txt<br>cmake_minimum_required( VERSION 3.0.2 )<br>include(ExternalProject)<br>set(DEVROOT ${CMAKE_BINARY_DIR}/devroot)<br>set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEVROOT})<br>ExternalProject_Add(<br>   a<br>   CMAKE_ARGS ${CMAKE_ARGS}<br>   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../liba<br>)<br>ExternalProject_Add(<br>   b<br>   DEPENDS a<br>   CMAKE_ARGS ${CMAKE_ARGS}<br>   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../libb<br>)<br>ExternalProject_Add(<br>   app<br>   DEPENDS b<br>   CMAKE_ARGS ${CMAKE_ARGS}<br>   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../app<br>)<br></div><div><br></div><div>Regards,<br></div><div>Adam<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 17, 2015 at 4:50 AM, Stephen Kelly <span dir="ltr"><<a href="mailto:steveire@gmail.com" target="_blank">steveire@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Richard Taylor wrote:<br>
<br>
><br>
<a href="http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file" target="_blank">http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file</a><br>
><br>
<br>
Prefer the official documentation instead of the wiki wherever official<br>
documentation exists (especially if it is well-formatted; that means it's<br>
probably recent and maintained).<br>
<br>
 <a href="http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html" target="_blank">http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html</a><br>
<span class=""><br>
> However, only the names of dependent targets are set (via<br>
> INTERFACE_LINK_LIBRARIES in <targetname>Targets.cmake)<br>
><br>
> I guess that's where the problem lies, I'm just not sure how to fix it..<br>
<br>
</span>The above link documents a find_dependency macro, which you might make use<br>
of.<br>
<br>
Thanks,<br>
<br>
Steve.<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>