Check if compilers support -no-pie or -nopie
This commit is contained in:
parent
d03a35ac92
commit
6fde08bc34
|
@ -188,7 +188,7 @@ else()
|
|||
add_definitions(-D_ARCH_32=1)
|
||||
endif()
|
||||
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
if(ENABLE_GENERIC)
|
||||
message("Warning! Building generic build!")
|
||||
set(_M_GENERIC 1)
|
||||
|
@ -202,7 +202,17 @@ elseif(_ARCH_64 AND (
|
|||
set(_M_X86 1)
|
||||
set(_M_X86_64 1)
|
||||
add_definitions(-D_M_X86=1 -D_M_X86_64=1 -msse2)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie -no-pie")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
CHECK_C_COMPILER_FLAG("-no-pie" NO_PIE_UPSTREAM)
|
||||
if(NO_PIE_UPSTREAM)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
|
||||
endif()
|
||||
CHECK_C_COMPILER_FLAG("-nopie" NO_PIE_PATCHED)
|
||||
if(NO_PIE_PATCHED)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie")
|
||||
endif()
|
||||
endif()
|
||||
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
||||
set(_M_ARM 1)
|
||||
set(_M_ARM_64 1)
|
||||
|
|
Loading…
Reference in New Issue