cmakewixpackagingcpackwix4

How to use WIX V4 within CMAKE to build an installation package for Windows


I've tried to build an installation package with CMAKE + WIX. The latest version of WIX is v4. Unfortunately, CPack fails as it is looking for a tool candle.exe which was dropped in WIX v4, as opposed to WIX v3. But CPack is still looking for candle and therefore crashes.

Does CMake support WIX v4? If so, how one makes it use this version of WIX?

I went through tech forums, blogs, CMake docs and other online resourced on this subject, but failed to find any answer or even mentioning of WIX V4 in the context of CMake.


Solution

  • I've succeeded to get an answer from GitHub discussions of the repo of WiX. The simple answer is that as of now WiX v4 is not yet supported by CMake. Even the format of the generated XML files is not compatible. Therefore, with CMake one should use WiX v3.

    See https://github.com/orgs/wixtoolset/discussions/7894 for the reference.

    UPDATE: As it can be seen from the answer of @jwillikers here, as of CMake 3.30 both WiX 4 and 5 are supported by CMake, and if your development environment allows bumping up to this version of CMake, go to that answer.