From d49b4a37cf1b54c52798f79419a6ea7e73c634ec Mon Sep 17 00:00:00 2001
From: Owen Arnold <owen.arnold@stfc.ac.uk>
Date: Thu, 19 Apr 2012 09:57:12 +0100
Subject: [PATCH] refs #5103. Force Uninstall added to NSIS script.

---
 Code/Mantid/Build/CMake/NSIS.template.in  | 2 ++
 Code/Mantid/Build/CMake/WindowsNSIS.cmake | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Code/Mantid/Build/CMake/NSIS.template.in b/Code/Mantid/Build/CMake/NSIS.template.in
index 25b5bd19748..82c7714fbf9 100644
--- a/Code/Mantid/Build/CMake/NSIS.template.in
+++ b/Code/Mantid/Build/CMake/NSIS.template.in
@@ -36,6 +36,8 @@
 
   ;Set compression
   SetCompressor @CPACK_NSIS_COMPRESSOR@
+  
+  SetOverwrite @CPACK_NSIS_FORCE_OVERWRITE@
 
 @CPACK_NSIS_DEFINES@   
 
diff --git a/Code/Mantid/Build/CMake/WindowsNSIS.cmake b/Code/Mantid/Build/CMake/WindowsNSIS.cmake
index be20e9e3068..dcaff89c490 100644
--- a/Code/Mantid/Build/CMake/WindowsNSIS.cmake
+++ b/Code/Mantid/Build/CMake/WindowsNSIS.cmake
@@ -14,8 +14,10 @@
 	set( CPACK_INSTALL_PREFIX "/")
 	set( CPACK_NSIS_DISPLAY_NAME "Mantid${CPACK_PACKAGE_SUFFIX}")
 	set( CPACK_PACKAGE_NAME "Mantid${CPACK_PACKAGE_SUFFIX}" )
-	set( CPACK_PACKAGE_INSTALL_DIRECTORY "MantidInstall${CPACK_PACKAGE_SUFFIX}")
+	set( CPACK_PACKAGE_INSTALL_DIRECTORY "MantidInstall${CPACK_PACKAGE_SUFFIX}") 
 	set( CPACK_NSIS_INSTALL_ROOT "C:")
+	set( CPACK_NSIS_FORCE_OVERWRITE on CACHE STRING "Force installer to overwrite any existing install")
+	set_property(CACHE CPACK_NSIS_FORCE_OVERWRITE PROPERTY STRINGS on off)
 
 	#set( CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
 	set( CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Images\\\\MantidPlot_Icon_32offset.png" )
-- 
GitLab