From 4700e483e09eb243251cd0bb9f0559f89237b41f Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Fri, 9 Feb 2024 16:01:05 -0800 Subject: [PATCH] Don't invoke vcpkg from this repo with CMAKE_TOOLCHAIN_FILE set (#2527) --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fa071f353..48f2072667 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,9 +573,16 @@ if(BUILD_TESTING) # Make sure we are always bootsrapped with vcpkg on Windows find_package(GTest) if(NOT (GTEST_FOUND OR GTest_FOUND)) - install_windows_deps() - include(${CMAKE_TOOLCHAIN_FILE}) - find_package(GTest REQUIRED) + if(DEFINED CMAKE_TOOLCHAIN_FILE) + message( + FATAL_ERROR + "Pleaes install GTest with the CMAKE_TOOLCHAIN_FILE at ${CMAKE_TOOLCHAIN_FILE}" + ) + else() + install_windows_deps() + include(${CMAKE_TOOLCHAIN_FILE}) + find_package(GTest REQUIRED) + endif() endif() else() # Prefer GTest installed by OS distro, brew or vcpkg package manager