diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-09-25 18:58:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-28 13:07:54 (GMT) |
commit | 90dead024c5adee57e5ea3f3c90aed297d41ce3a (patch) | |
tree | 421c29f6c1d89bd68f23b5ce8f7c7330396d2149 /Modules/CheckCXXCompilerFlag.cmake | |
parent | 0cd1ef0932dfb4c0c2c7d0eaa5d91a8593b3a3d7 (diff) | |
download | CMake-90dead024c5adee57e5ea3f3c90aed297d41ce3a.zip CMake-90dead024c5adee57e5ea3f3c90aed297d41ce3a.tar.gz CMake-90dead024c5adee57e5ea3f3c90aed297d41ce3a.tar.bz2 |
CheckCompilerFlag: unified way to check compiler flags per language
Diffstat (limited to 'Modules/CheckCXXCompilerFlag.cmake')
-rw-r--r-- | Modules/CheckCXXCompilerFlag.cmake | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 544e9ac..ce49ae3 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -34,24 +34,8 @@ effect or even a specific one is beyond the scope of this module. include_guard(GLOBAL) include(CheckCXXSourceCompiles) -include(CMakeCheckCompilerFlagCommonPatterns) - -function(check_cxx_compiler_flag _flag _var) - set(CMAKE_REQUIRED_DEFINITIONS "${_flag}") - - # Normalize locale during test compilation. - set(_locale_vars LC_ALL LC_MESSAGES LANG) - foreach(v IN LISTS _locale_vars) - set(_locale_vars_saved_${v} "$ENV{${v}}") - set(ENV{${v}} C) - endforeach() - check_compiler_flag_common_patterns(_common_patterns) - check_cxx_source_compiles("int main() { return 0; }" ${_var} - # Some compilers do not fail with a bad flag - FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU - ${_common_patterns} - ) - foreach(v IN LISTS _locale_vars) - set(ENV{${v}} ${_locale_vars_saved_${v}}) - endforeach() -endfunction() +include(CheckCompilerFlag) + +macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) + check_compiler_flag(CXX "${_FLAG}" ${_RESULT}) +endmacro () |