aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-08-14 12:56:20 +0100
committerfanquake <fanquake@gmail.com>2023-08-14 13:10:13 +0100
commit6c508ac3ff118902a9bc5a209913de5d72e771dd (patch)
tree89fc47ab3cfed290e88dd8bd1ee35b8eabe6dc67 /contrib
parent3654d84c6f53e5137f9208851ff904c248b4741f (diff)
parentbb3263d3e3d9f9d4db86dde679f469e7278bf737 (diff)
downloadbitcoin-6c508ac3ff118902a9bc5a209913de5d72e771dd.tar.xz
Merge bitcoin/bitcoin#28258: bitcoin-tidy: fix macOS build
bb3263d3e3d9f9d4db86dde679f469e7278bf737 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 bb3263d3e3d9f9d4db86dde679f469e7278bf737 tested with arm64 macos 13.5, llvm 16.0.6 and cmake 3.27.2 Tree-SHA512: de7bfd497f38f1565a14d217d0b057cbfa788bdda702b5942b7f0b55947ae5e1c05af13e7d6a073ed036bc4db57035868f180034508b6e084ab9b901a5baaf2f
Diffstat (limited to 'contrib')
-rw-r--r--contrib/devtools/bitcoin-tidy/CMakeLists.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/devtools/bitcoin-tidy/CMakeLists.txt b/contrib/devtools/bitcoin-tidy/CMakeLists.txt
index 9ed18696d4..35e60d1d87 100644
--- a/contrib/devtools/bitcoin-tidy/CMakeLists.txt
+++ b/contrib/devtools/bitcoin-tidy/CMakeLists.txt
@@ -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)