7
7
# CMake support is experimental. Use with caution and report any bugs.
8
8
9
9
cmake_minimum_required (VERSION 3.18)
10
+ set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} " "${CMAKE_CURRENT_SOURCE_DIR} /build-aux/cmake" )
11
+
12
+
13
+ # Hunter Package Manager
14
+ # ======================
15
+
16
+ # Windows doesn't yet have a package manager that can be used for managing
17
+ # dependencies, so we use Hunter on it.
18
+ option (HUNTER_ENABLED "Enable Hunter package manager" OFF )
19
+ include (HunterGate)
20
+ HunterGate(
21
+ URL "https://github.com/cpp-pm/hunter/archive/refs/tags/v0.25.3.tar.gz"
22
+ SHA1 "0dfbc2cb5c4cf7e83533733bdfd2125ff96680cb"
23
+ FILEPATH "${CMAKE_CURRENT_SOURCE_DIR} /build-aux/cmake/Hunter/config.cmake"
24
+ )
25
+
26
+
27
+ # Project configuration
28
+ # =====================
10
29
11
30
project ("Gridcoin"
12
31
VERSION 5.4.5.4
@@ -37,20 +56,21 @@ string(REPLACE "NDEBUG" "_NDEBUG" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_REL
37
56
string (REPLACE "NDEBUG" "_NDEBUG" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} " )
38
57
39
58
40
- # Load modules from the source tree
41
- # =================================
42
-
43
- set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} " "${CMAKE_CURRENT_SOURCE_DIR} /build-aux/cmake" )
59
+ # Load CMake modules
60
+ # ==================
44
61
45
62
include (CheckCXXSymbolExists)
46
63
include (CheckFunctionExists)
47
64
include (CheckIncludeFile)
48
65
include (CheckPIESupported)
66
+ include (CheckSymbolExists)
67
+
49
68
include (CheckSSE)
50
69
include (CheckStrerrorR)
51
- include (CheckSymbolExists )
70
+ include (HunterGate )
52
71
include (VersionFromGit)
53
72
73
+
54
74
# Define options
55
75
# ==============
56
76
@@ -74,21 +94,32 @@ option(ENABLE_QRENCODE "Enable generation of QR Codes for receiving payments" O
74
94
option (ENABLE_UPNP "Enable UPnP port mapping support" OFF )
75
95
option (DEFAULT_UPNP "Turn UPnP on startup" OFF )
76
96
option (USE_DBUS "Enable DBus support" OFF )
97
+
98
+ # Bundled packages
77
99
option (SYSTEM_BDB "Find system installation of Berkeley DB CXX 5.3" OFF )
78
100
option (SYSTEM_LEVELDB "Find system installation of leveldb" OFF )
79
101
option (SYSTEM_SECP256K1 "Find system installation of libsecp256k1 with pkg-config" OFF )
80
102
option (SYSTEM_UNIVALUE "Find system installation of Univalue with pkg-config" OFF )
81
103
option (SYSTEM_XXD "Find system xxd binary" OFF )
82
104
105
+ # Hunter packages
106
+ option (BUNDLED_BOOST "Use the bundled version of Boost" ${HUNTER_ENABLED} )
83
107
84
- # Find dependencies
85
- # =================
86
108
87
- set (BOOST_MINIMUM_VERSION 1.63.0)
109
+ # Handle dependencies
110
+ # ===================
111
+
88
112
set (QT5_MINIMUM_VERSION 5.15.0)
89
113
114
+ set (BOOST_MINIMUM_VERSION 1.63.0)
115
+ set (BOOST_COMPONENTS filesystem iostreams thread)
116
+ set (BOOST_HUNTER_COMPONENTS ${BOOST_COMPONENTS} )
117
+ if (ENABLE_TESTS)
118
+ list (APPEND BOOST_COMPONENTS unit_test_framework)
119
+ list (APPEND BOOST_HUNTER_COMPONENTS test )
120
+ endif ()
121
+
90
122
find_package (Atomics REQUIRED)
91
- find_package (Boost ${BOOST_MINIMUM_VERSION} COMPONENTS filesystem iostreams thread REQUIRED)
92
123
find_package (CURL COMPONENTS HTTP HTTPS SSL REQUIRED)
93
124
find_package (OpenSSL REQUIRED)
94
125
find_package (Threads REQUIRED)
@@ -114,6 +145,11 @@ if(SYSTEM_UNIVALUE)
114
145
pkg_check_modules(UNIVALUE REQUIRED IMPORTED_TARGET libunivalue)
115
146
endif ()
116
147
148
+ if (BUNDLED_BOOST)
149
+ hunter_add_package(Boost COMPONENTS ${BOOST_HUNTER_COMPONENTS} )
150
+ endif ()
151
+ find_package (Boost ${BOOST_MINIMUM_VERSION} COMPONENTS ${BOOST_COMPONENTS} CONFIG REQUIRED)
152
+
117
153
if (USE_ASM)
118
154
enable_language (ASM)
119
155
endif ()
@@ -146,7 +182,6 @@ if(ENABLE_UPNP)
146
182
endif ()
147
183
148
184
if (ENABLE_TESTS)
149
- find_package (Boost ${BOOST_MINIMUM_VERSION} COMPONENTS unit_test_framework REQUIRED)
150
185
enable_testing ()
151
186
152
187
if (SYSTEM_XXD)
0 commit comments