Skip to content

Commit

Permalink
Merge #224: cmake: Improve Boost checks
Browse files Browse the repository at this point in the history
e104fa9 fixup! cmake: Build `bitcoind` executable (Hennadii Stepanov)
b38d2bc fixup! cmake: Build `bitcoind` executable (Hennadii Stepanov)

Pull request description:

  The first commit was requested offline.

  The second commit speeds up configuration.

Top commit has no ACKs.

Tree-SHA512: c520fbe44c2601bc7052c411445f54a89a53352e71f67c1464bc96c413782f461449e95170cc519a9613942d78ee517de8d629c7c7e5f8b20226b7b37df0eff4
  • Loading branch information
hebasto committed Jun 10, 2024
2 parents 0007a17 + e104fa9 commit 8ce80b9
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions cmake/module/AddBoostIfNeeded.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,14 @@ function(add_boost_if_needed)
endif()

if(BUILD_TESTS)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
" HAVE_BOOST_INCLUDED_UNIT_TEST_H
)
# Some package managers, such as vcpkg, vendor Boost.Test separately
# from the rest of the headers, so we have to check for it individually.
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 8ce80b9

Please sign in to comment.