-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adding an uninstall target to CMake #22
Comments
I tried to add such code copied from gtk-fortran (but I did not pushed it on GitHub). The problem is that when I try to uninstall ForColormap, CMake is looking also for the ForImage forcolormap/build (main)$ sudo make uninstall
CMake Error at cmake/cmake_uninstall.cmake:2 (message):
Cannot find install manifest: "forcolormap/build/_deps/forimage-build/install_manifest.txt"
make[3]: *** [_deps/forimage-build/CMakeFiles/uninstall.dir/build.make:70 : _deps/forimage-build/CMakeFiles/uninstall] Erreur 1
make[2]: *** [CMakeFiles/Makefile2:254 : _deps/forimage-build/CMakeFiles/uninstall.dir/all] Erreur 2
make[1]: *** [CMakeFiles/Makefile2:261 : _deps/forimage-build/CMakeFiles/uninstall.dir/rule] Erreur 2
make: *** [Makefile:195 : uninstall] Erreur 2 The forcolormap (main)$ cat build/install_manifest.txt
/usr/local/lib/libforimage.so.0.3.0
/usr/local/lib/libforimage.so.0
/usr/local/lib/libforimage.so
/usr/local/include/lut.mod
/usr/local/include/pnm.mod
/usr/local/include/forimage_parameters.mod
/usr/local/include/forcolor.mod
/usr/local/include/forimage.mod
/usr/local/lib/cmake/forimage/forimageTargets.cmake
/usr/local/lib/cmake/forimage/forimageTargets-release.cmake
/usr/local/lib/cmake/forimage/forimageConfig.cmake
/usr/local/lib/cmake/forimage/forimageConfigVersion.cmake
/usr/local/lib/pkgconfig/forimage.pc
/usr/local/lib/libforcolormap.so.0.8.0
/usr/local/lib/libforcolormap.so.0
/usr/local/lib/libforcolormap.so
/usr/local/include/miscellaneous_colormaps.mod
/usr/local/include/matplotlib_colormaps.mod
/usr/local/include/colormap_parameters.mod
/usr/local/include/forcolormap.mod
/usr/local/include/forcolormap_info.mod
/usr/local/include/scientific_colour_maps.mod
/usr/local/lib/cmake/forcolormap/forcolormapTargets.cmake
/usr/local/lib/cmake/forcolormap/forcolormapTargets-release.cmake
/usr/local/lib/cmake/forcolormap/forcolormapConfig.cmake
/usr/local/lib/cmake/forcolormap/forcolormapConfigVersion.cmake |
The issue arises from assigning the same name to the CMake target add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake) I suggest using distinct custom target names. For instance, you may consider using |
I don't know if this is a problem or if it's intentional: I believe it is correct because it removes all installed libraries and dependencies. If someone wants to have ForImage, they must install ForImage again! |
The ideal approach would be to have |
Thanks Ali, I will try the name |
Indeed, we have both libraries in the same |
My apologies, it was my mistake. There is no issue; the functionality is correct! |
I have pushed the CMake uninstall functionality: $ sudo make uninstall_forcolormap
-- Uninstalling /usr/local/lib/libforimage.so.0.3.0
-- Uninstalling /usr/local/lib/libforimage.so.0
-- Uninstalling /usr/local/lib/libforimage.so
-- Uninstalling /usr/local/include/forimage.mod
-- Uninstalling /usr/local/include/forimage_parameters.mod
-- Uninstalling /usr/local/include/forcolor.mod
-- Uninstalling /usr/local/include/lut.mod
-- Uninstalling /usr/local/include/pnm.mod
-- Uninstalling /usr/local/lib/cmake/forimage/forimageTargets.cmake
-- Uninstalling /usr/local/lib/cmake/forimage/forimageTargets-release.cmake
-- Uninstalling /usr/local/lib/cmake/forimage/forimageConfig.cmake
-- Uninstalling /usr/local/lib/cmake/forimage/forimageConfigVersion.cmake
-- Uninstalling /usr/local/lib/pkgconfig/forimage.pc
-- Uninstalling /usr/local/lib/libforcolormap.so.0.8.0
-- Uninstalling /usr/local/lib/libforcolormap.so.0
-- Uninstalling /usr/local/lib/libforcolormap.so
-- Uninstalling /usr/local/include/forcolormap_info.mod
-- Uninstalling /usr/local/include/forcolormap.mod
-- Uninstalling /usr/local/include/colormap_parameters.mod
-- Uninstalling /usr/local/include/matplotlib_colormaps.mod
-- Uninstalling /usr/local/include/miscellaneous_colormaps.mod
-- Uninstalling /usr/local/include/scientific_colour_maps.mod
-- Uninstalling /usr/local/lib/cmake/forcolormap/forcolormapTargets.cmake
-- Uninstalling /usr/local/lib/cmake/forcolormap/forcolormapTargets-release.cmake
-- Uninstalling /usr/local/lib/cmake/forcolormap/forcolormapConfig.cmake
-- Uninstalling /usr/local/lib/cmake/forcolormap/forcolormapConfigVersion.cmake
-- Uninstalling /usr/local/lib/pkgconfig/forcolormap.pc
Built target uninstall_forcolormap And I have added in the README.md a comment about the consequences for ForImage. I don't know the best way to separate ForImage/ForColormap uninstall, but note that file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
... It would be (relatively) easy to add a test to avoid removing files whose path contains |
I think this is good for now. |
(I have also moved all CMake-related directories for ForImage, including |
Thanks @gha3mi , I have now also moved |
Originally posted by @gha3mi in #21 (comment)
The text was updated successfully, but these errors were encountered: