[CMake] smarter shortcuts with NSIS

Andrea Crotti andrea.crotti.0 at gmail.com
Mon Feb 27 11:47:11 EST 2012


On 02/27/2012 03:34 PM, Andrea Crotti wrote:
> My brain is almost going to explode, so before it does maybe someone 
> can help..
>
> I have a cpack with NSIS working installer, which just copies a 
> directory.
> In that directory there is a file run.exe, which needs to take an 
> argument to run correctly.
> Now that argument is a path which is only known at install-time, via 
> asking to the user.
>
> So what I would like to do is to:
> 1. get that path into a variable
> 2. stick it into the arguments of a shortcut file on the windows machine
>
> I found something like this on stackoverflow:
>
> set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
>     CreateShortCut \\\"$DESKTOP\\\\${PROJECT_NAME}.lnk\\\" 
> \\\"$INSTDIR\\\\built_egg\\\\run.exe\\\" \"c:\python25\pythonw.exe\"
> ")
>
> But I have some trouble understand in general, how is this command 
> processed?
> First the cmake variables are substituted and then it's simply run?
>
> And any advice on how to get the variable with the path?
> Thanks,
> Andrea

This is the first attempt:

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}\"
")

but I don't get any page asking me for the destination directory, and no 
shortcut is created..
By the way, how do I see the actual paths NSI configuration that 
generates the final exe?
It seems that if NSIS works the file used get all removed..


More information about the CMake mailing list