views:

487

answers:

3

I'm using NSIS package generator in CMake 2.8.1 to distribute a Qt application. Everything is working fine... except the use of CPACK_CREATE_DESKTOP_LINKS to create a desktop link to the application.

I've looked through the CMake source (including it's own "bootstrap" installation definition for windows), and as far as I can tell I'm doing the same thing.

Here's the relevant section of my CMakeLists.txt file.


set(CPACK_GENERATOR NSIS)
set(CPACK_NSIS_PACKAGE_NAME "${EWS_APP_NAME}")
set(CPACK_NSIS_DISPLAY_NAME "${EWS_APP_NAME}")
set(CPACK_NSIS_CONTACT "${EWS_EMAIL}")
set(CPACK_PACKAGE_EXECUTABLES "${EXE_TARGET_NAME}" "${EWS_APP_NAME}")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${EWS_VERSION}")

# this works
set(CPACK_NSIS_MENU_LINKS "${EWS_WEBSITE}" "Homepage for ${EWS_APP_NAME}")

# this doesn't
set(CPACK_CREATE_DESKTOP_LINKS "${EXE_TARGET_NAME}")

# Icon in the add/remove control panel. Must be an .exe file 
set(CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${EXE_TARGET_NAME}.exe)

set(CPACK_NSIS_URL_INFO_ABOUT "${EWS_WEBSITE}")
set(CPACK_NSIS_HELP_LINK "${EWS_WEBSITE}")

Any ideas or debugging tips are appreciated!

A: 

One work-around I figured out is to use CPACK_NSIS_EXTRA_INSTALL_COMMANDS and CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS to insert the link creation/deletion commands directly.

set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
    CreateShortCut \\\"$DESKTOP\\\\${EWS_APP_NAME}.lnk\\\" \\\"$INSTDIR\\\\bin\\\\${EXE_TARGET_NAME}.exe\\\"
")

set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
    Delete \\\"$DESKTOP\\\\${EWS_APP_NAME}.lnk\\\"
")

I'd much rather use the more general (and cross-platform?) CPACK_CREATE_DESKTOP_LINKS setting, so any followup ideas are appreciated. But this works in a pinch.

Simeon Fitch
A: 

You most likely don't need to quote ${EXE_TARGET_NAME} as it is a string.

RobertJMaynard
True enough (just a habit on my part), but doesn't affect the result.
Simeon Fitch
+1  A: 

try adding this to your CMakeLists.txt:

set (CPACK_NSIS_MODIFY_PATH "ON")

I think that should add a page after the license that gives the option to add the install directory to the path, and add an option to create desktop links.

choobablue

related questions