diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:14:20 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:14:20 +0900 |
commit | 2f958deaa9d4f34ff9c81d05b9b5deba6672e2f3 (patch) | |
tree | 22e84a3c7524b122e3533b42f7c8fc4b5087a887 /Source/Modules | |
parent | d40909a98298a97d879ceeb3b29dcdc858e85628 (diff) | |
download | cmake-2f958deaa9d4f34ff9c81d05b9b5deba6672e2f3.tar.gz cmake-2f958deaa9d4f34ff9c81d05b9b5deba6672e2f3.tar.bz2 cmake-2f958deaa9d4f34ff9c81d05b9b5deba6672e2f3.zip |
Imported Upstream version 3.16.1upstream/3.16.1
Diffstat (limited to 'Source/Modules')
-rw-r--r-- | Source/Modules/CheckCXXLinkerFlag.cmake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/Modules/CheckCXXLinkerFlag.cmake b/Source/Modules/CheckCXXLinkerFlag.cmake new file mode 100644 index 000000000..6cb1ba3ac --- /dev/null +++ b/Source/Modules/CheckCXXLinkerFlag.cmake @@ -0,0 +1,29 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include_guard(GLOBAL) +include(CheckCXXSourceCompiles) +include(CMakeCheckCompilerFlagCommonPatterns) + +function(check_cxx_linker_flag _flag _var) + if(CMAKE_VERSION VERSION_LESS "3.14") + set(CMAKE_REQUIRED_LIBRARIES "${_flag}") + else() + set(CMAKE_REQUIRED_LINK_OPTIONS "${_flag}") + endif() + + # 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} + ${_common_patterns} + ) + foreach(v IN LISTS _locale_vars) + set(ENV{${v}} ${_locale_vars_saved_${v}}) + endforeach() + set(${_var} "${${_var}}" PARENT_SCOPE) +endfunction() |