-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
57 lines (45 loc) · 1.61 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
45
46
47
48
49
50
51
52
53
54
55
56
57
# 3.10 required for mpi targets, 3.5 required for boost targets
cmake_minimum_required(VERSION 3.10)
# FIXME I didn't see versioning info on github,
# but semantic versioning should be considered
project(mpl VERSION 0.3.0 LANGUAGES CXX C)
if(NOT DEFINED CACHE{BUILD_TESTING})
set(BUILD_TESTING OFF CACHE BOOL "")
endif()
include(CTest)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# project requires c++17 to build
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(MPI REQUIRED)
find_package(Threads REQUIRED)
add_library(mpl INTERFACE)
target_include_directories(mpl
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# convention for allowing use as a subdirectory
add_library(mpl::mpl ALIAS mpl)
target_link_libraries(mpl INTERFACE Threads::Threads MPI::MPI_CXX)
option(MPL_BUILD_EXAMPLES "build the mpl examples" OFF)
if(MPL_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mplConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mpl)
install(DIRECTORY mpl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS mpl EXPORT mplTargets)
export(EXPORT mplTargets
NAMESPACE mpl::
FILE mplTargets.cmake)
install(EXPORT mplTargets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mpl
NAMESPACE mpl::
FILE mplTargets.cmake)
option(MPL_BUILD_DOCUMENTATION "build the mpl documentation using Doxygen and Sphinx" OFF)
add_subdirectory(doc)