Silent installation of NSIS installer from CPACK with modifying PATH

I’ve created an NSIS installer via cmake/cpack for a command line application on Windows. It has the setting set(CPACK_NSIS_MODIFY_PATH ON) so it allows the interactive user to add the installation location to the PATH variable.

Now I would like to use that installer for a winget package. But winget runs the installer silently, and I have not found a way to modify the PATH variable with the silent installer.

I’ve seen CMake Silent Install with Options Help - #4 by Francesco_Pretto but that is about an MSI package.

Any ideas?