[CMake] NSIS, CPACK_PACKAGE_EXECUTABLES and parameters

Eric Noulard eric.noulard at gmail.com
Tue Apr 3 11:45:09 EDT 2012


2012/4/3 Jonatan Wallmander <jonatan at vovoid.com>:
> Hi,
>
> I'm on cmake version 2.8.5
>
> I looked in the changelog and couldn't find this, so here goes:
>
>
> From what I can tell, NSIS with CPACK_PACKAGE_EXECUTABLES and giving
> parameters to the executable isn't supported.
>
> CMakeLists.txt:
> set(CPACK_PACKAGE_EXECUTABLES "my_executable -f;My Executable")
>
> Resulting row in the cpack NSIS cache file:
>
> CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\My Executable.lnk"
> "$INSTDIR\.\my_executable -f.exe"
>
> I propose 2 possible solutions:
>
> 1. (best option IMO)
>
> Add support for a 3rd parameter for flags, like so:
> set(CPACK_PACKAGE_EXECUTABLES "my_executable;My Executable;-f")
>
> Since executables actually CAN have spaces in them, this would be best.

The trouble is the "S" of CPACK_PACKAGE_EXECUTABLES means you can
currently give something like:

set(CPACK_PACKAGE_EXECUTABLES "my_exe1;My Exe1;my_exe2;My Exe2")

so that it will be hard to maintain backward compatibility with option1.

> 2. (secondary option)
> Add support for parsing the executable on spaces, everything after the first
> space goes last in the call.
>
> I.e. set(CPACK_PACKAGE_EXECUTABLES "my_executable -f;My Executable")

Then I may suggest a 3rd option

set(CPACK_PACKAGE_EXECUTABLES "my_executable;my_executable_ARGS -f;My
Executable")

that way we can check from the value right after "executable" that
ARGS are provided for
the preceding executable, so that the new pattern would be:

set(CPACK_PACKAGE_EXECUTABLES
"<exeName>;[<exeName>_ARGS<space><args>;]<someString>")

Beware of the fact that currently NSIS generator is not the only CPack
generator that uses
CPACK_PACKAGE_EXECUTABLES OSXX11 uses it as well.

Moreover the (in-source) code comment seems outdated or partially
wrong since ones can read:

cmCPackLogger(cmCPackLog::LOG_ERROR,
        "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and "
        "<icon name>." << std::endl);

AFAIK, there is no "icon" here just the name of the menu entry?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list