cmake: Apply workaround for `install_name_tool` conditionally
What changed, and why it matters
This is a build-system fix for Bitcoin Core's CMake configuration. It narrows an existing workaround so it only applies to older CMake versions. The change prevents a configuration error when cross-compiling Bitcoin for macOS from a non-Apple host, but only when using CMake versions below 4.2. There is no indication this affects running Bitcoin software or introduces a security vulnerability.
No security action required. Treat as a normal build-system maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies CMakeLists.txt to gate the CMAKE_PLATFORM_HAS_INSTALLNAME FALSE workaround on CMAKE_VERSION VERSION_LESS 4.2. Previously the workaround was applied unconditionally for Darwin cross-compiles. CMake 4.2 resolved the underlying install_name_tool detection issue (Kitware issue #27069, MR !10955), so the unconditional workaround is no longer needed and could interfere with newer CMake behavior. This is a build hygiene change, not a code-level security fix.
Changed components
CMakeLists.txt build configurationInspect captured patch +6 / −1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f992a8d6..8d5a5dd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,8 +69,13 @@ set(CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues")
#=============================
# Language setup
#=============================
-if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
+if(CMAKE_VERSION VERSION_LESS 4.2 AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
# We do not use the install_name_tool when cross-compiling for macOS.
+ # However, CMake < 4.2 still searches for Apple's version of the tool,
+ # which causes an error during configuration.
+ # See:
+ # - https://gitlab.kitware.com/cmake/cmake/-/issues/27069
+ # - https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10955
# So disable this tool check in further enable_language() commands.
set(CMAKE_PLATFORM_HAS_INSTALLNAME FALSE)
endif()
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.