CMakeDetermineCompilerABI: Handle NVCC-style -Werror flags

NVCC doesn't require an equals sign for its -Werror flags.

Fixes #21265.
This commit is contained in:
Raul Tambre
2020-10-04 09:09:21 +03:00
parent 3ae3b352d1
commit 079ea66468
2 changed files with 5 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
cuda-nvcc-werror-abi
--------------------
* Compiler ABI detection now handles NVCC-style ``-Werror`` flags.

View File

@@ -33,7 +33,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
__TestCompiler_setTryCompileTargetType()
# Avoid failing ABI detection on warnings.
string(REGEX REPLACE "(^| )-Werror(=[^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
# and set them to "C" that way GCC's "search starts here" text is in