forked from rabauke/mpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (45 loc) · 1.51 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
# 3.9 required for mpi targets, 3.5 required for boost targets
cmake_minimum_required(VERSION 3.9)
# FIXME I didn't see versioning info on github,
# but semantic versioning should be considered
project(mpl VERSION 0.0.1 LANGUAGES CXX C)
option(BUILD_TESTING "" OFF)
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)
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 OFF "build the mpl examples")
if(MPL_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# not prefixed because this is the default variable
# from include(CTest)
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
)