Skip to content

Update c++ standard #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(USE_OPENMP "Build with OpenMP support" ON)
option(USE_MPI "Build with MPI support" ON)
option(USE_MPI_F08 "Build with the mpi_f08 module support" OFF)
option(BUILD_TESTING "build dbcsr unit tests" OFF)

cmake_dependent_option(
WITH_C_API "Build the C API (ISO_C_BINDINGS)" ON "USE_MPI" OFF
)# the ISO_C_BINDINGS require MPI unconditionally
Expand Down Expand Up @@ -124,14 +126,28 @@ option(WITH_HIP_PROFILING "Enable profiling within HIP" OFF)
# =================================================================================================
# LANGUAGES AND TESTING
enable_language(Fortran)
enable_language(CXX)
enable_language(C)

if (WITH_C_API AND WITH_EXAMPLES)
enable_language(CXX)
enable_language(C)
if (NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif ()

if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif ()

if (NOT DEFINED CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
endif ()

# always use at least C++11
set(CMAKE_CXX_STANDARD 11)
if (NOT DEFINED CMAKE_HIP_STANDARD)
set(CMAKE_HIP_STANDARD 14)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
endif ()

# =================================== OpenMP
if (USE_OPENMP)
Expand Down Expand Up @@ -347,8 +363,8 @@ include(CheckCompilerSupport)
# subdirectories
add_subdirectory(src)

include(CTest)
if (BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif ()

Expand Down
Loading