mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 19:08:07 +08:00
C++ feature checks: Match warnings more strictly
Require the word "warning" to appear at the start of a line, after whitespace, or after a `:`. This is the same that CTest launchers use to match warnings. It avoids matching "warning" inside file paths. Fixes: #19019
This commit is contained in:
@@ -27,7 +27,7 @@ function(cm_check_cxx_feature name)
|
||||
# Filter out xcodebuild warnings.
|
||||
string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}")
|
||||
# If using the feature causes warnings, treat it as broken/unavailable.
|
||||
if(check_output MATCHES "[Ww]arning")
|
||||
if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]")
|
||||
set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
|
||||
endif()
|
||||
if(CMake_HAVE_CXX_${FEATURE})
|
||||
|
Reference in New Issue
Block a user