Add support for file associations in cpack NSIS
Currently, to setup file associations in a cpack NSIS cmake script, one need to do something like :
# Include the scripts
# FileAssociation.nsh, from https://nsis.sourceforge.io/File_Association, has to be installed in NSIS\Include
set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS
"!include \\\"${PATH_TO_PLUGINS}\\\\FileFunc.nsh\\\"\n\
!include \\\"${PATH_TO_PLUGINS}\\\\FileAssociation.nsh\\\"")
# Create association on install
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"\\\${RegisterExtension} '$INSTDIR\\\\bin\\\\f3d.exe' '.vtk' 'VTK Legacy Data Format'\n\
\\\${RefreshShellIcons}")
# Remove association on uninstall
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
"\\\${UnRegisterExtension} '.vtk' 'VTK Legacy Data Format'\n\
\\\${RefreshShellIcons}")
Not really easy to use, and there is no way to show a page to let the user decided which extension they want to associate with the software.
It would be much better to have dedicated CPACK vars, especially as this would be possible to add variable to make a page show up to let the user decide.