Extend the fix from commit 7b8dcdd1 to more places in CPack.
Issue: #12284 (closed) Backport: release