Skip to content

Commit 6faee47

Browse files
authored
ARROW-16601: [C++][FlightRPC] Don't enforcing static link with static GoogleTest for arrow_flight_testing (#13180)
We can remove this because #13169/ARROW-16588 solved the link problem. Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent cde5a08 commit 6faee47

2 files changed

Lines changed: 4 additions & 34 deletions

File tree

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,10 +2059,7 @@ if(ARROW_TESTING)
20592059
# We can't find shred library version of GoogleTest on Windows with
20602060
# Conda's gtest package because it doesn't provide GTestConfig.cmake
20612061
# provided by GoogleTest and CMake's built-in FindGTtest.cmake
2062-
# doesn't support gtest_dll.dll. If we find static library version
2063-
# of GoogleTest and ARROW_BUILD_SHARED=ON/ARROW_BUILD_STATIC=OFF are
2064-
# specified, we need to build arrow_flight_testing as a static
2065-
# library. See cpp/src/arrow/flight/CMakeLists.txt for details.
2062+
# doesn't support gtest_dll.dll.
20662063
resolve_dependency(GTest
20672064
REQUIRED_VERSION
20682065
1.10.0

cpp/src/arrow/flight/CMakeLists.txt

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,6 @@ if(NOT ARROW_GRPC_USE_SHARED)
3434
message(STATUS "Linking Arrow Flight tests statically due to static gRPC")
3535
set(ARROW_FLIGHT_TEST_LINKAGE "static")
3636
endif()
37-
if(ARROW_TESTING)
38-
if(WIN32)
39-
# We need to use the same library type for arrow_flight_testing
40-
# and Google Test because arrow_flight_testing has
41-
# arrow::flight:FlightTest that inherits testing::Test. If
42-
# arrow_flight_testing's library type and gtest's library type are
43-
# different such as arrow_flight_testing is a shared library and
44-
# gtest is a static library, link error is occurred.
45-
get_target_property(GTEST_TYPE GTest::gtest TYPE)
46-
if(GTEST_TYPE STREQUAL "SHARED_LIBRARY")
47-
set(ARROW_FLIGHT_TESTING_BUILD_SHARED TRUE)
48-
set(ARROW_FLIGHT_TESTING_BUILD_STATIC FALSE)
49-
else()
50-
set(ARROW_FLIGHT_TESTING_BUILD_SHARED FALSE)
51-
set(ARROW_FLIGHT_TESTING_BUILD_STATIC TRUE)
52-
message(STATUS "Linking Arrow Flight tests statically due to static GTest")
53-
set(ARROW_FLIGHT_TEST_LINKAGE "static")
54-
endif()
55-
else()
56-
set(ARROW_FLIGHT_TESTING_BUILD_SHARED ${ARROW_BUILD_SHARED})
57-
set(ARROW_FLIGHT_TESTING_BUILD_STATIC ${ARROW_BUILD_STATIC})
58-
endif()
59-
endif()
6037

6138
set(ARROW_FLIGHT_TEST_INTERFACE_LIBS)
6239
if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static")
@@ -280,10 +257,6 @@ if(ARROW_TESTING)
280257
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
281258
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
282259
add_arrow_lib(arrow_flight_testing
283-
BUILD_SHARED
284-
${ARROW_FLIGHT_TESTING_BUILD_SHARED}
285-
BUILD_STATIC
286-
${ARROW_FLIGHT_TESTING_BUILD_STATIC}
287260
CMAKE_PACKAGE_NAME
288261
ArrowFlightTesting
289262
PKG_CONFIG_NAME
@@ -325,7 +298,7 @@ add_arrow_test(flight_test
325298
if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
326299
add_executable(flight-test-server test_server.cc)
327300
target_link_libraries(flight-test-server ${ARROW_FLIGHT_TEST_LINK_LIBS}
328-
${GFLAGS_LIBRARIES} GTest::gtest)
301+
${GFLAGS_LIBRARIES})
329302

330303
if(ARROW_BUILD_TESTS)
331304
add_dependencies(arrow-flight-test flight-test-server)
@@ -346,11 +319,11 @@ if(ARROW_BUILD_BENCHMARKS)
346319

347320
add_executable(arrow-flight-perf-server perf_server.cc perf.pb.cc)
348321
target_link_libraries(arrow-flight-perf-server ${ARROW_FLIGHT_TEST_LINK_LIBS}
349-
${GFLAGS_LIBRARIES} GTest::gtest)
322+
${GFLAGS_LIBRARIES})
350323

351324
add_executable(arrow-flight-benchmark flight_benchmark.cc perf.pb.cc)
352325
target_link_libraries(arrow-flight-benchmark ${ARROW_FLIGHT_TEST_LINK_LIBS}
353-
${GFLAGS_LIBRARIES} GTest::gtest)
326+
${GFLAGS_LIBRARIES})
354327

355328
add_dependencies(arrow-flight-benchmark arrow-flight-perf-server)
356329

0 commit comments

Comments
 (0)