Skip to content

Commit f8eca4f

Browse files
authored
build: avoid duplicate libraries in the C++20 compatibility test (#1015)
1 parent 7686cfe commit f8eca4f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/iceberg/test/CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ if(ICEBERG_BUILD_HIVE)
377377
endif()
378378

379379
if(ICEBERG_CXX20_COMPAT)
380+
# De-duplicate libraries only when the linker supports it, without changing
381+
# policies for other targets or requiring a newer CMake version.
382+
cmake_policy(PUSH)
383+
if(POLICY CMP0156)
384+
cmake_policy(SET CMP0156 NEW)
385+
endif()
386+
if(POLICY CMP0179)
387+
cmake_policy(SET CMP0179 NEW)
388+
endif()
389+
380390
# Compile the public headers as a C++20 consumer. The list lives in
381391
# iceberg/cpp20_compatibility_internal.h, generated by
382392
# ci/scripts/generate_public_headers.py; headers of optional components are enabled
@@ -428,4 +438,5 @@ if(ICEBERG_CXX20_COMPAT)
428438
target_compile_options(cpp20_compatibility_test PRIVATE /bigobj /Zc:preprocessor)
429439
endif()
430440
add_test(NAME cpp20_compatibility_test COMMAND cpp20_compatibility_test)
441+
cmake_policy(POP)
431442
endif()

0 commit comments

Comments
 (0)