How to I make CPack (NSIS) upgrade properly for new installations?
I'm using the CPack NSIS generator to create an installer. However, each time I release a new version, o开发者_开发知识库ur users are running the new installer without uninstalling the old version (which is understandable).
Is it possible to make the installer overwrite all existing files? Failing that, is there a way to block the installation if it's already installed?
Also, our CPack call is wrapped in another script, as a last resort, is it possible for me to hack/reconfigure the project.nsi file so that it does one of the above?
you have to edit the NSIS template that CPack uses. You can find it in your cmake installation folder/Modules/NSIS.template.in.
There, somewhere, maybe in the begining of the General section, you can put: SetOverwrite on
This should do the trick, although I didn't have the chance to try it out.
For more details about the arguments of SetOverwrite read the NSIS scripting manual
My solution was to maintain the NSIS file separately, turns out to be not much extra effort.
精彩评论