[CMake] smarter shortcuts with NSIS

Eric Noulard eric.noulard at gmail.com
Tue Feb 28 10:42:57 EST 2012


2012/2/28 Andrea Crotti <andrea.crotti.0 at gmail.com>:
> Alright moving the include after did the trick, I get my code in the final
> nsi file, as below:
>
>
> set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
>    PageEx directory
>      DirVar PythonDir
>    PageExEnd
>
>    CreateShortCut \\\"$DESKTOP\\\\${PROJECT_NAME}.lnk\\\"
> \\\"$INSTDIR\\\\built_egg\\\\run.exe\\\" \"$PythonDir\\\\pythonw.exe\" \"\"
> \"\" \".$INSTDIR\" \"Run project ${PROJECT_NAME}\"
> ")
>
>
> The problem is that it fails for this reason:
> Error: command PageEx not valid in Section
>
> which makes sense, but is there a way to avoid that PageEx to end up in a
> section at all?
> Is that the only way to inject NSIS code?

Yes currently that's the case if you use the CMake-provided "NSIS.template.in"
but...

> At worst is there a way to just create my own .nsi file and use it directly?
> I need to create a page which simply asks for a directory to the user, and
> then use that to create a shortcut..
>
> Any idea (also other solutions might be fine).

1) Copy the current NSIS.template.in in your project.
    and update it the way you like.

2) update CMAKE_MODULE_PATH
    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/packaging)

    in order to make your NSIS.template.in in the CMAKE_MODULE_PATH
    (you can even use CPACK_MODULE_PATH)

3) run-rerun packaging an dmake sure that cpack is using your projevtc specific
    NSIS.template.in



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


More information about the CMake mailing list