[baseline] unset the backup var and not the var which was backed up. (#27984)

* unset the backup var and not the var which was backed up.

* if no backup unset the vcpkg set var
This commit is contained in:
Alexander Neumann 2022-11-24 01:04:20 +01:00 committed by GitHub
parent 8b8196f0f8
commit c2c25d916f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -833,8 +833,10 @@ macro("${VCPKG_OVERRIDE_FIND_PACKAGE_NAME}" z_vcpkg_find_package_package_name)
foreach(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var IN LISTS z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars)
if(DEFINED z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var})
set("${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}" "${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}}")
else()
unset("${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}")
endif()
unset("${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}")
unset("z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}")
endforeach()
math(EXPR z_vcpkg_find_package_backup_id "${z_vcpkg_find_package_backup_id} - 1")
if(z_vcpkg_find_package_backup_id LESS "0")