Re: CPack/WiX shortcuts with custom arguments

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: CPack/WiX shortcuts with custom arguments

Cook, Steven (G&I)

To follow up on this, I tried creating a .bat file to run my program with the required command line arguments, but I was unable to add a shortcut to the .bat file because cmake appends “.exe” to the name of the executable in CPACK_PACKAGE_EXECUTABLES.


I think the only way to make it work is to create an executable that doesn’t require command line parameters.




From: Cook, Steven (G&I)
Sent: Friday, 22 March 2019 11:17 AM
To: '[hidden email]' <[hidden email]>
Subject: CPack/WiX shortcuts with custom arguments




I’m attempting to transition from NSIS to WiX for our Windows installer and have been unable to find a way to create customised shortcuts with WiX (I would like to specify both the working directory and command line parameters).


Some approaches I’ve tried are:

·         Specifying CPACK_PACKAGE_EXECUTABLES, and then using CPACK_WIX_PATCH_FILE to modify the shortcut. This approach doesn’t work because the patching mechanism can only add new XML tags; it is unable to add or modify properties on existing tags.

·         Creating the shortcut myself via CPACK_WIX_EXTRA_SOURCES. This doesn’t work because PROGRAM_MENU_FOLDER is not defined in directories.wxs unless cpack is creating shortcuts itself. And I can’t define this directory myself because the patching mechanism doesn’t allow modifications to the top level TARGETDIR directory.


Ideas of things that might work but which are not ideal:

·         Create an unwanted shortcut with cpack and then define my own shortcuts with CPACK_WIX_EXTRA_SOURCES. But then there is an unwanted shortcut.

·         Create separate .bat files for each start menu item so that working directory and command line parameters are not required.


Is there anything else I can try?





Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: