GET_RUNTIME_DEPENDENCIES does not seem to work with MinGW
Hi,
I am using Arch Linux with MinGW and cmake 3.19. I have a shared library and I am trying to get its runtime dependencies:
set(CMAKE_MINGW_SYSTEM_LIBRARY_PATH \"${CMAKE_FIND_ROOT_PATH}/bin/\")")
install(CODE [[
message(STATUS "Looking for deps in ${CMAKE_SYSTEM_LIBRARY_PATH};${CMAKE_MINGW_SYSTEM_LIBRARY_PATH}")
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR deps_resolved
UNRESOLVED_DEPENDENCIES_VAR deps_unresolved
LIBRARIES $<TARGET_FILE:mylib>
DIRECTORIES ${CMAKE_SYSTEM_LIBRARY_PATH} ${CMAKE_MINGW_SYSTEM_LIBRARY_PATH}
PRE_EXCLUDE_REGEXES "api-ms-*" "ext-ms-*"
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
)
message(STATUS "Resolving runtime dependencies for $<TARGET_FILE:mylib>")
foreach(dep ${deps_resolved})
file(INSTALL ${dep} DESTINATION ${CMAKE_INSTALL_PREFIX})
endforeach()
foreach(dep ${deps_unresolved})
message(WARNING "Runtime dependency ${dep} could not be resolved.")
endforeach()
]])
The variable CMAKE_MINGW_SYSTEM_LIBRARY_PATH
points to the correct path on my system /usr/x86_64-w64-mingw32/bin
. The code does not return anything at all (no resolved, no unresolved), it just seems that it does not find anything.
The same works fine with MSVC / cmake version 3.18.20081302-MSVC_2. I first asked on the forum here and opening this issue as instructed. I will be happy to assist with any other details.
Thanks, Bogdan