Skip to content

Commit 3855012

Browse files
authored
fix: macos ci warning ignore duplicate libraries (#346)
`add_iceberg_test` will link the test to `iceberg_static`. `iceberg_rest_static` has also been linked to `iceberg_static`. So there are duplicate libraries.
1 parent 52b9c5e commit 3855012

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/iceberg/test/CMakeLists.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,28 @@ if(ICEBERG_BUILD_BUNDLE)
164164
endif()
165165

166166
if(ICEBERG_BUILD_REST)
167-
add_iceberg_test(rest_catalog_test SOURCES rest_catalog_test.cc
168-
rest_json_internal_test.cc)
169-
target_link_libraries(rest_catalog_test PRIVATE iceberg_rest_static)
167+
function(add_rest_iceberg_test test_name)
168+
set(options USE_BUNDLE)
169+
set(oneValueArgs)
170+
set(multiValueArgs SOURCES)
171+
cmake_parse_arguments(ARG
172+
"${options}"
173+
"${oneValueArgs}"
174+
"${multiValueArgs}"
175+
${ARGN})
176+
177+
add_executable(${test_name})
178+
target_include_directories(${test_name} PRIVATE "${CMAKE_BINARY_DIR}/iceberg/test/")
179+
180+
target_sources(${test_name} PRIVATE ${ARG_SOURCES})
181+
182+
target_link_libraries(${test_name} PRIVATE GTest::gtest_main GTest::gmock
183+
iceberg_rest_static)
184+
185+
add_test(NAME ${test_name} COMMAND ${test_name})
186+
endfunction()
187+
188+
add_rest_iceberg_test(rest_catalog_test SOURCES rest_catalog_test.cc
189+
rest_json_internal_test.cc)
170190
target_include_directories(rest_catalog_test PRIVATE ${cpp-httplib_SOURCE_DIR})
171191
endif()

0 commit comments

Comments
 (0)