Start menu and desktop shortcuts with Wix


I needed to add desktop and start menu shortcuts to an installer using CPack and Wix and realized that the documentation is pretty bad. So I checked out CPack source code and found out the solution is easy:

Also, I noticed that the documentation of CPACK_PACKAGE_EXECUTABLES and CPACK_CREATE_DESKTOP_LINKS is misleading.

Since it is a very common requirement, I think the documentation should be updated. Or did I miss something?


Please elaborate on what is misleading so that we have the information in one place.

For primarily my own reference, this older article of mine about the NSIS generator mentions that one problem with CPACK_PACKAGE_EXECUTABLES is that you can’t specify command line arguments for those executables. This limits its usefulness. That article doesn’t mention WiX though.

Hi Craig,

I could not get CPACK_CREATE_DESKTOP_LINKS to work with Wix. Then I looked at the source code (Source/CPack/WiX/cmWIXShortcut.cxx) and found out about CPACK_DESKTOP_SHORTCUTS and got it quickly working. So I assumed that CPACK_CREATE_DESKTOP_LINKS was not relevant in my case. Was it?
Maybe a working example with CPACK_CREATE_DESKTOP_LINKS and Wix would help, or more info in the documentation. From my perspective, both are overlapping, and from the documentation, it is not clear what kind of values to pass to CPACK_CREATE_DESKTOP_LINKS. It is much clearer with CPACK_DESKTOP_SHORTCUTS.

1 Like

“I could not get CPACK_CREATE_DESKTOP_LINKS to work with Wix.” Same here, it was working just fine but suddenly no desktop icon for a long time :frowning:

If there’s a regression, then please open a bug report highlighting the last CMake version in which it worked successfully for you and when it broke. Providing a minimal project which demonstrates the problem also vastly increases the chances of someone taking a look at it. :wink:

1 Like