Page MenuHomePhabricator

[CMake] Pass symlink dependency to add_llvm_install_targets explicitly

Authored by phosek on Dec 27 2019, 4:34 PM.



The install-${name}-stripped targets don't strip when ${name} is being
symlinked, e.g. llvm-ar or llvm-objcopy. The problem is that
llvm_install_symlink passes install-${dest} as a dependency of
install-${name}, e.g. install-llvm-ar becomes a dependency of both
install-llvm-ranlib and install-llvm-ranlib-stripped. What this means is
that when installing a distribution that contains both llvm-ar and
llvm-ranlib is that first the stripped version of llvm-ar is installed
(by the install-llvm-ar-stripped target) and then it's overwritten by an
unstripped version of llvm-ar bnecause install-llvm-ranlib-stripped has
install-llvm-ranlib as a dependency as mentioned earlier. To avoid this
issue, rather than passing the install-${dest} as dependency, we
introduce a new argument to add_llvm_install_targets for symlink target
which expands it into an appropriate dependency, i.e. install-${dest}
for install-${name} target and install-${dest}-stripped for

Diff Detail

Event Timeline

phosek created this revision.Dec 27 2019, 4:34 PM

As an alternative, I've also considered iterating over all dependencies inside add_llvm_install_targets and see if the prefix of that target is install- and handling it specially, but that seems like a more error prone solution.

This revision is now accepted and ready to land.Jan 6 2020, 2:06 PM
This revision was automatically updated to reflect the committed changes.

Sorry, was on vacation. Looks good, thanks!