Skip to content

Commit e7fb823

Browse files
committed
cmake: Add config/bitcoin-config.h support
1 parent bc25dda commit e7fb823

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ project("Bitcoin Core"
2727
LANGUAGES CXX C ASM
2828
)
2929

30+
set(CLIENT_VERSION_IS_RELEASE "false")
31+
set(COPYRIGHT_YEAR "2023")
32+
set(COPYRIGHT_HOLDERS "The %s developers")
33+
set(COPYRIGHT_HOLDERS_FINAL "The ${PROJECT_NAME} developers")
34+
set(PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues")
35+
3036
# Configurable options.
3137
# When adding a new option, end the <help_text> with a full stop for consistency.
3238
include(CMakeDependentOption)
@@ -52,6 +58,8 @@ else()
5258
endif()
5359
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
5460

61+
add_subdirectory(src)
62+
5563
message("\n")
5664
message("Configure summary")
5765
message("=================")

cmake/bitcoin-config.h.in

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_CONFIG_H
6+
7+
#define BITCOIN_CONFIG_H
8+
9+
/* Version Build */
10+
#define CLIENT_VERSION_BUILD @PROJECT_VERSION_PATCH@
11+
12+
/* Version is release */
13+
#define CLIENT_VERSION_IS_RELEASE @CLIENT_VERSION_IS_RELEASE@
14+
15+
/* Major version */
16+
#define CLIENT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
17+
18+
/* Minor version */
19+
#define CLIENT_VERSION_MINOR @PROJECT_VERSION_MINOR@
20+
21+
/* Copyright holder(s) before %s replacement */
22+
#define COPYRIGHT_HOLDERS "@COPYRIGHT_HOLDERS@"
23+
24+
/* Copyright holder(s) */
25+
#define COPYRIGHT_HOLDERS_FINAL "@COPYRIGHT_HOLDERS_FINAL@"
26+
27+
/* Replacement for %s in copyright holders string */
28+
#define COPYRIGHT_HOLDERS_SUBSTITUTION "@PROJECT_NAME@"
29+
30+
/* Copyright year */
31+
#define COPYRIGHT_YEAR @COPYRIGHT_YEAR@
32+
33+
/* Define to the address where bug reports for this package should be sent. */
34+
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
35+
36+
/* Define to the full name of this package. */
37+
#define PACKAGE_NAME "@PROJECT_NAME@"
38+
39+
/* Define to the home page for this package. */
40+
#define PACKAGE_URL "@PROJECT_HOMEPAGE_URL@"
41+
42+
/* Define to the version of this package. */
43+
#define PACKAGE_VERSION "@PROJECT_VERSION@"
44+
45+
#endif //BITCOIN_CONFIG_H

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2023 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
configure_file(${CMAKE_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY)
6+
add_compile_definitions(HAVE_CONFIG_H)
7+
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

0 commit comments

Comments
 (0)