diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:14:03 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:14:03 +0900 |
commit | d140263a497b4a86818ab5e2017a66df43eb83fb (patch) | |
tree | 4acfe8c906ce669c5fc92689df2c3c83a32d881c /Modules/CheckCCompilerFlag.cmake | |
parent | e1763ae434c946bd1c1e9a7cc66a905ebe027bbd (diff) | |
download | cmake-d140263a497b4a86818ab5e2017a66df43eb83fb.tar.gz cmake-d140263a497b4a86818ab5e2017a66df43eb83fb.tar.bz2 cmake-d140263a497b4a86818ab5e2017a66df43eb83fb.zip |
Imported Upstream version 3.15.0upstream/3.15.0
Diffstat (limited to 'Modules/CheckCCompilerFlag.cmake')
-rw-r--r-- | Modules/CheckCCompilerFlag.cmake | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index f5c112717..a3e2da368 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -37,27 +37,27 @@ include(CheckCSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") # Normalize locale during test compilation. - set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) - foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) - set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}") - set(ENV{${v}} C) - endforeach() - CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS) - CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} - # Some compilers do not fail with a bad flag - FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU - ${_CheckCCompilerFlag_COMMON_PATTERNS} - ) - foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) - set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) - unset(_CheckCCompilerFlag_SAVED_${v}) - endforeach() - unset(_CheckCCompilerFlag_LOCALE_VARS) - unset(_CheckCCompilerFlag_COMMON_PATTERNS) - - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) + foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) + set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS) + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} + # Some compilers do not fail with a bad flag + FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU + ${_CheckCCompilerFlag_COMMON_PATTERNS} + ) + foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) + unset(_CheckCCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckCCompilerFlag_LOCALE_VARS) + unset(_CheckCCompilerFlag_COMMON_PATTERNS) + + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () |