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:57 (GMT) |
commit | 417de67afdbe152336d894133d30459f402b9570 (patch) | |
tree | aa926c402768cae36324e2ff21bf92830444a10f /Modules | |
parent | c0fab6dac8a783ff2f161f343b02d8e5b5f79325 (diff) | |
parent | 4941887d7defecb3016d2bd94d3a45754251ca56 (diff) | |
download | CMake-417de67afdbe152336d894133d30459f402b9570.zip CMake-417de67afdbe152336d894133d30459f402b9570.tar.gz CMake-417de67afdbe152336d894133d30459f402b9570.tar.bz2 |
Merge topic 'CheckCompilerFlags-revert-linker-warnings'
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} |