Skip to content

Commit

Permalink
Reomove "-nopie" option workaround for old clang. (iovisor#4945)
Browse files Browse the repository at this point in the history
  • Loading branch information
12101111 committed Mar 22, 2024
1 parent ba1041d commit cb972b9
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cmake/FindCompilerFlag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@

if (ENABLE_NO_PIE)

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(COMPILER_NOPIE_FLAG "-nopie")
set(_backup_c_flags "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "-no-pie")
CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}"
HAVE_NO_PIE_FLAG)
if (HAVE_NO_PIE_FLAG)
set(COMPILER_NOPIE_FLAG "-no-pie")
else()
set(_backup_c_flags "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "-no-pie")
CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}"
HAVE_NO_PIE_FLAG)
if (HAVE_NO_PIE_FLAG)
set(COMPILER_NOPIE_FLAG "-no-pie")
else()
set(COMPILER_NOPIE_FLAG "")
endif()
set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")
set(COMPILER_NOPIE_FLAG "")
endif()
set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")

endif(ENABLE_NO_PIE)

Expand Down

0 comments on commit cb972b9

Please sign in to comment.