From ef0bbe5126203c095beacab487a2994b5a0b9b88 Mon Sep 17 00:00:00 2001 From: Morten Borup Petersen Date: Thu, 5 Sep 2024 16:06:59 +0200 Subject: [PATCH] Prevent gtest compiler/link errors on windows (#111) 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 `gtest_force_shared_crt ` is enabled ([doc](https://github.com/google/googletest/blob/main/googletest/README.md)). --- third_party/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 0a5f605b..f3247590 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,6 +13,13 @@ 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.")