Skip to content

Commit d77ba09

Browse files
authored
Update CMakeLists.txt to fix #237 Add fatal error to cmakelists if debug + gpu is enabled with NVHPC <= 22.11 (#238)
1 parent cb349d7 commit d77ba09

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
6565
endif()
6666
elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI"))
6767
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
68-
message(FATAL_ERROR "${__err_msg}ERROR: NVHPC v21.7 or newer is required to build MFC.")
68+
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, v21.7 or newer is required to build MFC.")
69+
endif()
70+
if (MAKE_BUILD_TYPE STREQUAL "Debug")
71+
if (MFC_OpenACC)
72+
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.0)
73+
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, v23.0 or newer is required to build MFC with Debug and GPU options.")
74+
endif()
75+
else()
76+
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.8)
77+
message(FATAL_ERROR "${__err_msg}ERROR: Debug is not working with NVHPC 23.X and older and CPU options at present.")
78+
endif()
6979
endif()
7080
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
7181
message(FATAL_ERROR "${__err_msg}ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation.")
@@ -145,7 +155,7 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
145155
endif()
146156

147157
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
148-
add_compile_options(-C -g -traceback -Mchkptr -Mchkstk -Minform=inform -Mbounds)
158+
add_compile_options(-C -g -O0 -traceback -Mchkptr -Mchkstk -Minform=inform -Mbounds)
149159
endif()
150160
endif()
151161

0 commit comments

Comments
 (0)