Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAntenore Gatta (tmow) <antenore@simbiosi.org>2021-07-15 00:13:56 +0300
committerAntenore Gatta (tmow) <antenore@simbiosi.org>2021-07-15 00:13:56 +0300
commitc6d31ec5b5535be3b707cf964ce3379f32fc6416 (patch)
tree86caa393715db725d54e4c1952bb43652a260f65 /cmake
parent433a113ab690bf4e08eb1e71ac146eba08698c28 (diff)
Improved uninstall target. Amend #2314
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cmake_uninstall.cmake.in94
1 files changed, 54 insertions, 40 deletions
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
index 09bff1867..c780c8d7b 100644
--- a/cmake/cmake_uninstall.cmake.in
+++ b/cmake/cmake_uninstall.cmake.in
@@ -1,24 +1,27 @@
# 'delete_empty_folder' function
function(delete_empty_folder DIR)
- if(NOT EXISTS ${DIR})
- return()
- endif()
-
- # check if folder is empty
- file(GLOB RESULT "${DIR}/*")
- list(LENGTH RESULT RES_LEN)
- if(RES_LEN EQUAL 0)
- message(STATUS "Delete empty folder ${DIR}")
- #file(REMOVE_RECURSE ${DIR})
- else()
- # message(STATUS "${DIR} is not empty! It won't be removed.")
- # message(STATUS "FILES = ${RESULT}")
- endif()
+ if(NOT EXISTS ${DIR})
+ return()
+ endif()
+
+ # check if folder is empty
+ file(GLOB RESULT "${DIR}/*")
+ list(LENGTH RESULT RES_LEN)
+ if(RES_LEN EQUAL 0)
+ if(WITH_CLEANUP)
+ message(STATUS "Deleting empty folder ${DIR}")
+ file(REMOVE_RECURSE ${DIR})
+ else()
+ message(STATUS " ${DIR}")
+ endif()
+ else()
+ #message(STATUS "${DIR} is not empty! It won't be removed.")
+ # message(STATUS "FILES = ${RESULT}")
+ endif()
endfunction(delete_empty_folder)
-
if( NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
- message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif( NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
file( READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
@@ -26,43 +29,54 @@ string( REGEX REPLACE "\n" ";" files "${files}" )
foreach(file ${files})
- message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
- if(EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ if(EXISTS "$ENV{DESTDIR}${file}")
- exec_program( "@CMAKE_COMMAND@"
- ARGS "-E remove \"$ENV{DESTDIR}${file}\""
- OUTPUT_VARIABLE rm_out
- RETURN_VALUE rm_retval
- )
- if( NOT "${rm_retval}" STREQUAL 0 )
- message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" )
- endif( NOT "${rm_retval}" STREQUAL 0 )
+ exec_program( "@CMAKE_COMMAND@"
+ ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if( NOT "${rm_retval}" STREQUAL 0 )
+ message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" )
+ endif( NOT "${rm_retval}" STREQUAL 0 )
- else(EXISTS "$ENV{DESTDIR}${file}")
+ else(EXISTS "$ENV{DESTDIR}${file}")
- message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
+ message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
- endif(EXISTS "$ENV{DESTDIR}${file}")
+ endif(EXISTS "$ENV{DESTDIR}${file}")
-
- get_filename_component(FOLDER $ENV{DESTDIR}${file} DIRECTORY)
- set(FOLDERS ${FOLDERS} ${FOLDER})
+ get_filename_component(FOLDER $ENV{DESTDIR}${file} DIRECTORY)
+ set(FOLDERS ${FOLDERS} ${FOLDER})
endforeach(file)
# remove empty folders
message(STATUS "")
-message(STATUS "Removing empty folders")
+if(WITH_CLEANUP)
+ message(STATUS "Removing empty folders")
+else()
+ message(STATUS "Empty folders that may be safely removed:")
+endif()
+
+list(APPEND FOLDERS
+ "@INSTALL_LIB_DIR@/CMake"
+ "@CMAKE_INSTALL_FULL_LIBDIR@/remmina"
+ "@REMMINA_DATADIR@/remmina"
+ )
list(REMOVE_DUPLICATES FOLDERS)
foreach(dir ${FOLDERS})
-# message(STATUS ${dir})
- delete_empty_folder(${dir})
-# message(STATUS "")
+ # message(STATUS ${dir})
+ delete_empty_folder(${dir})
+ # message(STATUS "")
endforeach(dir)
-delete_empty_folder("@INSTALL_INCLUDE_DIR@")
-delete_empty_folder("@INSTALL_BIN_DIR@")
-delete_empty_folder("@INSTALL_LIB_DIR@/CMake")
-delete_empty_folder("@INSTALL_LIB_DIR@")
+# delete_empty_folder("@INSTALL_INCLUDE_DIR@")
+# delete_empty_folder("@INSTALL_BIN_DIR@")
+# delete_empty_folder("@INSTALL_LIB_DIR@/CMake")
+# delete_empty_folder("@INSTALL_LIB_DIR@")
+# delete_empty_folder("@CMAKE_INSTALL_FULL_LIBDIR@/remmina")
+# delete_empty_folder("@REMMINA_DATADIR@/remmina")
message(STATUS "")