Skip to content

Commit 7a07587

Browse files
authored
Fix Warning: GNU 11 + NVCC 11.7 (#479)
In older NVCC, `-Wpedantic` causes a lot of "warning: style of line directive is a GCC extension".
1 parent 0e615a3 commit 7a07587

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/pyAMReXFunctions.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ function(pyamrex_set_compile_warnings tgt)
205205
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
206206
target_compile_options(${tgt} PRIVATE -Wall -Wextra -Wpedantic -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code)
207207
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
208-
target_compile_options(${tgt} PRIVATE -Wall -Wextra -Wpedantic -Wshadow -Woverloaded-virtual -Wunreachable-code -Wno-array-bounds)
208+
target_compile_options(${tgt} PRIVATE -Wall -Wextra -Wshadow -Woverloaded-virtual -Wunreachable-code -Wno-array-bounds)
209+
if(NOT AMReX_GPU_BACKEND STREQUAL CUDA)
210+
# In older NVCC, -Wpedantic causes "warning: style of line directive is a GCC extension"
211+
target_compile_options(${tgt} PRIVATE -Wpedantic)
212+
endif()
209213
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
210214
# Warning C4503: "decorated name length exceeded, name was truncated"
211215
# Symbols longer than 4096 chars are truncated (and hashed instead)

0 commit comments

Comments
 (0)