Make NSIS uninstaller filename (Uninstall.exe) customizable.
When we have to generate two different setup packages from the same project (modules, libraries, data-files, etc...) we want to have opportunity to install/update/delete them independently. But the later installed package would overwrite the 'Uninstall.exe'. This patch fixes the issue by customizing uninstaller name: set (CPACK_UNINSTALL_NAME "My Custom Uninstaller Name") before directive include (CPack).
This commit is contained in:
parent
bd6389f7bc
commit
e232d7ee33
|
@ -375,6 +375,7 @@ cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
|
||||||
"${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
"${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||||
cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
|
cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
|
||||||
cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
|
cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
|
||||||
|
cpack_set_if_not_set(CPACK_UNINSTALL_NAME "Uninstall")
|
||||||
|
|
||||||
# always force to exactly "true" or "false" for CPack.Info.plist.in:
|
# always force to exactly "true" or "false" for CPack.Info.plist.in:
|
||||||
if(CPACK_PACKAGE_RELOCATABLE)
|
if(CPACK_PACKAGE_RELOCATABLE)
|
||||||
|
|
|
@ -647,7 +647,7 @@ Section "-Core installation"
|
||||||
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
||||||
|
|
||||||
;Create uninstaller
|
;Create uninstaller
|
||||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
WriteUninstaller "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe"
|
||||||
Push "DisplayName"
|
Push "DisplayName"
|
||||||
Push "@CPACK_NSIS_DISPLAY_NAME@"
|
Push "@CPACK_NSIS_DISPLAY_NAME@"
|
||||||
Call ConditionalAddToRegisty
|
Call ConditionalAddToRegisty
|
||||||
|
@ -658,7 +658,7 @@ Section "-Core installation"
|
||||||
Push "@CPACK_PACKAGE_VENDOR@"
|
Push "@CPACK_PACKAGE_VENDOR@"
|
||||||
Call ConditionalAddToRegisty
|
Call ConditionalAddToRegisty
|
||||||
Push "UninstallString"
|
Push "UninstallString"
|
||||||
Push "$INSTDIR\Uninstall.exe"
|
Push "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe"
|
||||||
Call ConditionalAddToRegisty
|
Call ConditionalAddToRegisty
|
||||||
Push "NoRepair"
|
Push "NoRepair"
|
||||||
Push "1"
|
Push "1"
|
||||||
|
@ -695,7 +695,7 @@ Section "-Core installation"
|
||||||
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
||||||
@CPACK_NSIS_CREATE_ICONS@
|
@CPACK_NSIS_CREATE_ICONS@
|
||||||
@CPACK_NSIS_CREATE_ICONS_EXTRA@
|
@CPACK_NSIS_CREATE_ICONS_EXTRA@
|
||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe"
|
||||||
|
|
||||||
;Read a value from an InstallOptions INI file
|
;Read a value from an InstallOptions INI file
|
||||||
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
||||||
|
@ -834,7 +834,7 @@ Section "Uninstall"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
;Remove the uninstaller itself.
|
;Remove the uninstaller itself.
|
||||||
Delete "$INSTDIR\Uninstall.exe"
|
Delete "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe"
|
||||||
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||||
|
|
||||||
;Remove the installation directory if it is empty.
|
;Remove the installation directory if it is empty.
|
||||||
|
|
|
@ -924,7 +924,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S)
|
||||||
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
|
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
|
||||||
CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
|
CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
|
||||||
CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S)
|
CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S)
|
||||||
CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
|
#CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64) # Fails on XP SP3
|
||||||
|
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES "")
|
SET(CMAKE_REQUIRED_LIBRARIES "")
|
||||||
CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
|
CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
|
||||||
|
|
Loading…
Reference in New Issue