VS: Make CMAKE_GENERATOR_INSTANCE usable without VS Installer

On Windows and Wine, both the COM interface and `vswhere` might not be
available.  `CMAKE_GENERATOR_INSTANCE` is still supposed to work since
commit 195d47e213 (VS: Allow CMAKE_GENERATOR_INSTANCE to specify
portable instance, 2021-10-21, v3.23.0-rc1~452^2).

Issue: #21639
This commit is contained in:
huangqinjin 2024-09-05 00:49:55 +08:00 committed by Brad King
parent 7b51809d9a
commit e801d2b243

View File

@ -450,7 +450,8 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
// Enumerate VS instances with either COM interface or Vswhere
if (!EnumerateVSInstancesWithCOM(vecVSInstancesAll) &&
!EnumerateVSInstancesWithVswhere(vecVSInstancesAll)) {
!EnumerateVSInstancesWithVswhere(vecVSInstancesAll) &&
this->SpecifiedVSInstallLocation.empty()) {
return false;
}