Feature Request: CPack NSIS Generator, allow selecting component as part of a silent install
Hello, I apologize if this is not the correct place or the correct format, but I wanted to at least present this somewhere.
Incomplete Feature
CPack in general allows selecting which components are included at build time. Further, the NSIS installer allows selecting which components are installed when it is ran. Unfortunately, that NSIS component selection is only available through the graphical options.
Proposal
Modify NSIS.template.in to accept a "/COMPONENTS="..." variable. Which takes a CMake style list of components to install.
References
Recommended method for passing arguments to the installer
Since the directory page is not shown in silent installers the user has an option to specify the installation directory on the command line (this also works on non-silent installers/uninstallers). To do that, the user uses the /D switch as in the following example:
foo.exe /S /D=C:\Program Files\Foo
If your installer/uninstaller requires some more information that can not be gathered when silent, you can allow the user to specify that information on the command line and process it in .onInit. You can use GetOptions.
!include FileFunc.nsh !insertmacro GetParameters !insertmacro GetOptions Function .onInit ${GetParameters} $R0 ClearErrors ${GetOptions} $R0 /USERNAME= $0 FunctionEnd
The above example will copy the value the user passes on after /USERNAME= into $0. This allows the user to specify the required information on the command line instead of using the interactive user interface. The user can use:
foo.exe /S /USERNAME=Bar /D=C:\Program Files\Foo
or:
foo.exe /S /USERNAME=string with spaces /D=C:\Program Files\Foo
or:
foo.exe /S /USERNAME="string with spaces" /D=C:\Program Files\Foo