OS X: Pass CMAKE_SYSROOT through to osx_bundle_libs

qteditor
Nicolas Hake 2016-06-24 15:03:27 +02:00
parent cc8725e332
commit ef5b39a290
2 changed files with 28 additions and 4 deletions

View File

@ -1283,10 +1283,11 @@ if (APPLE)
endif()
add_custom_command(TARGET openclonk
POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_bundle_libs"
POST_BUILD COMMAND
"${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_bundle_libs"
"$<$<BOOL:${CMAKE_SYSROOT}>:--sysroot=${CMAKE_SYSROOT}>"
"$<TARGET_FILE:openclonk>"
)
endif()
############################################################################

View File

@ -2,6 +2,29 @@
set -e
_sysroot="${SYSROOT}"
# Collect options from the command line
for i in "$@"; do
case "$i" in
--sysroot=*)
_sysroot="${i#*=}"
shift
;;
--)
shift
break
;;
--*)
echo "$0: Unknown option: $i" >&2
exit 1
;;
*)
break
;;
esac
done
# Grab information about the bundle from the environment (if XCode) or make
# assumptions about the bundle layout (everywhere else)
_executable_path="${EXECUTABLE_PATH:-$1}"
@ -38,8 +61,8 @@ bundle_dependencies() {
# If the library isn't available at the stored path, it may be
# stored inside the sysroot (when cross-compiling for example)
if [ ! -e "${_library_path}" -a -n "${SYSROOT}" ]; then
_library_path="${SYSROOT}${_library_path}"
if [ ! -e "${_library_path}" -a -n "${_sysroot}" ]; then
_library_path="${_sysroot}${_library_path}"
fi
# If the library still isn't available there, there might be a YAML
# stub instead in more recent SDKs; if we find one of those, the