From de4127cdda9dd7effc3d16fc8a1b0c1c9711308b Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Sat, 29 Apr 2006 20:01:34 -0400 Subject: ENH: Add more install registry options --- CMakeLists.txt | 5 +++++ Modules/CPack.cmake | 2 ++ Modules/NSIS.template.in | 39 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b29f1cf..a3e3b8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,6 +262,11 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # sure there is at least one set of four (4) backlasshes. SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp") SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake") + SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CMakeSetup.exe") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} a cross-platform, open-source build system") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cmake.org") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.kitware.com") + SET(CPACK_NSIS_CONTACT "cmake@cmake.org") SET(CPACK_NSIS_MODIFY_PATH ON) ELSE(WIN32 AND NOT UNIX) SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 25785a0..d5e9b41 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -101,6 +101,8 @@ cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") +cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "@CPACK_PACKAGE_INSTALL_DIRECTORY@") + cpack_encode_variables() CONFIGURE_FILE("${cpack_input_file}" "${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index b2d69bd..b910a3e 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -64,7 +64,9 @@ Function .onInit StrCmp $SV_ALLUSERS "AllUsers" 0 +2 StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + noOptionsPage: FunctionEnd ;-------------------------------- @@ -378,6 +380,17 @@ FunctionEnd !insertmacro StrStr "" !insertmacro StrStr "un." +Function ConditionalAddToRegisty + Pop $0 + Pop $1 + StrCmp "$0" "" ConditionalAddToRegisty_EmptyString + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + "$1" "$0" + ;MessageBox MB_OK "Set Registry: '$1' to '$0'" + DetailPrint "Set install registry entry: '$1' to '$0'" + ConditionalAddToRegisty_EmptyString: +FunctionEnd + ;-------------------------------- ; Define some macro setting for the gui @@ -426,7 +439,6 @@ Section "Add to path" ;Read a value from an InstallOptions INI file !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - ;StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 +2 StrCmp $ADD_TO_PATH "1" 0 doNotAddToPath Call AddToPath doNotAddToPath: @@ -445,10 +457,31 @@ Section "Installer Section" InstSection ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ - "DisplayName" "@CPACK_PACKAGE_INSTALL_DIRECTORY@ -- @CPACK_PACKAGE_DESCRIPTION_SUMMARY@" + "DisplayName" "@CPACK_NSIS_DISPLAY_NAME@" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + "DisplayVersion" "@CPACK_PACKAGE_VERSION@" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + "Publisher" "@CPACK_PACKAGE_VENDOR@" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ "UninstallString" "$INSTDIR\Uninstall.exe" + ; Optional registration + Push "DisplayIcon" + Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" + Call ConditionalAddToRegisty + Push "HelpLink" + Push "@CPACK_NSIS_HELP_LINK@" + Call ConditionalAddToRegisty + Push "URLInfoAbout" + Push "@CPACK_NSIS_URL_INFO_ABOUT@" + Call ConditionalAddToRegisty + Push "Contact" + Push "@CPACK_NSIS_CONTACT@" + Call ConditionalAddToRegisty + Push "FooBar" + Push "" + Call ConditionalAddToRegisty + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Create shortcuts -- cgit v0.12