-
Notifications
You must be signed in to change notification settings - Fork 69
/
CMakeLists.txt
69 lines (57 loc) · 1.97 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
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 3.20)
project(fastor VERSION 0.6.4)
option(BUILD_TESTING "Build the testing tree." ON)
set(FASTOR_SOURCE_DIR "${fastor_SOURCE_DIR}")
set(FASTOR_BINARY_DIR "${fastor_BINARY_DIR}")
set(FASTOR_INCLUDE_DIR "${fastor_SOURCE_DIR}")
include(GNUInstallDirs)
set(FASTOR_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(FASTOR_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(FASTOR_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_DATADIR}/cmake/Fastor")
set(FASTOR_INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_DATADIR}/pkgconfig")
add_library(Fastor INTERFACE)
target_include_directories(
Fastor INTERFACE
$<BUILD_INTERFACE:${FASTOR_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${FASTOR_INSTALL_INCLUDE_DIR}>)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
install(
DIRECTORY "${FASTOR_INCLUDE_DIR}/Fastor"
DESTINATION "${FASTOR_INSTALL_INCLUDE_DIR}")
install(
TARGETS Fastor
EXPORT FastorTargets)
export(
TARGETS Fastor
NAMESPACE Fastor::
FILE "${FASTOR_BINARY_DIR}/FastorTargets.cmake")
export(PACKAGE Fastor)
install(
EXPORT FastorTargets
NAMESPACE Fastor::
DESTINATION "${FASTOR_INSTALL_CMAKE_DIR}")
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${FASTOR_SOURCE_DIR}/data/FastorConfig.cmake.in"
"${FASTOR_BINARY_DIR}/FastorConfig.cmake"
INSTALL_DESTINATION "${FASTOR_INSTALL_CMAKE_DIR}"
PATH_VARS FASTOR_INSTALL_INCLUDE_DIR)
write_basic_package_version_file(
"${FASTOR_BINARY_DIR}/FastorConfigVersion.cmake"
VERSION ${fastor_VERSION}
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT)
install(
FILES
"${FASTOR_BINARY_DIR}/FastorConfigVersion.cmake"
"${FASTOR_BINARY_DIR}/FastorConfig.cmake"
DESTINATION "${FASTOR_INSTALL_CMAKE_DIR}")
configure_file(
"${FASTOR_SOURCE_DIR}/data/fastor.pc.in"
"${FASTOR_BINARY_DIR}/fastor.pc" @ONLY)
install(
FILES "${FASTOR_BINARY_DIR}/fastor.pc"
DESTINATION "${FASTOR_INSTALL_PKGCONFIG_DIR}")