Meta: Disable rpath generation for MacOS

This commit is contained in:
Andrew Kaster 2020-12-27 16:04:29 -07:00 committed by Andreas Kling
parent 1219c65249
commit 42323d769a
Notes: sideshowbarker 2024-07-19 00:29:28 +09:00

View file

@ -99,12 +99,22 @@ foreach(lang ASM C CXX OBJC OBJCXX)
unset(CMAKE_SHARED_MODULE_LOADER_${lang}_FLAG )
unset(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG)
unset(CMAKE_${lang}_SYSROOT_FLAG)
# MacOS Workaround. Don't generate install_name flag when cross compiling
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
endforeach()
set(CMAKE_INSTALL_NAME_TOOL "true")
set(CMAKE_INSTALL_NAME_TOOL "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
# Note: MacOS has different rpath rules from linux.
# We disable it completely for MacOS hosts to avoid having to track down all the individual flags to unset
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.
if (CMAKE_SYSTEM_NAME MATCHES Darwin)
set(CMAKE_SKIP_RPATH TRUE)
endif()
#FIXME: -fstack-protector
add_compile_options(-Os -g1 -fno-exceptions -fno-rtti -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined)