summaryrefslogtreecommitdiffstats
path: root/Source/Checks/cm_cxx_features.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-08 13:21:21 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-08 13:22:09 (GMT)
commitf44d9bcc8f09c3a135fa0feb82e9d71c475eb196 (patch)
tree9d0917a3466c81f15c8f99e1ed28482037ea222e /Source/Checks/cm_cxx_features.cmake
parentf4ce396254eff94446df92f9900dc501fad65ad8 (diff)
downloadCMake-f44d9bcc8f09c3a135fa0feb82e9d71c475eb196.zip
CMake-f44d9bcc8f09c3a135fa0feb82e9d71c475eb196.tar.gz
CMake-f44d9bcc8f09c3a135fa0feb82e9d71c475eb196.tar.bz2
C++ feature checks: Improve exclusion of "0 Warning(s)"
Simply matching "0 Warning" may match "10 Warning(s)". Instead remove the entire ` 0 Warning(s)` content from the MSBuild output before searching it for warnings. Issue: #16942
Diffstat (limited to 'Source/Checks/cm_cxx_features.cmake')
-rw-r--r--Source/Checks/cm_cxx_features.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index c9a19af..3b08025 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -14,8 +14,10 @@ function(cm_check_cxx_feature name)
CMAKE_FLAGS ${maybe_cxx_standard}
OUTPUT_VARIABLE OUTPUT
)
+ # Filter out MSBuild output that looks like a warning.
+ string(REGEX REPLACE " +0 Warning\\(s\\)" "" check_output "${OUTPUT}")
# If using the feature causes warnings, treat it as broken/unavailable.
- if(OUTPUT MATCHES "[Ww]arning" AND NOT OUTPUT MATCHES "0 Warning")
+ if(check_output MATCHES "[Ww]arning")
set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
endif()
if(CMake_HAVE_CXX_${FEATURE})