forked from stevengj/cubature
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
45 lines (39 loc) · 1.33 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.1...3.15)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(
Cubature
VERSION 0.0.1
DESCRIPTION "Library for the computation of multidimensional integrals using cubature."
LANGUAGES CXX)
set(Cubature_BUILD_EXAMPLE NO
CACHE BOOL
"should the example be built")
# Cubature library.
add_library(cubature INTERFACE)
target_sources(cubature INTERFACE cubature.ipp cubature.hpp)
add_library(Cubature::cubature ALIAS cubature)
target_include_directories(cubature INTERFACE ".")
# Example program.
if(${Cubature_BUILD_EXAMPLE})
add_executable(example example.cpp)
target_link_libraries(example PRIVATE cubature m)
target_compile_features(example PRIVATE cxx_std_11)
set_target_properties(example PROPERTIES CXX_EXTENSIONS OFF)
target_compile_options(
example
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:-Wall -Wextra -pedantic>
$<$<CXX_COMPILER_ID:MSVC>:/W4>)
endif()
# Installation commands.
include(GNUInstallDirs)
install(
FILES cubature.hpp cubature.ipp
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cubature")
install(
TARGETS cubature
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")