-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
100 lines (79 loc) · 2.66 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
cmake_minimum_required(VERSION 3.20)
project(tula
DESCRIPTION
"The C++ utility library for TolTEC"
HOMEPAGE_URL
"https://toltec-astro.github.io/tula"
)
# Load CMake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/tula_cmake/cmake" ${CMAKE_MODULE_PATH})
include(common_settings)
add_library(tula_headers INTERFACE)
target_include_directories(tula_headers
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include)
include(config_header)
target_link_libraries(tula_headers INTERFACE tula::config_header)
file(GLOB_RECURSE TULA_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/tula/*.h")
target_precompile_headers(tula_headers INTERFACE
${TULA_HEADER_FILES}
)
# Do not add any link libs since we'll be pulling in dependencies
# as they are needed in the user code
add_library(tula::headers ALIAS tula_headers)
# Check if this project is embedded as sub project.
if(NOT DEFINED TULA_STANDALONE)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(TULA_STANDALONE ON)
else()
set(TULA_STANDALONE OFF)
endif()
endif()
if (TULA_STANDALONE)
# Create a sum-target tula_all incluing all componnets
set(component_libs "")
include(perflibs)
set(component_libs ${component_libs} tula::perflibs)
include(logging)
set(component_libs ${component_libs} tula::logging)
include(Yaml)
set(component_libs ${component_libs} tula::Yaml)
include(Clipp)
set(component_libs ${component_libs} tula::Clipp)
include(NetCDFCXX4)
set(component_libs ${component_libs} tula::NetCDFCXX4)
include(Eigen3)
set(component_libs ${component_libs} tula::Eigen3)
include(Ceres)
set(component_libs ${component_libs} tula::Ceres)
include(Grppi)
set(component_libs ${component_libs} tula::Grppi)
include(Csv)
set(component_libs ${component_libs} tula::Csv)
include(MXX)
set(component_libs ${component_libs} tula::MXX)
include(CCfits)
set(component_libs ${component_libs} tula::CCfits)
add_library(tula_all INTERFACE)
target_link_libraries(tula_all
INTERFACE
tula::headers
${component_libs}
)
add_library(tula::tula ALIAS tula_all)
option(TULA_BUILD_TESTS "Build tests" ON)
if (TULA_BUILD_TESTS)
add_subdirectory(tests)
endif()
option(TULA_BUILD_EXAMPLES "Build example programs" OFF)
if (TULA_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
option(TULA_BUILD_DOC "Build docs" OFF)
if (TULA_BUILD_DOC)
include(docxgen_target)
endif()
endif()
# Finally we create the config header
generate_gitversion_header(${PROJECT_NAME})
generate_config_header(${PROJECT_NAME})