install build artefacts of an external project

Use case:

  • there is some external project that need to build stuff ancient style (configure/make/make install)
  • the outcome is a few shared libraries (.so with the symlinks game, by the wat on linux)
  • users of these (libraries that include the headers, and in the end want to link with these libraries) depend on a INTERFACE library
  • this interface library depends on the External_Project and connects the headers and build so files via target_include_directories and target_link_libraries on this interface library

Thanks to this the build process goes perfect. Say that some executable target in the end depends on it, during the install of that one, we could do :

install(TARGETS MyApplication FOO
COMPONENT MyApplication)

where FOO is actually that interface library mentioned above, but this does not put the shared libraries in the installation. What is the best way to get these to join the party ?

target_include_directories(FOO
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include)
target_link_libraries(FOO
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/lib/libfoo.so
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/lib/libbar.so)

add_dependencies(FOO FOO_EP)

ExternalProject_Add(FOO_EP …)

Any ideas ?

You’ll have to make install command calls for these files manually. I don’t know of a way to say “install this INTERFACE target as if it were the SHARED library it is representing” that is conveniently provided today.