We stopped using install_name_tool in 3bee51427a05075150721f0a05ead8f92e1ba019 (https://github.com/bitcoin/bitcoin/pull/29890), which required a CMake-specific hack:https://github.com/bitcoin/bitcoin/blob/b65ff0e5a1fd4ea2ae75e204729b8008c4ebb9ab/CMakeLists.txt#L72-L76
Due to recent changes in CMake, this hack has become problematic for the following reasons:
-
It is no longer needed when using CMake 4.2 or newer. See upstream [Issue #27069](https://gitlab.kitware.com/cmake/cmake/-/issues/27069) and [MR #10955](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10955).
-
It causes an issue when using CMake 4.0.5 or newer. See upstream [Issue #26814](https://gitlab.kitware.com/cmake/cmake/-/issues/26814) and [MR #10721](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10721).
This PR addresses both of these issues. Please see the individual commits for more details.
Fixes #34513.