Skip to content

Commit

Permalink
fixup! cmake: Build bitcoind executable
Browse files Browse the repository at this point in the history
Switch to `check_include_file_cxx` when checking headers.
This speeds up configuration.

Only one Boost.Test header is being checked now.
  • Loading branch information
hebasto committed Jun 10, 2024
1 parent b38d2bc commit e104fa9
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions cmake/module/AddBoostIfNeeded.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,12 @@ function(add_boost_if_needed)
if(BUILD_TESTS)
# Some package managers, such as vcpkg, vendor Boost.Test separately
# from the rest of the headers, so we have to check for it individually.
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
" HAVE_BOOST_INCLUDED_UNIT_TEST_H
)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DBOOST_TEST_NO_MAIN)
include(CheckIncludeFileCXX)
check_include_file_cxx(boost/test/included/unit_test.hpp HAVE_BOOST_INCLUDED_UNIT_TEST_H)
if(NOT HAVE_BOOST_INCLUDED_UNIT_TEST_H)
message(FATAL_ERROR "Building test_bitcoin executable requested but boost/test/included/unit_test.hpp header not available.")
endif()

check_cxx_source_compiles("
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
" HAVE_BOOST_UNIT_TEST_H
)
if(NOT HAVE_BOOST_UNIT_TEST_H)
message(FATAL_ERROR "Building test_bitcoin executable requested but boost/test/unit_test.hpp header not available.")
endif()
endif()

endfunction()

0 comments on commit e104fa9

Please sign in to comment.