Files
ecgsyn.js/mini-odeint/CMakeLists.txt
2024-11-09 21:57:08 -06:00

36 lines
988 B
CMake

cmake_minimum_required(VERSION 3.20)
project(mini-odeint)
option(FORCE_FETCH_CATCH2 "Force fetching Catch2" OFF)
option(MINI_ODEINT_BUILD_TESTS "Build tests" OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MINI_ODEINT_BUILD_TESTS)
find_package(Catch2 3 QUIET)
if(NOT TARGET Catch2::Catch2WithMain OR FORCE_FETCH_CATCH2)
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
endif()
include(CTest)
include(Catch)
add_executable(tests mini-odeint-tests.cpp include/mini-odeint.hpp)
target_include_directories(tests PRIVATE include)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
catch_discover_tests(tests)
endif()
add_library(mini-odeint INTERFACE include/mini-odeint.hpp)
target_include_directories(mini-odeint INTERFACE include)