Inside Bitcoin
Opening the selected file…
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.
1# Copyright (c) 2024-present The Bitcoin Core developers2# Distributed under the MIT software license, see the accompanying3# file COPYING or https://opensource.org/license/mit/.5include_guard(GLOBAL)7function(indent_message header content indent_num)8if(indent_num GREATER 0)9string(REPEAT " " ${indent_num} indentation)10string(REPEAT "." ${indent_num} tail)11string(REGEX REPLACE "${tail}$" "" header "${header}")12endif()13message("${indentation}${header} ${content}")14endfunction()16# Print tools' flags on best-effort. Include the abstracted17# CMake flags that we touch ourselves.18function(print_flags_per_config config indent_num)19string(TOUPPER "${config}" config_uppercase)21include(GetTargetInterface)22get_target_interface(definitions "${config}" core_interface COMPILE_DEFINITIONS)23indent_message("Preprocessor defined macros ..........." "${definitions}" ${indent_num})25string(STRIP "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS}" combined_cxx_flags)26string(STRIP "${combined_cxx_flags} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_cxx_flags)27string(STRIP "${combined_cxx_flags} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}" combined_cxx_flags)28if(CMAKE_POSITION_INDEPENDENT_CODE)29string(JOIN " " combined_cxx_flags ${combined_cxx_flags} ${CMAKE_CXX_COMPILE_OPTIONS_PIC})30endif()31get_target_interface(core_cxx_flags "${config}" core_interface COMPILE_OPTIONS)32string(STRIP "${combined_cxx_flags} ${core_cxx_flags}" combined_cxx_flags)33string(STRIP "${combined_cxx_flags} ${APPEND_CPPFLAGS}" combined_cxx_flags)34string(STRIP "${combined_cxx_flags} ${APPEND_CXXFLAGS}" combined_cxx_flags)35indent_message("C++ compiler flags ...................." "${combined_cxx_flags}" ${indent_num})37string(STRIP "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_linker_flags)38string(STRIP "${combined_linker_flags} ${CMAKE_EXE_LINKER_FLAGS}" combined_linker_flags)39get_target_interface(common_link_options "${config}" core_interface LINK_OPTIONS)40string(STRIP "${combined_linker_flags} ${common_link_options}" combined_linker_flags)41if(CMAKE_CXX_LINK_PIE_SUPPORTED)42string(JOIN " " combined_linker_flags ${combined_linker_flags} ${CMAKE_CXX_LINK_OPTIONS_PIE})43endif()44string(STRIP "${combined_linker_flags} ${APPEND_LDFLAGS}" combined_linker_flags)45indent_message("Linker flags .........................." "${combined_linker_flags}" ${indent_num})46endfunction()48function(flags_summary)49get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)50if(is_multi_config)51list(JOIN CMAKE_CONFIGURATION_TYPES ", " configs)52message("Available build configurations ........ ${configs}")53if(CMAKE_GENERATOR MATCHES "Visual Studio")54set(default_config "Debug")55else()56list(GET CMAKE_CONFIGURATION_TYPES 0 default_config)57endif()58message("Default build configuration ........... ${default_config}")59foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)60message("")61message("'${config}' build configuration:")62print_flags_per_config("${config}" 2)63endforeach()64else()65message("CMAKE_BUILD_TYPE ...................... ${CMAKE_BUILD_TYPE}")66print_flags_per_config("${CMAKE_BUILD_TYPE}" 0)67endif()68message("")69message([=[70NOTE: The summary above may not exactly match the final applied build flags71if any additional CMAKE_* or environment variables have been modified.72To see the exact flags applied, build with the --verbose option.73]=])74endfunction()
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.