mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
[vcpkg] Add VCPKG_DEFAULT_VS_PATH environment variable
This commit is contained in:
parent
b7daa881f5
commit
6670b87c18
@ -33,7 +33,7 @@ namespace vcpkg
|
||||
|
||||
struct VcpkgPaths
|
||||
{
|
||||
static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir);
|
||||
static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir, const std::string& default_vs_path);
|
||||
|
||||
fs::path package_dir(const PackageSpec& spec) const;
|
||||
fs::path port_dir(const PackageSpec& spec) const;
|
||||
@ -90,5 +90,7 @@ namespace vcpkg
|
||||
Lazy<fs::path> ifw_repogen_exe;
|
||||
Lazy<std::vector<Toolset>> toolsets;
|
||||
Lazy<std::vector<Toolset>> toolsets_vs2013;
|
||||
|
||||
fs::path default_vs_path;
|
||||
};
|
||||
}
|
||||
|
@ -94,7 +94,9 @@ static void inner(const VcpkgCmdArguments& args)
|
||||
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !vcpkg_root_dir.empty(), "Error: Could not detect vcpkg-root.");
|
||||
|
||||
const Expected<VcpkgPaths> expected_paths = VcpkgPaths::create(vcpkg_root_dir);
|
||||
auto default_vs_path = System::get_environment_variable("VCPKG_DEFAULT_VS_PATH").value_or("");
|
||||
|
||||
const Expected<VcpkgPaths> expected_paths = VcpkgPaths::create(vcpkg_root_dir, default_vs_path);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!expected_paths.error(),
|
||||
"Error: Invalid vcpkg root directory %s: %s",
|
||||
|
@ -293,7 +293,7 @@ namespace vcpkg
|
||||
return fetch_tool(paths.scripts, "installerbase", TOOL_DATA);
|
||||
}
|
||||
|
||||
Expected<VcpkgPaths> VcpkgPaths::create(const fs::path& vcpkg_root_dir)
|
||||
Expected<VcpkgPaths> VcpkgPaths::create(const fs::path& vcpkg_root_dir, const std::string& default_vs_path)
|
||||
{
|
||||
std::error_code ec;
|
||||
const fs::path canonical_vcpkg_root_dir = fs::stdfs::canonical(vcpkg_root_dir, ec);
|
||||
@ -304,6 +304,7 @@ namespace vcpkg
|
||||
|
||||
VcpkgPaths paths;
|
||||
paths.root = canonical_vcpkg_root_dir;
|
||||
paths.default_vs_path = default_vs_path;
|
||||
|
||||
if (paths.root.empty())
|
||||
{
|
||||
@ -643,7 +644,11 @@ namespace vcpkg
|
||||
|
||||
std::vector<const Toolset*> candidates = Util::element_pointers(vs_toolsets);
|
||||
const auto tsv = prebuildinfo.platform_toolset.get();
|
||||
const auto vsp = prebuildinfo.visual_studio_path.get();
|
||||
auto vsp = prebuildinfo.visual_studio_path.get();
|
||||
if (!vsp && !default_vs_path.empty())
|
||||
{
|
||||
vsp = &default_vs_path;
|
||||
}
|
||||
|
||||
if (tsv && vsp)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user