-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
114 lines (91 loc) · 3.46 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0074)
# Use package_ROOT environment variables
cmake_policy(SET CMP0074 NEW)
endif(POLICY CMP0074)
project(fides LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
# ------------------------------------------------------------------------------
# GSL lite
# ------------------------------------------------------------------------------
set(GSL_LITE_URL https://github.com/gsl-lite/gsl-lite.git)
include(ExternalProject)
find_package(Git REQUIRED)
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/3rd_party)
ExternalProject_Add(
gsl-extern
GIT_REPOSITORY ${GSL_LITE_URL}
TIMEOUT 10
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON)
ExternalProject_Get_Property(gsl-extern SOURCE_DIR)
set(GSL_LITE_INCLUDE_DIR
${SOURCE_DIR}/include
CACHE INTERNAL "Include folder for gsl-lite")
add_library(gsl INTERFACE)
target_include_directories(gsl INTERFACE ${GSL_LITE_INCLUDE_DIR})
add_library(gsl::gsl-lite ALIAS gsl)
install(TARGETS gsl EXPORT FidesTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
# ------------------------------------------------------------------------------
# spdlog
# ------------------------------------------------------------------------------
find_package(spdlog REQUIRED)
# ------------------------------------------------------------------------------
# Blaze
# ------------------------------------------------------------------------------
find_package(blaze REQUIRED)
add_library(blaze_target INTERFACE)
target_link_libraries(blaze_target INTERFACE blaze::blaze)
# ------------------------------------------------------------------------------
# LAPACK
# ------------------------------------------------------------------------------
find_package(LAPACK REQUIRED)
# ------------------------------------------------------------------------------
# ...
# ------------------------------------------------------------------------------
include(version)
add_subdirectory(src)
add_subdirectory(tests)
# ------------------------------------------------------------------------------
# Export
# ------------------------------------------------------------------------------
install(
TARGETS ${PROJECT_NAME}
EXPORT FidesTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fides)
export(
EXPORT FidesTargets
FILE FidesTargets.cmake
NAMESPACE Fides::)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/FidesConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/FidesConfig.cmake"
INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/")
# TODO
set(PROJECT_VERSION 0.0.0)
write_basic_package_version_file(FidesConfigVersion.cmake
COMPATIBILITY ExactVersion)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/FidesConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/FidesTargets.cmake
${CMAKE_CURRENT_BINARY_DIR}/FidesConfigVersion.cmake
DESTINATION share/Fides/cmake)
option(EXPORT_PACKAGE "Export Fides library to CMake package registry?" ON)
if(EXPORT_PACKAGE)
export(PACKAGE Fides)
endif()