Skip to content

Fix uninstallation

Karl Ehataht requested to merge kaehatah/eos:cmake_uninstall-patch into master

Fix uninstallation

When trying to uninstall my custom build I get the following error:

FAILED: CMakeFiles/uninstall eos/build-ninja/CMakeFiles/uninstall
cd eos/build-ninja && /usr/bin/cmake -P eos/build-ninja/cmake/cmake_uninstall.cmake
CMake Warning (dev) at cmake/cmake_uninstall.cmake:2:
  Syntax Warning in cmake code at column 55

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at cmake/cmake_uninstall.cmake:17 (ENDIF):
  Flow control statements are not properly nested.


CMake Error: Error processing file: eos/build-ninja/cmake/cmake_uninstall.cmake
ninja: build stopped: subcommand failed.

The culprit here is clearly cmake/cmake_uninstall.cmake.in having an incomplete IF-statement, but there's more:

  • while EXISTS returns true for symlinks, it does so only if the eventual symlink target exists. However, if the list of files considered for installation is parsed such that the symlink target is removed before the symlink, then EXISTS returns false for the symlink and it won't be removed. To protect against such cases (which in fact did happen when testing locally), one would need to pair EXISTS with IS_SYMLINK in the IF-condition;
  • EXEC_PROGRAM was deprecated a decade ago in favor of EXECUTE_PROCESS.

I've tested the proposed changes locally.

I'm marking this merge request as draft since it's not clear to me if it would be accepted without referencing a Jira ticket. I didn't bother creating one for such a small issue, but if the maintainer(s?) here think otherwise then I can of course create it.

Merge request reports

Loading