Skip to content

Commit a7a4e11

Browse files
committed
cmake: scope Boost Test check to vcpkg
This check was added for vcpkg, given how it packages Boost. However, we don't need to run the check for other platforms, and it's quite slow. So, scope it to VCPKG. On my machine, this reduces the time to run `cmake -B build` from ~12 seconds, to ~6 seconds. Fixes: #30787
1 parent d661e2b commit a7a4e11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmake/module/AddBoostIfNeeded.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ function(add_boost_if_needed)
6464
set(CMAKE_REQUIRED_DEFINITIONS)
6565
endif()
6666

67-
if(BUILD_TESTS)
68-
# Some package managers, such as vcpkg, vendor Boost.Test separately
69-
# from the rest of the headers, so we have to check for it individually.
67+
# Some package managers, such as vcpkg, vendor Boost.Test separately
68+
# from the rest of the headers, so we have to check for it individually.
69+
if(BUILD_TESTS AND DEFINED VCPKG_TARGET_TRIPLET)
7070
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DBOOST_TEST_NO_MAIN)
7171
include(CheckIncludeFileCXX)
7272
check_include_file_cxx(boost/test/included/unit_test.hpp HAVE_BOOST_INCLUDED_UNIT_TEST_H)

0 commit comments

Comments
 (0)