GET_RUNTIME_DEPENDENCIES broken for cross-compiling
I'm cross-compiling from Linux to Windows and I noticed a number of issues with file(GET_RUNTIME_DEPENDENCIES)
in this scenario. The "visible" result is that it doesn't produce any dependencies (neither resolved nor unresolved!), even though the tools are there.
- I noticed the implementation uses
CMAKE_HOST_SYSTEM_NAME
to select the platform. In my scenario the host system is "Linux
", meaning the chosen platform is "linux+elf
", even though "windows+pe
" would be correct. Workaround: manually setCMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
. - The wrong '
objdump
' was used, the 'native'/bin/objdump
instead of the cross-buildingobjdump
. Workaround: manually settingCMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
,CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
. (But I believe this is fixed in master now.) - The interpretation of the objdump output expects a CR at the end of a line. This is not present on Linux. Workaround: employing a wrapper script that pipes the objdump output through unix2dos.
- Library name case mismatches. Yeah, this is tricky. In my case I want Qt DLLs, and for them returning the "resolved" dependencies unchanged would be fine, but that's not a general case. Workaround: Attempting a "case-insensitive" search for the library name (i.e., scanning directories and comparing each file name) and recursively feeding those to
file(GET_RUNTIME_DEPENDENCIES)
again, all with CMake scripting. Kludgy, but works for now.