diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cdd3ec..cd68695 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,12 @@ if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9) target_compile_options(${PROJECT_NAME}_objlib PRIVATE -mmitigate-rop) endif() -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now") + +if(CMAKE_C_COMPILER_ID MATCHES "AppleClang") + # Left empty since macOS will handle linking appropriately with defaults. +else() + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now") +endif() option(BUILD_ERROR_ON_WARNING "Fail compilation on warning" OFF)