-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
133 lines (105 loc) · 3.83 KB
/
CMakeLists.txt
File metadata and controls
133 lines (105 loc) · 3.83 KB
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
# Copyright (c) 2017-2024 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_USER_MAKE_RULES_OVERRIDE
"${CMAKE_SOURCE_DIR}/cmake/modules/OverrideInitFlags.cmake"
)
project(bitcoin-cash-node
VERSION 28.0.0
DESCRIPTION "Bitcoin Cash Node is a full node implementation of the Bitcoin Cash protocol."
HOMEPAGE_URL "https://www.bitcoincashnode.org"
)
# Package information
set(PACKAGE_NAME "Bitcoin Cash Node")
# Copyright
set(COPYRIGHT_YEAR 2024)
set(COPYRIGHT_HOLDERS "The %s developers")
set(COPYRIGHT_HOLDERS_SUBSTITUTION Bitcoin)
string(REPLACE "%s" ${COPYRIGHT_HOLDERS_SUBSTITUTION} COPYRIGHT_HOLDERS_FINAL ${COPYRIGHT_HOLDERS})
# Add path for custom modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
# Make contrib script accessible.
set(CONTRIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib)
# Default to RelWithDebInfo configuration
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Select the configuration for the build" FORCE)
set(__NO_USER_CMAKE_BUILD_TYPE ON CACHE BOOL "True if the user didn't set a build type on the command line")
endif()
set(BITCOIN_QT_OSX_BUNDLE_NAME "BitcoinCashNode-Qt")
# Find the python interpreter. This is required for several targets.
find_package(Python 3.6 COMPONENTS Interpreter REQUIRED)
# Add the magic targets `check-*`
add_custom_target(check-all)
add_custom_target(check)
add_custom_target(check-extended)
add_custom_target(check-upgrade-activated)
add_custom_target(check-upgrade-activated-extended)
add_custom_target(symbol-check)
include(PackageHelper)
exclude_git_ignored_files_from_source_package()
# Ignore hidden files and directories (starting with a '.')
set_property(GLOBAL APPEND PROPERTY SOURCE_PACKAGE_IGNORE_FILES "/\\\\.")
# If the build is out-of-tree, then the build directory can be ignored.
if(NOT CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
set_property(GLOBAL APPEND PROPERTY SOURCE_PACKAGE_IGNORE_FILES
"${CMAKE_BINARY_DIR}/"
)
endif()
exclude_from_source_package(
# Subdirectories
"arcanist/"
"depends/"
# Files
"[^.]+[.]md$"
"Dockerfile-doxygen"
)
option(ENABLE_COVERAGE "Enable coverage" OFF)
option(ENABLE_BRANCH_COVERAGE "Enable branch coverage" OFF)
if(ENABLE_COVERAGE)
include(Coverage)
enable_coverage(${ENABLE_BRANCH_COVERAGE})
include(AddCompilerFlags)
# If no build type is manually defined, override the optimization level.
# Otherwise, alert the user than the coverage result might be useless.
if(__NO_USER_CMAKE_BUILD_TYPE)
set_c_optimization_level(0)
# Setting -Og instead of -O0 is a workaround for the GCC bug 90380:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90380
#
# This bug is fixed upstream, but is not widely distributed yet.
# Fixed in GCC versions:
# - GCC 7.x: versions <= 7.2 are unaffected
# - GCC 8.x: versions >= 8.3.1
# - GCC 9.x: versions >= 9.1.1
# - GCC 10.x: all versions
set_cxx_optimization_level(g)
else()
message(WARNING "It is advised to not enforce CMAKE_BUILD_TYPE to get the best coverage results")
endif()
exclude_from_coverage(
"depends"
"src/bench"
"src/crypto/ctaes"
"src/leveldb"
"src/univalue"
)
add_custom_target_coverage(check)
add_custom_target_coverage(check-all)
add_custom_target_coverage(check-extended)
add_custom_target_coverage(check-upgrade-activated)
add_custom_target_coverage(check-upgrade-activated-extended)
endif()
option(BUILD_BITCOIN_CHRONIK "Activate the Chronik indexer" OFF)
option(BUILD_BITCOIN_CHRONIK_PLUGINS "Activate the plugin system for Chronik" OFF)
add_subdirectory(src)
if(BUILD_BITCOIN_CHRONIK)
add_subdirectory(chronik)
endif()
if(ENABLE_TEST)
add_subdirectory(test)
endif()
add_subdirectory(contrib)
add_subdirectory(doc)
include(PackageOptions.cmake)