The documentation at deb indicates that CPACK_DEBIAN_PACKAGE_ARCHITECTURE defaults to i386 when dpkg is not found.
However, the execute_process() on line 459 in the file cmake-3.25/Modules/Internal/CPack/CPackDeb.cmake is not in an else() block. Therefore, the variable is set to an empty string when execute_process() is run, overwriting the string “i386”.
Since it’s not set to “i386” now, nobody is relying on this as a default. I would suggest making the default “amd64”.
Also, I would suggest mentioning the variable name in the status message to help users for whom dpkg is not available.
Perhaps, “CPackDeb: Cannot find program dpkg, setting CPACK_DEBIAN_PACKAGE_ARCHITECTURE to amd64.”
The status message is certainly reasonable (WIX does it). I’m not sure how the default can be updated reliably as policies aren’t really in effect there AFAIK.
If the default cannot be updated, then the documentation should be changed to state that the default is “”.
The unfortunate part is that the current default of “” is not useful to anyone. So, I would suggest updating the code (to put execute_process() in an else clause) and updating the default to what is thought to be the most useful. I suggest “amd64”. Other options would be “noarch” or “unknown” or the value of CMAKE_SYSTEM_PROCESSOR or something more complicated (like using “amd64” when the processor is x86_64 and “arm64” when the processor is aarch64). Probably simpler is better…