Skip to content

Commit

Permalink
Use correct guard
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed May 24, 2022
1 parent ea9c089 commit c9e692d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ if (HAS_PIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()

include(CheckPIESupported)
check_pie_supported()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
include(CheckPIESupported)
check_pie_supported()
endif()

if (CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_options(-O0)
Expand Down Expand Up @@ -125,7 +127,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
endif()

check_c_compiler_flag(-Wl,-z,now HAS_NOW)
if (HAS_RELRO)
if (HAS_NOW)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,now")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,now")
endif()
Expand Down Expand Up @@ -185,7 +187,7 @@ if (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
endif()

check_c_compiler_flag(-Wl,-z,now HAS_NOW)
if (HAS_RELRO)
if (HAS_NOW)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,now")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,now")
endif()
Expand Down

0 comments on commit c9e692d

Please sign in to comment.