diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-25 19:53:11 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-25 19:53:11 -0700 |
| commit | d22cbe71dc66a66d583bb8b4e912e75fcf2038ed (patch) | |
| tree | acf112628289dce090eef4fa975928ba46f2fd8a /toolsrc/src/commands_export.cpp | |
| parent | e7d452a894936d716a728288467ee25ab110200f (diff) | |
| download | vcpkg-d22cbe71dc66a66d583bb8b4e912e75fcf2038ed.tar.gz vcpkg-d22cbe71dc66a66d583bb8b4e912e75fcf2038ed.zip | |
`export`: Retain the msbuild subfolder for cmake integration to also work
Diffstat (limited to 'toolsrc/src/commands_export.cpp')
| -rw-r--r-- | toolsrc/src/commands_export.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/toolsrc/src/commands_export.cpp b/toolsrc/src/commands_export.cpp index 4c920d962..1fff545bf 100644 --- a/toolsrc/src/commands_export.cpp +++ b/toolsrc/src/commands_export.cpp @@ -30,9 +30,10 @@ namespace vcpkg::Commands::Export <files> <file src="@RAW_EXPORTED_DIR@\installed\**" target="installed" /> <file src="@RAW_EXPORTED_DIR@\.vcpkg-root" target="" /> - <file src="@RAW_EXPORTED_DIR@\msbuild\applocal.ps1" target="build\native\applocal.ps1" /> - <file src="@RAW_EXPORTED_DIR@\msbuild\vcpkg.targets" target="build\native\@NUGET_ID@.targets" /> + <file src="@RAW_EXPORTED_DIR@\msbuild\applocal.ps1" target="build\native\msbuild\applocal.ps1" /> + <file src="@RAW_EXPORTED_DIR@\msbuild\vcpkg.targets" target="build\native\msbuild\vcpkg.targets" /> <file src="@RAW_EXPORTED_DIR@\vcpkg.cmake" target="build\native\vcpkg.cmake" /> + <file src="@RAW_EXPORTED_DIR@\vcpkg.targets" target="build\native\@NUGET_ID@.targets" /> </files> </package> )"; @@ -43,6 +44,15 @@ namespace vcpkg::Commands::Export return nuspec_file_content; } + static std::string create_targets_redirect(const std::string& target_path) noexcept + { + return Strings::format(R"###( +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Condition="Exists('%s')" Project="%s" /> +</Project> +)###", target_path, target_path); + } + static void print_plan(const std::map<ExportPlanType, std::vector<const ExportPlanAction*>>& group_by_plan_type) { static constexpr std::array<ExportPlanType, 2> order = { ExportPlanType::ALREADY_BUILT, ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT }; @@ -86,7 +96,7 @@ namespace vcpkg::Commands::Export const size_t bytes_written = std::strftime(mbstr, sizeof(mbstr), "%Y%m%d-%H%M%S", &date_time); Checks::check_exit(VCPKG_LINE_INFO, bytes_written == 15, "Expected 15 bytes to be written, but %u were written", bytes_written); const std::string date_time_as_string(mbstr); - return ("vcpkg-exported-" + date_time_as_string); + return ("vcpkg-export-" + date_time_as_string); } static fs::path do_nuget_export(const VcpkgPaths& paths, const fs::path& raw_exported_dir, const fs::path& output_dir) @@ -280,6 +290,10 @@ namespace vcpkg::Commands::Export Checks::check_exit(VCPKG_LINE_INFO, !ec); fs.copy_file(paths.buildsystems / "vcpkg.cmake", raw_exported_dir_path / "vcpkg.cmake", fs::copy_options::overwrite_existing, ec); Checks::check_exit(VCPKG_LINE_INFO, !ec); + const std::string targets_redirect_content = create_targets_redirect("msbuild/vcpkg.targets"); + const fs::path targets_redirect = raw_exported_dir_path / "vcpkg.targets"; + fs.write_contents(targets_redirect, targets_redirect_content); + Checks::check_exit(VCPKG_LINE_INFO, !ec); if (raw) { |
