Hi. I was hoping to get some guidance on if this is bad practice. I am simply trying to find a way to manage internal dependencies of my project but with a file structure that is distributed. It looks like this:
/path/to/A /path/to/B B depends on A. I cannot change this directory structure. The solution we have chose is to create the following: /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. -- 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