diff options
author | Brad King <brad.king@kitware.com> | 2022-04-22 12:55:49 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-04-22 12:55:56 (GMT) |
commit | ddefed68e52e08452e5e014524b9bff26804cafe (patch) | |
tree | 822c7fc391ece0d862047af9dc92181deec27ab5 /Modules | |
parent | 32eba762bef091c74c1fe9c7e0b1e504ab71824f (diff) | |
parent | 4941887d7defecb3016d2bd94d3a45754251ca56 (diff) | |
download | CMake-ddefed68e52e08452e5e014524b9bff26804cafe.zip CMake-ddefed68e52e08452e5e014524b9bff26804cafe.tar.gz CMake-ddefed68e52e08452e5e014524b9bff26804cafe.tar.bz2 |
Merge topic 'CheckCompilerFlags-revert-linker-warnings' into release-3.23
4941887d7d CheckCompilerFlags: Revert "Catch linker warning about ignored flags"
c2341ece47 CheckLinkerFlag: Catch linker warning when the checked flag is ignored
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7190
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCheckCompilerFlagCommonPatterns.cmake | 1 | ||||
-rw-r--r-- | Modules/Internal/CheckLinkerFlag.cmake | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 8f59acd..bda1d71 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -13,7 +13,6 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "optimization flag .* not supported" # Clang FAIL_REGEX "unknown argument ignored" # Clang (cl) - FAIL_REGEX "warning: .* ignored" # Clang (linker) FAIL_REGEX "ignoring unknown option" # MSVC, Intel FAIL_REGEX "warning D9002" # MSVC, any lang FAIL_REGEX "option.*not supported" # Intel diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake index 51d4225..7613105 100644 --- a/Modules/Internal/CheckLinkerFlag.cmake +++ b/Modules/Internal/CheckLinkerFlag.cmake @@ -25,6 +25,15 @@ function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var) set(CMAKE_REQUIRED_LINK_OPTIONS "${_flag}") check_compiler_flag_common_patterns(_common_patterns) + + # Match linker warnings if the exact flag is ignored. + foreach(flag IN LISTS _flag) + string(REGEX REPLACE "([][+.*?()^$])" [[\\\1]] _flag_regex "${flag}") + list(APPEND _common_patterns + FAIL_REGEX "warning: .*${_flag_regex}.* ignored" + ) + endforeach() + cmake_check_source_compiles(${_lang} "${_lang_src}" ${_var} |