Ensure multiple cmake runs without cache clean-up will preserve artifacts selected on first run. This change address the issue #19492.