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.
1# Copyright (c) 2023-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)7#[=[8Check once if C++ source code can be compiled.10Options:12CXXFLAGS - A list of additional flags to pass to the compiler.14LDFLAGS - A list of additional flags to pass to the linker.16LINK_LIBRARIES - A list of libraries to add to the link command.18For historical reasons, among the CMake `CMAKE_REQUIRED_*` variables that influence19`check_cxx_source_compiles()`, only `CMAKE_REQUIRED_FLAGS` is a string rather than20a list. Additionally, `target_compile_options()` also expects a list of options.22The `check_cxx_source_compiles_with_flags()` function handles this case and accepts23`CXXFLAGS` as a list, simplifying the code at the caller site.25#]=]26function(check_cxx_source_compiles_with_flags source result_var)27cmake_parse_arguments(PARSE_ARGV 2 _ "" "" "CXXFLAGS;LDFLAGS;LINK_LIBRARIES")28list(JOIN __CXXFLAGS " " CMAKE_REQUIRED_FLAGS)29set(CMAKE_REQUIRED_LINK_OPTIONS ${__LDFLAGS})30set(CMAKE_REQUIRED_LIBRARIES ${__LINK_LIBRARIES})31include(CheckCXXSourceCompiles)32check_cxx_source_compiles("${source}" ${result_var})33set(${result_var} ${${result_var}} PARENT_SCOPE)34endfunction()
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.