Skip to content

Commit

Permalink
Some cleanup of cmake (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgensd authored Aug 9, 2024
1 parent 4adab42 commit fbd3cb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
20 changes: 3 additions & 17 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fbd3cb0

Please sign in to comment.