From 42323d769a54d6aeef209f42f64174db09083e22 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 27 Dec 2020 16:04:29 -0700 Subject: [PATCH] Meta: Disable rpath generation for MacOS --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f467efbde..0a404076f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 + " -o ") 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)