Porting an old project to CMake, Windows only. One of our modules uses an external SDK (header files, DLL, import library, debug/release). I encapsulate the external SDK like so:
set(EXTERNAL_SDK_DIR "/some/dir/to/sdk")
add_library(ExternalSDK SHARED IMPORTED)
set_target_properties(ExternalSDK PROPERTIES
IMPORTED_CONFIGURATIONS "DEBUG;RELEASE"
IMPORTED_LOCATION_DEBUG ${EXTERNAL_SDK_DIR}/debug/sdk.dll
IMPORTED_IMPLIB_DEBUG ${EXTERNAL_SDK_DIR}/debug/sdk.lib
IMPORTED_LOCATION_RELEASE ${EXTERNAL_SDK_DIR}/release/sdk.dll
IMPORTED_IMPLIB_RELEASE ${EXTERNAL_SDK_DIR}/release/sdk.lib
INTERFACE_INCLUDE_DIRECTORIES ${EXTERNAL_SDK_DIR}/include
)
This works nicely, I can then use it with target_link_libraries()
as usual, and even install the sdk.dll using:
install(IMPORTED_RUNTIME_ARTIFACTS ExternalSDK RUNTIME DESTINATION .)
Now my problem is that ExternalSDK has additional DLL files it depends on, which is not required for linking (say: "sdk_dep1.dll, sdk_dep2.dll, etc.), but must be installed as well. These DLLs are located inside the SDK folders.
Is there some way of attaching these to the imported target, so the above install(IMPORTED_RUNTIME_ARTIFACTS ...)
command also installs them? I tried setting IMPORTED_LINK_DEPENDENT_LIBRARIES
and it’s per-config variants on ExternalSDK, but they still don’t get installed.
I’d appreciate any help with this! Thanks!