Feature Request: TARGET_RUNTIME_DLLS should also cover INTERFACE libraries
I am using $<TARGET_RUNTIME_DLLS:someTarget>
to copy all DLL dependencies to the output directory. However, I am now adding a dependency (SDL mixer) that comes with some DLLs that are loaded at runtime (no .lib).
I think this case should also be covered by TARGET_RUNTIME_DLLS
, but I can't set up a SHARED IMPORTED target since there is no .lib .
For me, declaring the library as INTERFACE IMPORTED would make sense here, attaching only the IMPORTED_LOCATION property, but currently TARGET_RUNTIME_DLLS
won't pick it up since it only covers SHARED libraries.
add_library(libogg INTERFACE IMPORTED)
set_target_properties(libogg PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/libogg-0.dll)
add_library(sdlmixer SHARED IMPORTED GLOBAL)
target_include_directories(sdlmixer SYSTEM INTERFACE include)
set_target_properties(sdlmixer PROPERTIES
IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/SDL2_mixer.lib
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/SDL2_mixer.dll)
target_link_libraries(sdlmixer INTERFACE libogg)
Could we change TARGET_RUNTIME_DLLS
to also take IMPORTED_LOCATION of INTERFACE libs into account?
Related: #22993