CMake 3.29 CPACK_WIX_INSTALL_SCOPE regression

CMake 3.29 “fixed” the install scope of the MSI installers that the CPack WIX generator creates. Previously, it would produce a somewhat wonky amalgamation of a per-user and per-machine installation. This was changed to instead be a proper per-machine installation.

This breaks updating applications. When having installed an application with an installer generated with the old CMake and then trying to update it using an installer generated with the new one, MSI will not perform the upgrade it’s supposed to. The log will contain the following message:

FindRelatedProducts: current install is per-machine. Related install for product ‘whatever’ per-user. Skipping…

The installer will then proceed to misbehave horribly. The application will be added to the Add/Remove Programs control panel and desktop shortcuts again, causing the user to end up with two registrations of the same program in the same location. Worse, it also won’t actually install any files, leading to the application not actually updating. It will only replace the files if the user runs the installer again and picks “Repair”.

Reverting the behavior via set(CPACK_WIX_INSTALL_SCOPE NONE) fixes these issues.

There’s a comment on this change here that says if the new behavior causes regressions, the default should be reverted to NONE, so maybe that should be done:

Steps to reproduce:

  • Generate an MSI installer for v1 of the application the “old” way, either by using an older CMake version or by setting CPACK_WIX_INSTALL_SCOPE to NONE.
  • Install it.
  • Create an MSI installer for v2 of the application the “new” way, by using CMake 3.29+.
  • Install it on the same machine.

Expected behavior: The application updates in-place. The user ends up with having only v2 installed.

Actual behavior: The application files don’t get overwritten, the application remains on v1. Duplicate entries are created in the Add/Remove Programs control panel, one for v1 and one for v2. If the application creates desktop shortcuts, those also get duplicated.

@Drawpile Thanks for the analysis and example scenario. This does sound like a regression. Could you please open an issue in the issue tracker and provide the details you’ve given in your post above?