changeset 11915:6774402ac28d

Add support for uninstall in windows Files installed in the INSTALL target are uninstalled.
author Mythreyi P
date Mon, 13 Nov 2017 10:47:48 +0530
parents 54d8990badc7
children 6ac1b12bcde9
files source/CMakeLists.txt source/cmake/cmake_uninstall.cmake.in
diffstat 2 files changed, 14 insertions(+-), 0 deletions(-) [+]
line wrap: on
line diff
--- a/source/CMakeLists.txt	Fri Nov 10 11:46:13 2017 +0530
+++ b/source/CMakeLists.txt	Mon Nov 13 10:47:48 2017 +0530
@@ -725,3 +725,13 @@ if(hasParent)
         set(PLATFORM_LIBS ${PLATFORM_LIBS} PARENT_SCOPE)
     endif(PLATFORM_LIBS)
 endif(hasParent)
+
+# uninstall target
+if(NOT TARGET UNINSTALL)
+    configure_file(
+        "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+        "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+        IMMEDIATE @ONLY)
+    add_custom_target(UNINSTALL
+        COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+endif()
--- a/source/cmake/cmake_uninstall.cmake.in	Fri Nov 10 11:46:13 2017 +0530
+++ b/source/cmake/cmake_uninstall.cmake.in	Mon Nov 13 10:47:48 2017 +0530
@@ -17,3 +17,7 @@ foreach(file ${files})
         message(STATUS "File '$ENV{DESTDIR}${file}' does not exist.")
     endif()
 endforeach(file)
+
+if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
+    file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
+endif()