Merge topic 'fix-9148-cpack-nsis-installer-root'

5a9e8e7 CPack: Add CPACK_NSIS_INSTALL_ROOT variable (#9148)
This commit is contained in:
Brad King 2011-01-11 15:48:34 -05:00 committed by CMake Topic Stage
commit b524f864ca
3 changed files with 16 additions and 3 deletions

View File

@ -210,6 +210,11 @@
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
# installing this project. # installing this project.
# #
# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented
# to the end user by the NSIS installer is under this root dir. The full
# directory presented to the end user is:
# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
#
# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated
# install program. # install program.
# #
@ -785,6 +790,11 @@ IF(${__cpack_system_name} MATCHES Windows)
ENDIF(${__cpack_system_name} MATCHES Windows) ENDIF(${__cpack_system_name} MATCHES Windows)
cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
set(__cpack_root_default "$PROGRAMFILES")
cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype> # <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")

View File

@ -25,7 +25,7 @@
!include "MUI.nsh" !include "MUI.nsh"
;Default installation folder ;Default installation folder
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
;-------------------------------- ;--------------------------------
;General ;General
@ -907,7 +907,7 @@ Function .onInit
; install directory that is expected to be the ; install directory that is expected to be the
; default ; default
StrCpy $IS_DEFAULT_INSTALLDIR 0 StrCpy $IS_DEFAULT_INSTALLDIR 0
StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
StrCpy $IS_DEFAULT_INSTALLDIR 1 StrCpy $IS_DEFAULT_INSTALLDIR 1
StrCpy $SV_ALLUSERS "JustMe" StrCpy $SV_ALLUSERS "JustMe"
@ -940,7 +940,7 @@ Function .onInit
done: done:
StrCmp $SV_ALLUSERS "AllUsers" 0 +3 StrCmp $SV_ALLUSERS "AllUsers" 0 +3
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"

View File

@ -78,6 +78,9 @@ set(CPACK_NSIS_MENU_LINKS
"news://newsserver" "Test News Link" "news://newsserver" "Test News Link"
) )
# Suggested default root for end users of the installer:
set(CPACK_NSIS_INSTALL_ROOT "C:\\Program Files\\CMake Tests Install Root")
# Include CPack to introduce the appropriate targets # Include CPack to introduce the appropriate targets
include(CPack) include(CPack)