Skip to content

Commit 766c411

Browse files
authored
MacOS Build (#75)
* Wrapped Linux-specific linker option with an OS check. * Build: Fix AppleClang condition
1 parent e99c03c commit 766c411

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ if(CMAKE_COMPILER_IS_GNUCC AND
177177
CMAKE_C_COMPILER_VERSION VERSION_LESS 9)
178178
target_compile_options(${PROJECT_NAME}_objlib PRIVATE -mmitigate-rop)
179179
endif()
180-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now")
180+
181+
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
182+
# Left empty since macOS will handle linking appropriately with defaults.
183+
else()
184+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now")
185+
endif()
181186

182187
option(BUILD_ERROR_ON_WARNING "Fail compilation on warning" OFF)
183188

0 commit comments

Comments
 (0)