diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 795b021..298af6e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,26 +1,11 @@ #------------------------------------------------------------------------------ -# Top level CMakeLists.txt file for DOLFIN -cmake_minimum_required(VERSION 3.19) +# Top level CMakeLists.txt file for DOLFINX_MPC +cmake_minimum_required(VERSION 3.21) #------------------------------------------------------------------------------ # Set project name and version number project(DOLFINX_MPC VERSION "0.8.0.0") -#------------------------------------------------------------------------------ -# Set CMake options, see `cmake --help-policy CMP000x` - -cmake_policy(VERSION 3.19) - -#------------------------------------------------------------------------------ -# Use C++17 -set(CMAKE_CXX_STANDARD 20) - -# Require C++17 -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# Do not enable compler-specific extensions -set(CMAKE_CXX_EXTENSIONS OFF) - #------------------------------------------------------------------------------ # General configuration # Make sure CMake uses the correct DOLFINConfig.cmake for tests and demos @@ -51,6 +36,7 @@ feature_summary(WHAT ALL) # Declare the library (target) add_library(dolfinx_mpc) +target_compile_features(dolfinx_mpc PUBLIC cxx_std_20) # dolfinx gives us transitive dependency on mpi, petsc, basix, ufcx # without us needing to reimplement detection/dependency diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 87a3329..a391f08 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.21) -PROJECT(dolfinx_mpc_pybind11) +PROJECT(dolfinx_mpc_nanobind) -# Set C++ standard -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) find_package(Python COMPONENTS Interpreter Development REQUIRED) @@ -48,13 +44,8 @@ nanobind_add_module( dolfinx_mpc/dolfinx_mpc.cpp dolfinx_mpc/mpc.cpp ) -# Add strict compiler flags -# include(CheckCXXCompilerFlag) -# check_cxx_compiler_flag("-Wall -Werror -pedantic" HAVE_PEDANTIC) -# if(HAVE_PEDANTIC) -# # target_compile_options(cpp PRIVATE -Wall;-Werror;-pedantic) -# endif() +target_compile_definitions(cpp PRIVATE cxx_std_20) target_link_libraries(cpp PRIVATE dolfinx_mpc) # Check for petsc4py