NSIS - allowing user to select per-component install locations?

I’m working on creating CPack installers for an audio plugin. We distribute several different formats - on Windows, AAX, VST3, and a standalone GUI app. These all need to be installed to different directories - by default, the AAX goes in Program Files/Common Files/Avid/Audio/Plug-Ins, the VST3 goes in Program Files/Common Files/VST3, and the standalone app goes in Program Files/<companyName>/<productName>.

I was able to get an installer building using all relative paths in my install commands, with all the destination paths being relative to Program Files. I set CPACK_PACKAGING_INSTALL_PREFIX to C:/Program Files, and it works, everything gets installed to the correct locations.

However, this results in the NSIS installer displaying the “install folder” as C:/Program Files, but my boss insists that the install folder presented to the user should be C:/Program Files/<companyName>/<productName>, the folder where the standalone app gets installed. I’m now facing a conundrum about how best to work around this – if I make the install root Program Files/<companyName>/<productName>, I could possibly install the VST3 with a relative path such as ../../Common Files/VST3, but the issue there is that if the user selects a custom folder for the standalone app, then the VST3/AAX paths will likely not be correct.

I think I have two options here:

  1. Find a way to install the AAX/VST3 components with absolute paths, so that the user can choose a custom install folder for the app and they’ll still end up in the correct directories. Is there a way in CMake to install something “outside” of the install root? :thinking:
  2. I’ve seen some NSIS installers that present the user a page for every install component, asking them to select a location. This seems like a possible solution, but may require providing my own NSIS template script, which I’m not super keen on…

Based on some asking around, it seems that NSIS does support the end goals of

  • Presenting the “install folder” to the user as the directory where the standalone app will be installed
  • Allowing the user to change this install root
  • Without that messing up the AAX/VST3 standard install locations

but I’m not sure of the best way to achieve this with CMake/CPack’s model of installing. Thoughts welcome!

You can copy the NSIS script template to your own directory and adapt it to your needs. You have to add this directory to CMAKE_MODULE_PATH.

Yes, I’m aware. I’m trying to figure out exactly how I should modify the NSIS template, and how to reconcile the CMake model of “all install paths are relative to a root” with my needs. Basically I need either different install roots for each component, or a way to force the VST & AAX components to always be installed to specific absolute paths even if the user changes the install root. I might just have to give in and install everything with absolute paths and the DESTDIR mode, but I’d really rather not…