From: Yonghong Song Date: Thu, 24 Aug 2017 06:56:56 +0000 (-0700) Subject: fix a bug introduced by previous lua-bcc build fix commit X-Git-Tag: submit/tizen_4.0/20171018.110122~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=917f4c76db4391bb2ef955b6bf659857e8a35f8d;p=platform%2Fupstream%2Fbcc.git fix a bug introduced by previous lua-bcc build fix commit 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 --- diff --git a/cmake/FindCompilerFlag.cmake b/cmake/FindCompilerFlag.cmake index 8a6fbd46..31ac82d1 100644 --- a/cmake/FindCompilerFlag.cmake +++ b/cmake/FindCompilerFlag.cmake @@ -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) @@ -12,4 +13,5 @@ else() else() set(COMPILER_NOPIE_FLAG "") endif() + set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}") endif()