cm_cxx_features: Filter out CUDA installation warnings

Clang always outputs these if it doesn't recognize the installed CUDA version.
They don't affect compiling C++.

Fixes #20434.
This commit is contained in:
Raul Tambre
2020-03-07 13:27:17 +02:00
committed by Brad King
parent d1cb554c99
commit 6ebc6cec41

View File

@@ -32,6 +32,8 @@ function(cm_check_cxx_feature name)
string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}")
# Filter out ld warnings.
string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}")
# Filter out CUDA installation warnings.
string(REGEX REPLACE "[^\n]*clang: warning: Unknown CUDA version[^\n]*" "" check_output "${check_output}")
# If using the feature causes warnings, treat it as broken/unavailable.
if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]")
set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)