From 233033047a92dce5035ce4acba2d11f01acf4ff8 Mon Sep 17 00:00:00 2001 From: Haocheng Liu Date: Mon, 3 Apr 2023 22:16:27 -0400 Subject: [PATCH] GH-34861: [C++] Move GTest std version check into SYSTEM if branch ### Rationale for this change Developers have reported that the current GTest std version check will break cpp microbenchmarks in BUNDLE mode. ### What changes are included in this PR? Move the check into SYSTEM if branch so that it gets triggered in a narrowed scope. ### Are these changes tested? Tested locally and will be covered by CI. Are there any user-facing changes? No --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index caf33f224bc..f05e1ddb5f0 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2229,15 +2229,15 @@ if(ARROW_TESTING) 1.10.0 USE_CONFIG ${GTEST_USE_CONFIG}) - get_target_property(gtest_cxx_standard GTest::gtest INTERFACE_COMPILE_FEATURES) - if((${gtest_cxx_standard} STREQUAL "cxx_std_11") OR (${gtest_cxx_standard} STREQUAL - "cxx_std_14")) - message(FATAL_ERROR "System GTest is built with a C++ standard lower than 17. Use bundled GTest via passing in CMake flag + if(GTest_SOURCE STREQUAL "SYSTEM") + get_target_property(gtest_cxx_standard GTest::gtest INTERFACE_COMPILE_FEATURES) + if((${gtest_cxx_standard} STREQUAL "cxx_std_11") OR (${gtest_cxx_standard} STREQUAL + "cxx_std_14")) + message(FATAL_ERROR "System GTest is built with a C++ standard lower than 17. Use bundled GTest via passing in CMake flag -DGTest_SOURCE=\"BUNDLED\"") - endif() + endif() - if(GTest_SOURCE STREQUAL "SYSTEM") find_package(PkgConfig QUIET) pkg_check_modules(gtest_PC gtest