Skip to content

Commit

Permalink
Simplify Parquet test link libs
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 27, 2023
1 parent a3809eb commit 07c0e01
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions cpp/src/parquet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ function(ADD_PARQUET_TEST REL_TEST_NAME)
if(ARROW_TEST_LINKAGE STREQUAL "static")
add_test_case(${REL_TEST_NAME}
STATIC_LINK_LIBS
${PARQUET_STATIC_TEST_LINK_LIBS}
parquet_static
${PARQUET_TEST_LINK_LIBS}
${TEST_ARGUMENTS}
${ARG_UNPARSED_ARGUMENTS})
else()
add_test_case(${REL_TEST_NAME}
STATIC_LINK_LIBS
${PARQUET_SHARED_TEST_LINK_LIBS}
parquet_shared
${PARQUET_TEST_LINK_LIBS}
${TEST_ARGUMENTS}
${ARG_UNPARSED_ARGUMENTS})
endif()
Expand Down Expand Up @@ -118,27 +120,20 @@ endfunction()
if(ARROW_BUILD_STATIC)
set(PARQUET_STATIC_LINK_LIBS arrow_static ${ARROW_STATIC_LINK_LIBS})
set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static)
set(ARROW_LIBRARIES_FOR_STATIC_TESTS arrow_testing_static arrow_static
${ARROW_STATIC_LINK_LIBS})
else()
set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS)
set(ARROW_LIBRARIES_FOR_STATIC_TESTS arrow_testing_shared arrow_shared)
endif()

set(PARQUET_MIN_TEST_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN} Boost::headers)

set(PARQUET_TEST_LINK_LIBS ${ARROW_TEST_LINK_LIBS} thrift::thrift Boost::headers)
if(APPLE)
list(APPEND PARQUET_MIN_TEST_LIBS ${CMAKE_DL_LIBS})
list(APPEND PARQUET_TEST_LINK_LIBS ${CMAKE_DL_LIBS})
elseif(NOT MSVC)
list(APPEND PARQUET_MIN_TEST_LIBS pthread ${CMAKE_DL_LIBS})
if(ARROW_ENABLE_THREADING)
list(APPEND PARQUET_TEST_LINK_LIBS Threads::Threads)
endif()
list(APPEND PARQUET_TEST_LINK_LIBS ${CMAKE_DL_LIBS})
endif()

set(PARQUET_SHARED_TEST_LINK_LIBS arrow_testing_shared parquet_shared thrift::thrift
${PARQUET_MIN_TEST_LIBS})

set(PARQUET_STATIC_TEST_LINK_LIBS ${ARROW_LIBRARIES_FOR_STATIC_TESTS} parquet_static
thrift::thrift ${PARQUET_MIN_TEST_LIBS})

#
# Generated Thrift sources
set(PARQUET_THRIFT_SOURCE_DIR "${ARROW_SOURCE_DIR}/src/generated/")
Expand Down Expand Up @@ -301,15 +296,16 @@ if(WIN32 AND NOT (ARROW_TEST_LINKAGE STREQUAL "static"))
"${PARQUET_THRIFT_SOURCE_DIR}/parquet_constants.cpp"
"${PARQUET_THRIFT_SOURCE_DIR}/parquet_types.cpp")
target_link_libraries(parquet_test_support thrift::thrift)
set(PARQUET_SHARED_TEST_LINK_LIBS ${PARQUET_SHARED_TEST_LINK_LIBS} parquet_test_support)
set(PARQUET_LIBRARIES ${PARQUET_LIBRARIES} parquet_test_support)
list(PREPEND PARQUET_SHARED_TEST_LINK_LIBS parquet_test_support)
list(APPEND PARQUET_LIBRARIES parquet_test_support)
endif()

if(NOT ARROW_BUILD_SHARED)
set(PARQUET_BENCHMARK_LINK_OPTION STATIC_LINK_LIBS benchmark::benchmark_main
${PARQUET_STATIC_TEST_LINK_LIBS})
set(PARQUET_BENCHMARK_LINK_OPTION STATIC_LINK_LIBS parquet_static
${PARQUET_TEST_LINK_LIBS} benchmark::benchmark_main)
else()
set(PARQUET_BENCHMARK_LINK_OPTION EXTRA_LINK_LIBS ${PARQUET_SHARED_TEST_LINK_LIBS})
set(PARQUET_BENCHMARK_LINK_OPTION EXTRA_LINK_LIBS parquet_shared
${PARQUET_TEST_LINK_LIBS})
endif()

if(ARROW_BUILD_STATIC AND WIN32)
Expand Down

0 comments on commit 07c0e01

Please sign in to comment.