Browse Source

CMakeDetermineCompilerABI: Handle NVCC-style -Werror flags

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

Fixes #21265.
Raul Tambre 5 years ago
parent
commit
079ea66468

+ 4 - 0
Help/release/dev/cuda-nvcc-werror-abi.rst

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

+ 1 - 1
Modules/CMakeDetermineCompilerABI.cmake

@@ -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