From 4087ae39740a979dbed3109e960ea192e8a44676 Mon Sep 17 00:00:00 2001 From: Morten Borup Petersen Date: Thu, 5 Sep 2024 13:12:33 +0200 Subject: [PATCH] Prevent gtest compiler/link errors on windows Substrait-cpp is (i assume) intended to embed into other projects, so other subprojects should adhere to parent projects' settings. For GTest on windows, this requires that ... is enabled ([doc](https://github.com/google/googletest/blob/main/googletest/README.md)). --- third_party/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 0a5f605b..f0822a67 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,6 +13,12 @@ include(datetime.cmake) add_subdirectory(fmt) + +if(WIN32) + # For Windows: Prevent overriding the parent project's compiler/linker settings + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +endif() + find_package(GTest QUIET) if(NOT ${GTEST_FOUND}) message(STATUS "Retrieving external GoogleTest library.")