[CMake] problem with shortcut CPACK/NSIS
pellegrini
pellegrini at ill.fr
Fri Dec 7 11:06:21 EST 2012
Dear all,
I know that this issue has been raised several times but all the
solution I tried failed up to now.
We have a Fortran 90 project for which we would like to create a NSIS
installer using CPACK. When installing the software
we would like:
- the PATH to be updated with the installation path
- to set another environment variable called SXTALSOFTSUITE
- create desktop and SMP shortcuts
All the trials we did up to now to create the SXTALSOFTSUITE failed even
when using the command:
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "WriteRegStr HKCU 'Environment'
'SXTALSOFTSUITE' '$INSTDIR'")
All the trials we did to update the path failed even when using:
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "Push 'PATH'
Push 'A'
Push 'HKCU'
Push '$INSTDIR\\\\bin'
Call EnvVarUpdate
Pop '$0' ")
However, the installation process by itself worked as all the files are
present in the installation directory. I have all the rights on my
machine so it may be not a permission problem. This drives me crazy.
You will find enclosed my CPACK files. If one of you could find what is
wrong with it it would be great.
thanks in advance
Eric
-------------- next part --------------
include (InstallRequiredSystemLibraries)
# General CPACK options
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "Eric Pellegrini - Institut Laue Langevin")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
# NSIS section
if(CPACK_GENERATOR MATCHES "NSIS")
# Create the desktop link
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut '$DESKTOP\\\\sxtalsoft.lnk' '$INSTDIR\\\\bin\\\\toolbar.exe' ")
# Create the SXTALSOFTSUITE environment variable.
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " WriteRegStr HKCU 'Environment' 'SXTALSOFTSUITE' '$INSTDIR' ")
# Update the PATH at installation.
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " Push 'PATH'
Push 'A'
Push 'HKCU'
Push '$INSTDIR\\\\bin'
Call EnvVarUpdate
Pop '$0' ")
# Update the PATH at uninstallation.
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Push 'PATH'
Push 'R'
Push 'HKCU'
Push '$INSTDIR\\\\bin'
Call un.EnvVarUpdate
Pop '$0' ")
# Delete the SXTALSOFTSUITE env variable at uninstallation.
DeleteRegValue HKCU 'Environment' 'SXTALSOFTSUITE'
# Delete the Desktop link at uninstallation.
Delete '$DESKTOP\\\\sxtalsoft.lnk' ")
# The icon to start the application.
set(CPACK_NSIS_MUI_ICON "${sxtalsoft_SOURCE_DIR}/toolbar/src/rc\\\\sxtalsoft.ico")
# The icon to uninstall the application.
set(CPACK_NSIS_MUI_UNIICON "${sxtalsoft_SOURCE_DIR}/toolbar/src/rc\\\\uninstall_sxtalsoft.ico")
# The icon that appears in top of the installer dialog.
set(CPACK_PACKAGE_ICON "${sxtalsoft_SOURCE_DIR}/toolbar/src/rc\\\\sxtalsoft_64.bmp")
# Add a link to the application website in the startup menu.
set(CPACK_NSIS_MENU_LINKS "http://forge.ill.eu/projects/sxtalsoft" "Homepage for ${PROJECT_NAME}")
# The file that will be displayed in the LICENSE section of the installer.
set(CPACK_RESOURCE_FILE_LICENSE ${sxtalsoft_SOURCE_DIR}\\\\LICENSE.txt)
# Set the icon for the application in the Add/Remove programs section.
set(CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\toolbar.exe)
# The mail address for the maintainer of the application in the Add/Remove programs section
set(CPACK_NSIS_CONTACT pellegrini at ill.eu)
# The url of the application in the Add/Remove programs section
set(CPACK_NSIS_URL_INFO_ABOUT http://forge.ill.eu/projects/sxtalsoft)
endif()
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_EXECUTABLES toolbar ${PROJECT_NAME})
include(CPack)
More information about the CMake
mailing list