summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-11 13:48:19 +0000
committerKitware Robot <kwrobot@kitware.com>2022-10-11 09:48:37 -0400
commite32b49e4defadc45c188c32d0f173b6de403e6dc (patch)
treec01b16b3b14dac858705132aa1d3fd6ea74bd876 /Modules
parente21071ec4b2b46add5416eb1abeb8b6fbd7fddc6 (diff)
parent8721658959cb0bef39ea9e0f34532ff5dc7c5276 (diff)
downloadcmake-e32b49e4defadc45c188c32d0f173b6de403e6dc.tar.gz
Merge topic 'cpack-nsis-uninstaller'
8721658959 CPack/NSIS: Fix installer not waiting for uninstaller to finish Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7774
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Internal/CPack/NSIS.template.in19
1 files changed, 14 insertions, 5 deletions
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 42a44d96c6..21753afe77 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -931,11 +931,20 @@ Function .onInit
;Run the uninstaller
uninst:
ClearErrors
- StrCpy $2 $0 1
- StrCmp '"' $2 0 +3 ; checks if string is quoted (CPack before v3.20.6 did not quote it)
- ExecWait '$0 /S'
- Goto +2
- ExecWait '"$0" /S'
+ # $0 should _always_ be quoted, however older versions of CMake did not
+ # do this. We'll conditionally remove the begin/end quotes.
+ # Remove first char if quote
+ StrCpy $2 $0 1 0 # copy first char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 "" 1 # remove first char
+ # Remove last char if quote
+ StrCpy $2 $0 1 -1 # copy last char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 -1 # remove last char
+
+ StrLen $2 "\@CPACK_NSIS_UNINSTALL_NAME@.exe"
+ StrCpy $3 $0 -$2 # remove "\@CPACK_NSIS_UNINSTALL_NAME@.exe" from UninstallString to get path
+ ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
IfErrors uninst_failed inst
uninst_failed: