forked from boostorg/geometry
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
134 lines (115 loc) · 3.49 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Originally generated by `boostdep --cmake geometry`
# Adapted manually
# Copyright 2020, 2021 Peter Dimov
# Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.8...3.20)
project(boost_geometry VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_geometry INTERFACE)
add_library(Boost::geometry ALIAS boost_geometry)
target_include_directories(boost_geometry INTERFACE include)
target_compile_features(boost_geometry INTERFACE cxx_std_14)
target_link_libraries(boost_geometry
INTERFACE
Boost::algorithm
Boost::any
Boost::array
Boost::assert
Boost::concept_check
Boost::config
Boost::core
Boost::crc
Boost::function_types
Boost::iterator
Boost::lexical_cast
Boost::math
Boost::move
Boost::mpl
Boost::multiprecision
Boost::numeric_conversion
Boost::program_options
Boost::qvm
Boost::range
Boost::rational
Boost::static_assert
Boost::throw_exception
Boost::tokenizer
Boost::tuple
Boost::type_traits
Boost::utility
Boost::variant
)
# Required for Boost.Geometry Index
target_link_libraries(boost_geometry
INTERFACE
Boost::container
Boost::serialization
)
# Optional requirements (for example, for adaptations)
if(BOOST_GEOMETRY_BUILD_OPTIONAL)
target_link_libraries(boost_geometry
INTERFACE
Boost::fusion
Boost::integer
Boost::polygon
Boost::variant2
)
# Mentioned in SRS Shared_grids_boost (which is optional)
target_link_libraries(boost_geometry
INTERFACE
Boost::thread
)
# Requirements for extensions
target_link_libraries(boost_geometry
INTERFACE
Boost::endian
Boost::predef
)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
if (${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
# Project is root. Find Boost source.
set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." CACHE STRING "Boost source dir to use when running CMake from this directory")
if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR})
set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_SRC_DIR}")
endif()
set(BOOST_SRC_DIR_IS_VALID ON)
foreach (PATH "CMakeLists.txt" "Jamroot" "boost-build.jam" "libs")
if (NOT EXISTS "${BOOST_SRC_DIR}/${PATH}")
message(STATUS "${BOOST_SRC_DIR}/${PATH} does not exist. Fallback to find_package.")
set(BOOST_SRC_DIR_IS_VALID OFF)
break()
endif()
endforeach()
# Create Boost targets from source dir or boost package.
# These are the direct dependencies currently used in unit tests.
set(BOOST_INCLUDE_LIBRARIES
config
algorithm
any
crc
lexical_cast
math
multiprecision
program_options
qvm
rational
serialization
tokenizer
variant
test)
if (BOOST_SRC_DIR_IS_VALID)
set(BOOST_EXCLUDE_LIBRARIES ${PROJECT_NAME})
add_subdirectory(${BOOST_SRC_DIR} deps_/boost EXCLUDE_FROM_ALL)
else()
find_package(Boost 1.81.0 REQUIRED)
foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES})
add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers)
endforeach ()
endif()
endif()
enable_testing()
add_subdirectory(test EXCLUDE_FROM_ALL)
add_subdirectory(index/test EXCLUDE_FROM_ALL)
endif()