diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index f30ccce388a..244f0098fdf 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -83,9 +83,25 @@ add_library(bitcoinkernel $ $ ) + +# Compiler warnings that apply only to the kernel and its dependencies. +# These can be more strict and/or warnings that only apply to shared +# libs. +add_library(kernel_warn_interface INTERFACE) +if(NOT MSVC) + try_append_cxx_flags("-Wunique-object-duplication" TARGET kernel_warn_interface SKIP_LINK) +endif() + +# Also manually apply the warnings to the kernel's internal dependencies +target_link_libraries(bitcoin_clientversion PRIVATE kernel_warn_interface) +target_link_libraries(bitcoin_crypto PRIVATE kernel_warn_interface) +target_link_libraries(leveldb PRIVATE kernel_warn_interface) +target_link_libraries(crc32c PRIVATE kernel_warn_interface) + target_link_libraries(bitcoinkernel PRIVATE core_interface + kernel_warn_interface secp256k1_objs $<$:bcrypt> $