From d47cfbc33ded7aa5787808fda5d313d4a4ceb725 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 31 Aug 2023 11:23:58 +0900 Subject: [PATCH] Add missing gmock dependencies --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 +---- cpp/src/arrow/CMakeLists.txt | 17 +++++++++-------- cpp/src/arrow/compute/CMakeLists.txt | 4 +++- cpp/src/arrow/compute/kernels/CMakeLists.txt | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 1bfaf9f897f5b..5150b1492bcaf 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2103,10 +2103,7 @@ macro(build_gtest) URL_HASH "SHA256=${ARROW_GTEST_BUILD_SHA256_CHECKSUM}") prepare_fetchcontent() if(APPLE) - string(APPEND - CMAKE_CXX_FLAGS - " -Wno-unused-value" - " -Wno-ignored-attributes") + string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-value" " -Wno-ignored-attributes") endif() set(BUILD_SHARED_LIBS ON) set(BUILD_STATIC_LIBS OFF) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index b24b477ddc673..9ecf2b51c91bf 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -324,6 +324,11 @@ if(ARROW_WITH_ZSTD) list(APPEND ARROW_SRCS util/compression_zstd.cc) endif() +set(ARROW_TESTING_SHARED_LINK_LIBS arrow::flatbuffers rapidjson::rapidjson arrow_shared + ${ARROW_GTEST_GTEST}) +set(ARROW_TESTING_STATIC_LINK_LIBS arrow::flatbuffers rapidjson::rapidjson arrow_static + ${ARROW_GTEST_GTEST}) + set(ARROW_TESTING_SRCS io/test_common.cc ipc/test_common.cc @@ -503,6 +508,8 @@ if(ARROW_FILESYSTEM) SKIP_UNITY_BUILD_INCLUSION ON) endif() + list(APPEND ARROW_TESTING_SHARED_LINK_LIBS ${ARROW_GTEST_GMOCK}) + list(APPEND ARROW_TESTING_STATIC_LINK_LIBS ${ARROW_GTEST_GMOCK}) list(APPEND ARROW_TESTING_SRCS filesystem/test_util.cc) endif() @@ -728,17 +735,11 @@ if(ARROW_TESTING) DEPENDENCIES arrow_test_dependencies SHARED_LINK_LIBS - arrow::flatbuffers - rapidjson::rapidjson - arrow_shared - ${ARROW_GTEST_GTEST} + ${ARROW_TESTING_SHARED_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS ${ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS - arrow::flatbuffers - rapidjson::rapidjson - arrow_static - ${ARROW_GTEST_GTEST} + ${ARROW_TESTING_STATIC_LINK_LIBS} STATIC_INSTALL_INTERFACE_LIBS ${ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS}) diff --git a/cpp/src/arrow/compute/CMakeLists.txt b/cpp/src/arrow/compute/CMakeLists.txt index 1134e0a98ae45..001424dd42072 100644 --- a/cpp/src/arrow/compute/CMakeLists.txt +++ b/cpp/src/arrow/compute/CMakeLists.txt @@ -89,7 +89,9 @@ add_arrow_test(internals_test kernel_test.cc light_array_test.cc registry_test.cc - key_hash_test.cc) + key_hash_test.cc + EXTRA_LINK_LIBS + ${ARROW_GTEST_GMOCK}) add_arrow_compute_test(expression_test SOURCES expression_test.cc) diff --git a/cpp/src/arrow/compute/kernels/CMakeLists.txt b/cpp/src/arrow/compute/kernels/CMakeLists.txt index 0bd6fe86134ab..78743050625a4 100644 --- a/cpp/src/arrow/compute/kernels/CMakeLists.txt +++ b/cpp/src/arrow/compute/kernels/CMakeLists.txt @@ -23,7 +23,8 @@ if(ARROW_TESTING) add_library(arrow_compute_kernels_testing OBJECT test_util.cc) # Even though this is still just an object library we still need to "link" our # dependencies so that include paths are configured correctly - target_link_libraries(arrow_compute_kernels_testing ${ARROW_GTEST_GTEST}) + target_link_libraries(arrow_compute_kernels_testing ${ARROW_GTEST_GTEST} + ${ARROW_GTEST_GMOCK}) endif() add_arrow_test(scalar_cast_test