From 97be8ccf66d76346dca3e8ea5cdefeea6f040d87 Mon Sep 17 00:00:00 2001 From: Jim-Wang Date: Wed, 16 Oct 2024 07:10:50 +0000 Subject: [PATCH 1/3] no using vcvars --- src/vcpkg/commands.build.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index d1a8a8d494..77999b05e3 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -861,8 +861,7 @@ namespace vcpkg bool PreBuildInfo::using_vcvars() const { - return (!external_toolchain_file.has_value() || load_vcvars_env) && - (cmake_system_name.empty() || cmake_system_name == "WindowsStore"); + return load_vcvars_env && (cmake_system_name.empty() || cmake_system_name == "WindowsStore"); } Path PreBuildInfo::toolchain_file() const From 4468cac1d18d640dd5ee87fef70afe9181af75cc Mon Sep 17 00:00:00 2001 From: Jim-Wang Date: Wed, 16 Oct 2024 08:35:22 +0000 Subject: [PATCH 2/3] add test script --- azure-pipelines/e2e-ports/triplets/x64-no-vcvars.cmake | 4 ++++ azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 azure-pipelines/e2e-ports/triplets/x64-no-vcvars.cmake diff --git a/azure-pipelines/e2e-ports/triplets/x64-no-vcvars.cmake b/azure-pipelines/e2e-ports/triplets/x64-no-vcvars.cmake new file mode 100644 index 0000000000..5abba7d5f8 --- /dev/null +++ b/azure-pipelines/e2e-ports/triplets/x64-no-vcvars.cmake @@ -0,0 +1,4 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_LOAD_VCVARS_ENV OFF) \ No newline at end of file diff --git a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 index 9854e21678..16defd3bed 100644 --- a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 @@ -76,3 +76,10 @@ if ($firstMatch -lt 0) { } elseif ($output.IndexOf($expected, $firstMatch + 1) -ge 0) { throw 'Duplicated bad license' } + +Refresh-TestRoot +$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" install vcpkg-hello-world-1:x64-no-vcvars +Throw-IfNotFailed +if ($output -notmatch 'detecting compiler information') { + throw 'VCPKG_LOAD_VCVARS_ENV disables calling vcvars' +} \ No newline at end of file From 5d25fc429078d0a988a954067115e0cf9dfa8735 Mon Sep 17 00:00:00 2001 From: Jim-Wang Date: Wed, 16 Oct 2024 09:01:29 +0000 Subject: [PATCH 3/3] modify script --- azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 index 16defd3bed..1e832b25ef 100644 --- a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 @@ -80,6 +80,6 @@ if ($firstMatch -lt 0) { Refresh-TestRoot $output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" install vcpkg-hello-world-1:x64-no-vcvars Throw-IfNotFailed -if ($output -notmatch 'detecting compiler information') { +if ($output -notmatch 'Error code: 1') { throw 'VCPKG_LOAD_VCVARS_ENV disables calling vcvars' } \ No newline at end of file