Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1cmake_minimum_required(VERSION 3.22)3#=============================4# Project / Package Metadata5#=============================6project(minisketch7VERSION 0.0.18DESCRIPTION "A library for BCH-based set reconciliation"9HOMEPAGE_URL "https://github.com/bitcoin-core/minisketch"10LANGUAGES CXX11)13# ============================================================14# Project Initialization15# ============================================================16enable_testing()17include(CTestUseLaunchers)19list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)21if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)22set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)23endif()24if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)25set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)26endif()27if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)28set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)29endif()31# Prevent include directories from parent project from leaking into this one.32set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")34#=============================35# Language Setup36#=============================37if(DEFINED CMAKE_CXX_STANDARD)38if(CMAKE_CXX_STANDARD EQUAL 98 OR CMAKE_CXX_STANDARD LESS 11)39message(FATAL_ERROR "This project requires at least C++11")40endif()41else()42set(CMAKE_CXX_STANDARD 11)43endif()44set(CMAKE_CXX_STANDARD_REQUIRED ON)45if(NOT DEFINED CMAKE_CXX_EXTENSIONS)46set(CMAKE_CXX_EXTENSIONS OFF)47endif()49#=============================50# Configurable Options51#=============================52option(MINISKETCH_INSTALL "Enable installation." ${PROJECT_IS_TOP_LEVEL})53if(NOT PROJECT_IS_TOP_LEVEL)54mark_as_advanced(MINISKETCH_INSTALL)55endif()57option(MINISKETCH_BUILD_TESTS "Build tests." ON)58option(MINISKETCH_BUILD_BENCHMARK "Build benchmark." OFF)60set(supported_fields "")61set(have_enabled_fields NO)62set(have_disabled_fields NO)63foreach(i RANGE 2 64)64list(APPEND supported_fields ${i})65endforeach()66if(NOT DEFINED MINISKETCH_FIELDS)67set(MINISKETCH_FIELDS ${supported_fields} CACHE STRING "Semicolon-separated list of field sizes to build. Default=all. Available sizes: ${supported_fields}.")68endif()69foreach(field IN LISTS supported_fields)70if(field IN_LIST MINISKETCH_FIELDS)71set(have_enabled_fields YES)72else()73set(have_disabled_fields YES)74add_compile_definitions(DISABLE_FIELD_${field})75endif()76endforeach()77if(NOT have_enabled_fields)78message(FATAL_ERROR "No field sizes are enabled.")79endif()80unset(have_enabled_fields)81unset(supported_fields)83#=============================84# Build Options85#=============================86set(CMAKE_CXX_VISIBILITY_PRESET hidden)88if(MSVC)89add_compile_options(/Zc:__cplusplus)90endif()92if(MINGW)93add_link_options(-static)94endif()96#=============================97# Diagnostics Options98#=============================99if(MSVC)100# For both MSVC's cl.exe and clang-cl compilers.101add_compile_options(/W3) # Production quality warning level. Enables -Wall Clang's core option.102else()103add_compile_options(-Wall)104endif()106if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")107add_compile_options(/wd4060) # Disable warning C4060 "switch statement contains no 'case' or 'default' labels".108add_compile_options(/wd4065) # Disable warning C4065 "switch statement contains 'default' but no 'case' labels".109add_compile_options(/wd4146) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".110add_compile_options(/wd4244) # Disable warning C4244 "conversion from 'type1' to 'type2', possible loss of data".111else()112add_compile_options(-Wundef)113endif()115#=============================116# Main Processing117#=============================118include(SystemIntrospection)119add_subdirectory(src)121include(PrintConfigureSummary)122print_configure_summary()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.