cmake: Provide install_name_tool stub instead of disabling it

When running `enable_language()`, CMake checks the platform-specific
toolchain components, which includes `install_name_tool` for macOS.
We disable this check when cross-compiling on Linux because
`install_name_tool` is not used and our toolchain file does not provide
it.

However, the current workaround has been breaking CMake's assumptions
since commit eb8facd39606e9472f9ff6de40d7caf76767d0da (CMake 4.1.0,
backported to 4.0.5), which causes an error during configuration using
the Ninja generator.

This change fixes this behaviour by providing a stub executable instead
of `install_name_tool`, as we currently do in the depends build
subsystem.
This commit is contained in:
Hennadii Stepanov 2026-02-14 11:17:04 +00:00
parent 80dc4359b8
commit 38a7a67126
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -77,7 +77,7 @@ if(CMAKE_VERSION VERSION_LESS 4.2 AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NO
# - 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)