From e232d7ee338a3f766ec9a5a619bf2b21324005a3 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Thu, 31 Jan 2013 15:05:14 +0400 Subject: [PATCH] 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). --- Modules/CPack.cmake | 1 + Modules/NSIS.template.in | 8 ++++---- Utilities/cmlibarchive/CMakeLists.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 35259c493..871703430 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -375,6 +375,7 @@ cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_INSTALL_DIRECTORY}") cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/") 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: if(CPACK_PACKAGE_RELOCATABLE) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 76310af31..e41359932 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -647,7 +647,7 @@ Section "-Core installation" WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteUninstaller "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe" Push "DisplayName" Push "@CPACK_NSIS_DISPLAY_NAME@" Call ConditionalAddToRegisty @@ -658,7 +658,7 @@ Section "-Core installation" Push "@CPACK_PACKAGE_VENDOR@" Call ConditionalAddToRegisty Push "UninstallString" - Push "$INSTDIR\Uninstall.exe" + Push "$INSTDIR\@CPACK_UNINSTALL_NAME@.exe" Call ConditionalAddToRegisty Push "NoRepair" Push "1" @@ -695,7 +695,7 @@ Section "-Core installation" CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" @CPACK_NSIS_CREATE_ICONS@ @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 !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" @@ -834,7 +834,7 @@ Section "Uninstall" !endif ;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@" ;Remove the installation directory if it is empty. diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index f1459d455..d0705094d 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -924,7 +924,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) 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 "") CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)