ecbuild_install_dependency_with_soversion

Installs a third-party dependency that has been found with find_package.

ecbuild_install_dependency_with_soversion( TARGET )

``TARGET`` is a cmake target with an IMPORTED_LOCATION property

Use this function to install dependencies that use shared object versioning, i.e. install as libxx.so -> libxx.so.1 -> libxx.so.1.2.3. In this case we need to collect soft-links and final shared object.

If your dependency does NOT use shared object versioning, i.e. only installs a specific libxx.so, you must use plain CMake to install, e.g.

Example for non-versioned shared objects:

install(FILES $<TARGET_FILE:TARGET> TYPE LIB)

Be aware that this only installs the dependency itself, no resolution of transitive dependencies is applied. Transitive dependencies need to be installed explicitly wither with ecbuild_install_dependency_with_soversion() or install(…)

Typical usage example:

if(ENABLE_INSTALL_DEPENDENCIES)
    ecbuild_install_dependency_with_soversion(libaec::aec)
endif()