Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added uninstall cmake target #694

Merged
merged 4 commits into from
Nov 23, 2023
Merged

Added uninstall cmake target #694

merged 4 commits into from
Nov 23, 2023

Conversation

jesper-friis
Copy link
Collaborator

Description

Added a uninstall cmake target, making it easy to uninstall dlite when it is installed with cmake. Just do

make uninstall

or with cmake

cmake --build . --target uninstall

This is simply a slightly adapted copy of the recipe from the public cmake documentation: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake

Type of change

  • Bug fix & code cleanup
  • New feature
  • Documentation update
  • Test update

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

Copy link
Collaborator

@francescalb francescalb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work for me, I can still import dlite after having run either of

cmake --build . --target uninstall or make uninstall

I am working in an environment and everything is still in the environement. Deactivating and reactivating does not change anything either.

@jesper-friis
Copy link
Collaborator Author

Does not work for me, I can still import dlite after having run either of

cmake --build . --target uninstall or make uninstall

I am working in an environment and everything is still in the environement. Deactivating and reactivating does not change anything either.

You are right, it didn't removed directories. It seems that cmake doesn't record installed directories.

To also uninstall directories, I added some extra code lines that after all installed files are removed check the parent directory of the installed files. If the directory is empty, it is removed.

This should have the expected behaviour in almost all cases, but could potential remove an empty directory in the installation path that existed before dlite was installed.

Copy link
Collaborator

@francescalb francescalb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work nicely.

@jesper-friis jesper-friis merged commit 3901c72 into master Nov 23, 2023
@jesper-friis jesper-friis deleted the make-uninstall branch November 23, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants