From e801d2b2438e0841ec28f466b5b2dfa29b65bc62 Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Thu, 5 Sep 2024 00:49:55 +0800 Subject: [PATCH] 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 --- Source/cmVSSetupHelper.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 809117e11d..92661346ca 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -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; }