diff --git a/CMakeLists.txt b/CMakeLists.txt index f0f101b2098..db7a19ad93a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,10 +69,15 @@ 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) + set(CMAKE_INSTALL_NAME_TOOL "${CMAKE_COMMAND} -E true") endif() enable_language(CXX) set(CMAKE_CXX_STANDARD 20)