ENH: Add more install registry options

This commit is contained in:
Andy Cedilnik 2006-04-29 20:01:34 -04:00
parent 619ebce6cf
commit de4127cdda
3 changed files with 43 additions and 3 deletions

View File

@ -262,6 +262,11 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# sure there is at least one set of four (4) backlasshes. # 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_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake") 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) SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX) ELSE(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")

View File

@ -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_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") 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() cpack_encode_variables()
CONFIGURE_FILE("${cpack_input_file}" CONFIGURE_FILE("${cpack_input_file}"
"${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE) "${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE)

View File

@ -64,7 +64,9 @@ Function .onInit
StrCmp $SV_ALLUSERS "AllUsers" 0 +2 StrCmp $SV_ALLUSERS "AllUsers" 0 +2
StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 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 FunctionEnd
;-------------------------------- ;--------------------------------
@ -378,6 +380,17 @@ FunctionEnd
!insertmacro StrStr "" !insertmacro StrStr ""
!insertmacro StrStr "un." !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 ; Define some macro setting for the gui
@ -426,7 +439,6 @@ Section "Add to path"
;Read a value from an InstallOptions INI file ;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 "NSIS.InstallOptions.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "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 StrCmp $ADD_TO_PATH "1" 0 doNotAddToPath
Call AddToPath Call AddToPath
doNotAddToPath: doNotAddToPath:
@ -445,10 +457,31 @@ Section "Installer Section" InstSection
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ 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@" \ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \
"UninstallString" "$INSTDIR\Uninstall.exe" "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 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts ;Create shortcuts