Skip to content

cmake: Preserve symlinks in references to itself when possible

rcombs requested to merge rcombs/cmake:brew-symlinks into master

This functionality was originally added in cae34d2d, over 10 years ago. It's unclear what the original goal was, but today, it results in headaches for Homebrew users, who have to manually re-run CMake on all projects whenever the package is updated, since Homebrew installs CMake into a versioned directory and symlinks its files.

In the new behavior, we check if the path that we're currently running CMake from is suitable by looking for a /Modules/CMake.cmake file in the data directory. If this is present, we assume that any symlinks in our path are part of some versioning scheme (like Homebrew's) and leave them unresolved. If not, we return to the old behavior. This way, upgrades with Homebrew and other version-prefixing package managers will behave the same as upgrades with non-versioning package managers.

Topic-rename: cmake-self-symlinks

Edited by Brad King

Merge request reports