[CMake] CPack/WiX shortcuts with custom arguments

Cook, Steven (G&I) Steven.Cook at riotinto.com
Wed Apr 3 21:42:21 EDT 2019


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.

Steve

From: Cook, Steven (G&I)
Sent: Friday, 22 March 2019 11:17 AM
To: 'cmake at cmake.org' <cmake at cmake.org>
Subject: CPack/WiX shortcuts with custom arguments

Hi,

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?

Thanks
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190404/ce13a6ac/attachment-0001.html>


More information about the CMake mailing list