[CMake] CPack and NSIS failure

David Demelier demelier.david at gmail.com
Wed Jul 11 04:01:05 EDT 2012


On 28/06/2012 11:20, Eric Noulard wrote:
> 2012/6/27 David Demelier <demelier.david at gmail.com>:
>>
>> Thanks for your help, it worked!
>>
>> Now, the last problem, I noticed that CPACK_PACKAGE_EXECUTABLES you
>> can't set an icon, thus I used my own CreateShortCut and Delete with
>> respectively CPACK_NSIS_CREATE_ICONS_EXTRA and
>> CPACK_NSIS_DELETE_ICONS_EXTRA. The first one works, but not the
>> second.
>>
>>         set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut                       \\\\
>>             '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk'           \\\\
>>             '$INSTDIR\\\\sd-tris.exe'                                           \\\\
>>             ''                                                                  \\\\
>>             '${ICONPATH}'"
>>         )
>>         set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete                               \\\\
>>             '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk'"
>>         )
>>
>> When uninstalling, the window menu entry is still there and not
>> removed at all. But the project.nsi has the line
>>
>> Delete                          \
>>             '$SMPROGRAMS\$STARTMENU_FOLDER\sd-tris.lnk'
>>
>> But this command is not executed by the Uninstall.exe.
>
> Looks like an NSIS script error.
> Would you be able to create a working project.nsi (starting wiht the
> one generated by CPack)
> and tell us what could make the generated one work?
>
>
>

I finally wrote this, it works very well.

	set (ICONPATH "$INSTDIR/${PATH_INSTALL_DATA}/icon.ico")
	string(REPLACE "/" "\\\\" ICONPATH ${ICONPATH})

	set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut			\\\\
	    '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\SD-Tris.lnk'			\\\\
	    '$INSTDIR\\\\sd-tris.exe'						\\\\
	    ''									\\\\
	    '${ICONPATH}'"
	)
	set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete				\\\\
	    '$SMPROGRAMS\\\\$MUI_TEMP\\\\SD-Tris.lnk'"
	)

I have an install target that install the icon.ico in the installation 
directory, then the CPACK_NSIS_CREATE_ICONS_EXTRA use it for the shortcut.

Cheers,

-- 
David Demelier




More information about the CMake mailing list