[Cmake-commits] CMake branch, next, updated. v2.8.8-2666-g42d1169

David Cole david.cole at kitware.com
Sun Apr 22 11:57:24 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  42d1169eaff4ec041c13931229999331e8f7e763 (commit)
       via  fe58b67e24d007cb7dcd7005073a37bfba21737d (commit)
      from  cfc532f46abca50d2009564037cbbcad23aa4266 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42d1169eaff4ec041c13931229999331e8f7e763
commit 42d1169eaff4ec041c13931229999331e8f7e763
Merge: cfc532f fe58b67
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Sun Apr 22 11:57:10 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Apr 22 11:57:10 2012 -0400

    Merge topic 'fix-9946-uninstall-before-install' into next
    
    fe58b67 Added CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe58b67e24d007cb7dcd7005073a37bfba21737d
commit fe58b67e24d007cb7dcd7005073a37bfba21737d
Author:     Patrick Gansterer <paroga at paroga.com>
AuthorDate: Sat Jun 11 12:14:56 2011 +0200
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Sun Apr 22 11:30:34 2012 -0400

    Added CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL
    
    If CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL is set to ON the NSIS installer will look for a previous installed version and ask the user about uninstall.

diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 571770e..707a991 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -341,6 +341,10 @@ cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
 
 cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
 
+IF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
+  SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
+ENDIF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
+
 IF(CPACK_NSIS_MODIFY_PATH)
   SET(CPACK_NSIS_MODIFY_PATH ON)
 ENDIF(CPACK_NSIS_MODIFY_PATH)
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
index 5e2ba17..e34f782 100644
--- a/Modules/CPackNSIS.cmake
+++ b/Modules/CPackNSIS.cmake
@@ -46,6 +46,14 @@
 ##end
 #
 ##variable
+#   CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL - Ask about uninstalling
+#   previous versions first.
+#   If this is set to "ON", then an installer will look for previous
+#   installed versions and if one is found, ask the user whether to
+#   uninstall it before proceeding with the install.
+##end
+#
+##variable
 #   CPACK_NSIS_MODIFY_PATH - Modify PATH toggle.
 #   If this is set to "ON", then an extra page
 #   will appear in the installer that will allow the user to choose
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index 819cc5c..d4f5964 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -899,6 +899,28 @@ SectionEnd
 ; "Program Files" for AllUsers, "My Documents" for JustMe...
 
 Function .onInit
+  StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
+
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "UninstallString"
+  StrCmp $0 "" inst
+
+  MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
+  "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
+  IDYES uninst IDNO inst
+  Abort
+
+;Run the uninstaller
+uninst:
+  ClearErrors
+  ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
+
+  IfErrors uninst_failed inst
+uninst_failed:
+  MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
+  Abort
+
+
+inst:
   ; Reads components status for registry
   !insertmacro SectionList "InitSection"
 

-----------------------------------------------------------------------

Summary of changes:
 Modules/CPack.cmake      |    4 ++++
 Modules/CPackNSIS.cmake  |    8 ++++++++
 Modules/NSIS.template.in |   22 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list