Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 511613e

Browse files
authored
Require C++17 (#834)
* Bump submodule past nmodl#889.
1 parent 0574812 commit 511613e

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CMake/MakefileBuildOptions.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ endforeach()
7575
# =============================================================================
7676
# compile flags : common to all backend
7777
# =============================================================================
78-
# PGI compiler adds --c++14;-A option for C++14, remove ";"
79-
string(REPLACE ";" " " CXX14_STD_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION}")
78+
string(JOIN " " CMAKE_CXX17_STANDARD_COMPILE_OPTION_STRING ${CMAKE_CXX17_STANDARD_COMPILE_OPTION})
8079
string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE)
8180
list(TRANSFORM CORENRN_COMPILE_DEFS PREPEND -D OUTPUT_VARIABLE CORENRN_COMPILE_DEF_FLAGS)
8281
string(
@@ -85,7 +84,7 @@ string(
8584
CORENRN_CXX_FLAGS
8685
${CMAKE_CXX_FLAGS}
8786
${CMAKE_CXX_FLAGS_${_BUILD_TYPE}}
88-
${CXX14_STD_FLAGS}
87+
${CMAKE_CXX17_STANDARD_COMPILE_OPTION_STRING}
8988
${NVHPC_ACC_COMP_FLAGS}
9089
${NVHPC_CXX_INLINE_FLAGS}
9190
${CORENRN_COMPILE_DEF_FLAGS}

CMake/OpenAccHelper.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ if(CORENRN_ENABLE_GPU)
8585
else()
8686
message(FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with NVHPC compilers")
8787
endif()
88-
# avoid PGI adding standard compliant "-A" flags
89-
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14)
9088
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${NVHPC_ACC_COMP_FLAGS}")
9189
# Use `-Mautoinline` option to compile .cpp files generated from .mod files only. This is
9290
# especially needed when we compile with -O0 or -O1 optimisation level where we get link errors.

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@ math(EXPR CORENEURON_VERSION_COMBINED
2323
# =============================================================================
2424
# CMake common project settings
2525
# =============================================================================
26-
set(CMAKE_CXX_STANDARD 14)
26+
set(CMAKE_CXX_STANDARD 17)
2727
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2828
set(CMAKE_CXX_EXTENSIONS OFF)
2929
set(CMAKE_BUILD_TYPE
3030
RelWithDebInfo
3131
CACHE STRING "Empty or one of Debug, Release, RelWithDebInfo")
3232

33-
if(NOT "cxx_std_14" IN_LIST CMAKE_CXX_COMPILE_FEATURES OR NOT "cxx_digit_separators" IN_LIST
34-
CMAKE_CXX_COMPILE_FEATURES)
33+
if(NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
3534
message(
3635
FATAL_ERROR
37-
"This compiler does not fully support C++14, choose an higher version or an other compiler.")
36+
"This compiler does not fully support C++17, choose a higher version or another compiler.")
3837
endif()
3938

4039
# =============================================================================
@@ -297,6 +296,11 @@ if(CORENRN_HAVE_NVHPC_COMPILER)
297296
# problem. If GPU support is disabled, we define R123_USE_INTRIN_H=0 to avoid the problem.
298297
list(APPEND CORENRN_COMPILE_DEFS R123_USE_INTRIN_H=0)
299298
endif()
299+
# CMake versions <3.19 used to add -A when using NVHPC/PGI, which makes the compiler excessively
300+
# pedantic. See https://gitlab.kitware.com/cmake/cmake/-/issues/20997.
301+
if(CMAKE_VERSION VERSION_LESS 3.19)
302+
list(REMOVE_ITEM CMAKE_CXX17_STANDARD_COMPILE_OPTION -A)
303+
endif()
300304
endif()
301305

302306
# ~~~

0 commit comments

Comments
 (0)