Skip to content

Commit

Permalink
only use '-z' for Clang on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Jan 21, 2024
1 parent cd78719 commit 8559c5f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Werror)
# add_compile_options(-Wpedantic)
add_compile_options(-Wno-shift-negative-value)
if(NOT CMAKE_C_COMPILER_ID MATCHES "AppleClang")
add_link_options("-Wl,-z,relro,-z,now,-z,defs")
endif()
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND NOT CMAKE_C_SIMULATE_ID MATCHES "MSVC")
add_link_options("-Wl,-z,relro,-z,now,-z,defs")
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_SIMULATE_ID MATCHES "MSVC")
Expand Down

0 comments on commit 8559c5f

Please sign in to comment.