aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshihaonan369 <shihaonan369@live.com>2020-03-11 01:05:39 +0800
committerGitHub <noreply@github.com>2020-03-10 10:05:39 -0700
commit264982215ce70097f2f4dbfcd3da9bce19b06b84 (patch)
treea89aaa6ba05309ceadb1a2b3c7b6ce0ca18fa745
parent2eed7256143ff1e8d83bce470006f6888f7234b4 (diff)
downloadvcpkg-264982215ce70097f2f4dbfcd3da9bce19b06b84.tar.gz
vcpkg-264982215ce70097f2f4dbfcd3da9bce19b06b84.zip
[vcpkg-export-nuget] Fix a import bug of nuget package, give priority to nuget package to set $(VcpkgRoot). (#6214)
* fix bug that caused exported nuget package import failure. * Give priority to nuget package to set $(VcpkgRoot). * [vcpkg] Remove trailing whitespace Co-authored-by: 施浩男 <shihaonan@zhongli360.com> Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
-rw-r--r--toolsrc/src/vcpkg/export.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp
index 7ab0090e8..a9dd3bba2 100644
--- a/toolsrc/src/vcpkg/export.cpp
+++ b/toolsrc/src/vcpkg/export.cpp
@@ -60,6 +60,9 @@ namespace vcpkg::Export
{
return Strings::format(R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <VcpkgRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))\installed\$(VcpkgTriplet)\</VcpkgRoot>
+ </PropertyGroup>
<Import Condition="Exists('%s')" Project="%s" />
</Project>
)###",
@@ -137,7 +140,7 @@ namespace vcpkg::Export
// This file will be placed in "build\native" in the nuget package. Therefore, go up two dirs.
const std::string targets_redirect_content =
- create_targets_redirect("../../scripts/buildsystems/msbuild/vcpkg.targets");
+ create_targets_redirect("$(MSBuildThisFileDirectory)../../scripts/buildsystems/msbuild/vcpkg.targets");
const fs::path targets_redirect = paths.buildsystems / "tmp" / "vcpkg.export.nuget.targets";
std::error_code ec;