0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

Merge bitcoin/bitcoin#28258: bitcoin-tidy: fix macOS build

bb3263d3e3 bitcoin-tidy: fix macOS build (Cory Fields)

Pull request description:

  [LLVM uses these options](https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/HandleLLVMOptions.cmake#L178) for building as well, so there's precedent.

  Also fix the shared library extension which was incorrectly being set to dylib.

  Thanks to jonatack for reporting and debugging.

ACKs for top commit:
  jonatack:
    ACK bb3263d3e3 tested with arm64 macos 13.5, llvm 16.0.6 and cmake 3.27.2

Tree-SHA512: de7bfd497f38f1565a14d217d0b057cbfa788bdda702b5942b7f0b55947ae5e1c05af13e7d6a073ed036bc4db57035868f180034508b6e084ab9b901a5baaf2f
This commit is contained in:
fanquake 2023-08-14 12:56:20 +01:00
commit 6c508ac3ff
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -25,6 +25,12 @@ else()
target_compile_options(bitcoin-tidy PRIVATE -fno-exceptions)
endif()
if(CMAKE_HOST_APPLE)
# ld64 expects no undefined symbols by default
target_link_options(bitcoin-tidy PRIVATE -Wl,-flat_namespace)
target_link_options(bitcoin-tidy PRIVATE -Wl,-undefined -Wl,suppress)
endif()
# Add warnings
if (MSVC)
target_compile_options(bitcoin-tidy PRIVATE /W4)
@ -33,7 +39,12 @@ else()
target_compile_options(bitcoin-tidy PRIVATE -Wextra)
endif()
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}bitcoin-tidy${CMAKE_SHARED_LIBRARY_SUFFIX}" "-checks=-*,bitcoin-*")
if(CMAKE_VERSION VERSION_LESS 3.27)
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=${CMAKE_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}bitcoin-tidy${CMAKE_SHARED_MODULE_SUFFIX}" "-checks=-*,bitcoin-*")
else()
# CLANG_TIDY_COMMAND supports generator expressions as of 3.27
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=$<TARGET_FILE:bitcoin-tidy>" "-checks=-*,bitcoin-*")
endif()
# Create a dummy library that runs clang-tidy tests as a side-effect of building
add_library(bitcoin-tidy-tests OBJECT EXCLUDE_FROM_ALL example_logprintf.cpp)