aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_integration.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2016-09-20 14:25:28 -0700
committerRobert Schumacher <roschuma@microsoft.com>2016-09-20 14:25:28 -0700
commit6c9b62eea3bc432628ad97b892025714ba6f4b6b (patch)
treef1d31ded19c76963670f359058b6ccbe73f15dcd /toolsrc/src/commands_integration.cpp
parent14dbb584b483785398e588c4105387325607ecfa (diff)
downloadvcpkg-6c9b62eea3bc432628ad97b892025714ba6f4b6b.tar.gz
vcpkg-6c9b62eea3bc432628ad97b892025714ba6f4b6b.zip
[vcpkg] Fix mismatch between props and targets for user integration.
Diffstat (limited to 'toolsrc/src/commands_integration.cpp')
-rw-r--r--toolsrc/src/commands_integration.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/toolsrc/src/commands_integration.cpp b/toolsrc/src/commands_integration.cpp
index e1b63038a..0156d5e2a 100644
--- a/toolsrc/src/commands_integration.cpp
+++ b/toolsrc/src/commands_integration.cpp
@@ -9,6 +9,7 @@
#include "vcpkg_Environment.h"
#include "vcpkg_Checks.h"
#include "vcpkg_System.h"
+#include "vcpkg_Files.h"
namespace vcpkg
{
@@ -28,10 +29,11 @@ namespace vcpkg
{
return R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- version 1 -->
<PropertyGroup>
<VCLibPackagePath Condition="'$(VCLibPackagePath)' == ''">$(LOCALAPPDATA)\vcpkg\vcpkg.user</VCLibPackagePath>
</PropertyGroup>
- <Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).props')" Project="$(VCLibPackagePath).props" />
+ <Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).targets')" Project="$(VCLibPackagePath).targets" />
</Project>
)###";
}
@@ -165,7 +167,25 @@ namespace vcpkg
fs::create_directory(paths.buildsystems);
fs::create_directory(tmp_dir);
- if (!fs::exists(system_wide_targets_file))
+ bool should_install_system = true;
+ if (fs::exists(system_wide_targets_file))
+ {
+ auto system_wide_file_contents = Files::get_contents(system_wide_targets_file);
+ if (auto contents_data = system_wide_file_contents.get())
+ {
+ std::regex re(R"###(<!-- version (\d+) -->)###");
+ std::match_results<std::string::const_iterator> match;
+ auto found = std::regex_search(*contents_data, match, re);
+ if (found)
+ {
+ int ver = atoi(match[1].str().c_str());
+ if (ver >= 1)
+ should_install_system = false;
+ }
+ }
+ }
+
+ if (should_install_system)
{
const fs::path sys_src_path = tmp_dir / "vcpkg.system.targets";
std::ofstream(sys_src_path) << create_system_targets_shortcut();