From 300b34e268b7d71603f8f3046295f4adbfaeb820 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 8 Aug 2017 13:59:37 +0200 Subject: [PATCH] Disable PIE on macOS too --- rpcs3/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 0652520072..a8cad9c333 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -108,13 +108,15 @@ if(NOT MSVC) endif() # Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it. - CHECK_C_COMPILER_FLAG("-no-pie" HAS_NO_PIE) - if(HAS_NO_PIE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") - endif() - CHECK_C_COMPILER_FLAG("-nopie" HAS_NOPIE) - if(HAS_NOPIE) - if (NOT HAS_NO_PIE) + if(APPLE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie") + else() + CHECK_C_COMPILER_FLAG("-no-pie" HAS_NO_PIE) + CHECK_C_COMPILER_FLAG("-nopie" HAS_NOPIE) + + if(HAS_NO_PIE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") + elseif(HAS_NOPIE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie") endif() endif()