Skip to content

Commit

Permalink
[vcpkg] add environment variable VCPKG_OVERLAY_PORTS (microsoft#12640)
Browse files Browse the repository at this point in the history
* [vcpkg] add environment variable VCPKG_OVERLAY_PORTS

* add documentation for VCPKG_OVERLAY_PORTS

* append env overlay instead of prepending to give explicitly listed overlays priority

* fix formating (manually)

* manually fixing formating

* improve help text

Co-authored-by: ras0219 <[email protected]>

Co-authored-by: ras0219 <[email protected]>
  • Loading branch information
Neumann-A and ras0219 authored Aug 5, 2020
1 parent eb82546 commit 77452de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/vcpkg/vcpkgcmdarguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ namespace vcpkg
constexpr static StringLiteral TRIPLET_ENV = "VCPKG_DEFAULT_TRIPLET";
constexpr static StringLiteral TRIPLET_ARG = "triplet";
std::unique_ptr<std::string> triplet;
constexpr static StringLiteral OVERLAY_PORTS_ENV = "VCPKG_OVERLAY_PORTS";
constexpr static StringLiteral OVERLAY_PORTS_ARG = "overlay-ports";
std::vector<std::string> overlay_ports;
constexpr static StringLiteral OVERLAY_TRIPLETS_ARG = "overlay-triplets";
Expand Down
14 changes: 14 additions & 0 deletions src/vcpkg/vcpkgcmdarguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ namespace vcpkg
table.format(opt(TRIPLET_ARG, " ", "<t>"), "Specify the target architecture triplet. See 'vcpkg help triplet'");
table.format("", "(default: " + format_environment_variable("VCPKG_DEFAULT_TRIPLET") + ')');
table.format(opt(OVERLAY_PORTS_ARG, "=", "<path>"), "Specify directories to be used when searching for ports");
table.format("", "(also: " + format_environment_variable("VCPKG_OVERLAY_PORTS") + ')');
table.format(opt(OVERLAY_TRIPLETS_ARG, "=", "<path>"), "Specify directories containing triplets files");
table.format(opt(BINARY_SOURCES_ARG, "=", "<path>"),
"Add sources for binary caching. See 'vcpkg help binarycaching'");
Expand Down Expand Up @@ -646,6 +647,19 @@ namespace vcpkg
}
}

{
const auto vcpkg_overlay_ports_env = System::get_environment_variable(OVERLAY_PORTS_ENV);
if (const auto unpacked = vcpkg_overlay_ports_env.get())
{
#ifdef WIN32
auto overlays = Strings::split(*unpacked, ';');
#else
auto overlays = Strings::split(*unpacked, ':');
#endif
overlay_ports.insert(std::end(overlay_ports), std::begin(overlays), std::end(overlays));
}
}

if (!vcpkg_root_dir)
{
const auto vcpkg_root_env = System::get_environment_variable(VCPKG_ROOT_DIR_ENV);
Expand Down

0 comments on commit 77452de

Please sign in to comment.