0

I have a CMake project which build library with external dependencies:

add_library(lib_name ${SRC})
target_link_libraries(lib_name ${DEPENDENCIES})

${DEPENDENCIES} contains of dependencies which found by find_package().

After I want to install my library in package:

install(TARGETS lib_name DESTINATION lib COMPONENT package)

So, and I want to add all (recursive) dynamic dependencies (*.so) of lib_name to package. I know that CMake solve recursive dependencies when build library, but I don't know how to install it to package. Maybe somebody know how to do it? Thanks in advance!

J. Doe
  • 1
  • One way is to put a call to find_package in the generated config script. – Richard Hodges Feb 21 '18 at 14:02
  • I'm not sure, that I understand you. Can you explain your idea? Thank! – J. Doe Feb 21 '18 at 14:21
  • Possible duplicate of [Recursive list of LINK\_LIBRARIES in CMake](https://stackoverflow.com/questions/32756195/recursive-list-of-link-libraries-in-cmake) – Tsyvarev Feb 21 '18 at 14:47
  • So, it's good point, but it not handle dependencies of external dependencies. – J. Doe Feb 22 '18 at 11:22
  • Personally, I did it by incorporating dependencies as CMake Subprojects (using ExternalProject) thus everything is exported but you need to recompile everything (and adapt each dependency to be used that way)... – Mizux Feb 22 '18 at 12:13

0 Answers0