Hi Joe,
On Sat, Sep 19, 2015 at 6:42 AM, Joe <jtca...@gmail.com> wrote: > /path/to/modules/FindA.cmake: > > ... > if (NOT TARGET A) > set(PATH_TO_A ${CMAKE_CURRENT_LIST_DIR}../A) > add_subdirectory(${PATH_TO_A} ${PATH_TO_A}/build) > endif() > ... > > This way, A' CMakeLists is invoked and the library is compiled and built. > Then in B's CMakeLists.txt: > > ... > set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} > ${CMAKE_CURRENT_LIST_DIR}/../modules) > > find_package(A) > add_executable(main_B src/main_B.cpp) > target_link_libraries(main_B A) > ... > > Is this bad practice? I tried to figure out find_package in CONFIG mode but > every example I've found seems complicated and obtuse. Thank you. I'm interested in what you find. Until now, I've been doing what you and losif are doing. The reason is that the top-level program (i.e., Z) makes use of A and B. But also, I want to test B independently of Z, but I need to link in A to do it. I'm not sure if this is relevant, but what I've been doing is following this old thread: http://www.cmake.org/pipermail/cmake/2010-December/041150.html . I'm not sure if a better way is available with the current version of CMake... Anyway, perhaps this post will help (it's not from me)? Ray -- 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