NVHPC: Use -Werror for COMPILE_OPTIONS_WARNING_AS_ERROR

The previously-used `-Werror all-warnings` is not supported by
the NVHPC suite of compilers.  This previously worked since `-Werror`
was being used and `all-warnings` was being excluded.

We thought this was the correct syntax due to incorrect documentation
about `-Werror`, which stated the argument should be space-separated,
while it should actually be separated with `=` or `,`.

Issue: #24665
This commit is contained in:
Robert Maynard
2023-04-13 10:37:09 -04:00
committed by Brad King
parent 827d5b75d4
commit 9d40f01442
2 changed files with 2 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
include(Compiler/PGI-Fortran)
include(Compiler/NVHPC)
__compiler_nvhpc(Fortran)
set(CMAKE_Fortran_PREPROCESS_SOURCE_EXCLUDE_FLAGS_REGEX "(^| )-Werror +[a-z][a-z-]+( |$)")
set(CMAKE_Fortran_PREPROCESS_SOURCE_EXCLUDE_FLAGS_REGEX "(^| )-Werror([=,][a-z][a-z-]+)?( |$)")

View File

@@ -13,5 +13,5 @@ include(Compiler/PGI)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror")
endmacro()