summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-01-12 09:53:47 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-01-14 22:22:07 (GMT)
commit9d1b9a4aa1617e304b9eae1f93648278959717df (patch)
treefd7a4eb8cd5cd70044be607c9f18ce784d062584 /Modules/Internal
parent660e0d80aeb3f39712d376471a71f823c86b3b2d (diff)
downloadCMake-9d1b9a4aa1617e304b9eae1f93648278959717df.zip
CMake-9d1b9a4aa1617e304b9eae1f93648278959717df.tar.gz
CMake-9d1b9a4aa1617e304b9eae1f93648278959717df.tar.bz2
CheckLinkerFlag: rely now on internal implementation
This internal implementation share the configuration with CheckCompilerFlag.
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/CheckLinkerFlag.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake
new file mode 100644
index 0000000..285372a
--- /dev/null
+++ b/Modules/Internal/CheckLinkerFlag.cmake
@@ -0,0 +1,35 @@
+# 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(Internal/CheckFlagCommonConfig)
+include(Internal/CheckSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
+
+function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var)
+ # link step supports less languages than the compiler
+ # so do a first check about the requested language
+ if (_lang STREQUAL "ISPC")
+ message (SEND_ERROR "check_linker_flag: ${_lang}: unsupported language.")
+ return()
+ endif()
+
+ cmake_check_flag_common_init("check_linker_flag" ${_lang} _lang_src _lang_fail_regex)
+
+ set(CMAKE_REQUIRED_LINK_OPTIONS "${_flag}")
+
+ check_compiler_flag_common_patterns(_common_patterns)
+ cmake_check_source_compiles(${_lang}
+ "${_lang_src}"
+ ${_var}
+ ${_lang_fail_regex}
+ ${_common_patterns}
+ )
+
+ cmake_check_flag_common_finish()
+endfunction()
+
+cmake_policy(POP)