Skip to content

Commit

Permalink
fix a bug introduced by previous lua-bcc build fix commit
Browse files Browse the repository at this point in the history
The bug does not show up in my previous test probably because
I did not clean up the build directory and did not have a clean cmake.

In gcc 4.8.5 environment where -no-pie is not supported,
a clean cmake will trigger the issue as subsequent other
cxx compile test will fail due to additional -no-pie flag.

The fix is to reset the CMAKE_REQUIRED_FLAGS to its previous value
after the specific test.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song authored and drzaeus77 committed Aug 25, 2017
1 parent 84757ce commit 917f4c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmake/FindCompilerFlag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(COMPILER_NOPIE_FLAG "-nopie")
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)
Expand All @@ -12,4 +13,5 @@ else()
else()
set(COMPILER_NOPIE_FLAG "")
endif()
set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")
endif()

0 comments on commit 917f4c7

Please sign in to comment.