--no-pie flag have no effect in ubuntu, using -no-pie with test (#422)

* Cmake: fix apple build

* --no=pie flag have no effect in ubuntu, using -no-pie with test

* better
This commit is contained in:
proller 2017-01-31 00:09:11 +03:00 committed by GitHub
parent 9e94066e98
commit 9409419258
2 changed files with 8 additions and 3 deletions

View File

@ -127,8 +127,8 @@ endif ()
include (cmake/test_compiler.cmake)
if (USE_STATIC_LIBRARIES AND HAVE_NO_PIE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --no-pie")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --no-pie")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG_NO_PIE}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAG_NO_PIE}")
endif ()
set (SAN_FLAGS "-O3 -g -fno-omit-frame-pointer")

View File

@ -1,7 +1,8 @@
include (CheckCXXSourceCompiles)
set (TEST_FLAG "--no-pie")
set (TEST_FLAG "-no-pie")
set (CMAKE_REQUIRED_FLAGS "${TEST_FLAG}")
check_cxx_source_compiles("
int main() {
return 0;
@ -9,3 +10,7 @@ check_cxx_source_compiles("
" HAVE_NO_PIE)
set (CMAKE_REQUIRED_FLAGS "")
if (HAVE_NO_PIE)
set (FLAG_NO_PIE ${TEST_FLAG})
endif ()