aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-09-04 10:33:14 +0100
committerfanquake <fanquake@gmail.com>2024-09-05 16:15:27 +0100
commita7a4e11db8722c85175bcc4d9f73a713e9e61513 (patch)
tree5f4177482784042a2fff65bee8b13721a99e8af5 /cmake
parentd661e2b1b771abafb0b152842d775d3150032230 (diff)
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
Diffstat (limited to 'cmake')
-rw-r--r--cmake/module/AddBoostIfNeeded.cmake6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmake/module/AddBoostIfNeeded.cmake b/cmake/module/AddBoostIfNeeded.cmake
index 89603ecd61..ecd0d6f2ab 100644
--- a/cmake/module/AddBoostIfNeeded.cmake
+++ b/cmake/module/AddBoostIfNeeded.cmake
@@ -64,9 +64,9 @@ function(add_boost_if_needed)
set(CMAKE_REQUIRED_DEFINITIONS)
endif()
- 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.
+ # Some package managers, such as vcpkg, vendor Boost.Test separately
+ # from the rest of the headers, so we have to check for it individually.
+ if(BUILD_TESTS AND DEFINED VCPKG_TARGET_TRIPLET)
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)