From 710a0bb52fa0b30874917e1a785448deb64ba3dc Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 15 Dec 2024 15:54:35 +0000 Subject: [PATCH] cmake: De-duplicate libraries on link lines opportunistically This change resolves "ignoring duplicate libraries" linker warnings on macOS. --- src/test/CMakeLists.txt | 6 ++++++ src/test/fuzz/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index ed73e449015..da671d9606d 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -14,6 +14,12 @@ generate_header_from_json(data/tx_invalid.json) generate_header_from_json(data/tx_valid.json) generate_header_from_raw(data/asmap.raw test::data) +if(POLICY CMP0156) + # De-duplicate libraries on link lines based on linker capabilities. + # See: https://cmake.org/cmake/help/latest/policy/CMP0156.html + cmake_policy(SET CMP0156 NEW) +endif() + # Do not use generator expressions in test sources because the # SOURCES property is processed to gather test suite macros. add_executable(test_bitcoin diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index f65ed62b2d0..5353aa68904 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -4,6 +4,12 @@ add_subdirectory(util) +if(POLICY CMP0156) + # De-duplicate libraries on link lines based on linker capabilities. + # See: https://cmake.org/cmake/help/latest/policy/CMP0156.html + cmake_policy(SET CMP0156 NEW) +endif() + add_executable(fuzz addition_overflow.cpp addrman.cpp