CPack/NSIS: Uninstall not working if CPACK_NSIS_UNINSTALL_NAME is used to set it to something else than Uninstall.exe.
CMake NSIS uninstall not working if CPACK_NSIS_UNINSTALL_NAME is used to set it to something else than Uninstall.exe.
The reason is simply that this code in NSIS.template.in contains hardcoded "Uninstall.exe"
;Run the uninstaller
uninst:
ClearErrors
StrLen $2 "\Uninstall.exe"
StrCpy $3 $0 -$2 # remove "\Uninstall.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:
MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
Abort
Should probably be:
;Run the uninstaller
uninst:
ClearErrors
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:
MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
Abort
Edited by Brad King