`file(GET_RUNTIME_DEPENDENCIES)` should ignore shared libraries expected in iOS devices
Please see the below minimal example to reproduce the problem:
project(Foo)
add_library(Foo SHARED foo.cpp foo.h)
target_link_libraries(Foo PUBLIC "-framework Foundation")
install(TARGETS Foo RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(CODE "file(GET_RUNTIME_DEPENDENCIES EXECUTABLES \$<TARGET_FILE:Foo> RESOLVED_DEPENDENCIES_VAR DEPS UNRESOLVED_DEPENDENCIES_VAR U_DEPS)")
This works as expected for macOS, e.g. cmake ..
, make
, make install
, but when I build this for iOS, e.g. cmake -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 ..
, make
, make install
, it shows error
file Failed to run otool on:
/System/Library/Frameworks/Foundation.framework/Foundation
and it's because this shared library /System/Library/Frameworks/Foundation.framework/Foundation
is located in the iOS device not the macOS host. I think this is a bug, file(GET_RUNTIME_DEPENDENCIES)
should know Foundation
is a framework from the Xcode SDK, and hence know the corresponding shared library is in the iOS device and therefore not attempt to run otool
on it.
Edited by Jason Juang