Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/users/config-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ the platform dependent PATH seperator (Windows `;` | others `:`)

Example (Windows): `C:\custom-ports\boost;C:\custom-ports\sqlite3`

#### VCPKG_OVERLAY_TRIPLETS

This environment variable allows users to add directories to search for triplets.
[Example: overlay triplets](../examples/overlay-triplets-linux-dynamic.md).
List paths to overlays using the platform dependent PATH seperator (Windows `;`, others `:`)

#### VCPKG_FORCE_SYSTEM_BINARIES

This environment variable, if set, suppresses the downloading of CMake and Ninja and forces the use of the system binaries.
Expand Down
2 changes: 2 additions & 0 deletions toolsrc/include/vcpkg/base/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ namespace vcpkg::Strings

std::vector<std::string> split(StringView s, const char delimiter);

std::vector<std::string> split_paths(StringView s);

const char* find_first_of(StringView searched, StringView candidates);

std::vector<StringView> find_all_enclosed(StringView input, StringView left_delim, StringView right_delim);
Expand Down
1 change: 1 addition & 0 deletions toolsrc/include/vcpkg/vcpkgcmdarguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace vcpkg
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_ENV = "VCPKG_OVERLAY_TRIPLETS";
constexpr static StringLiteral OVERLAY_TRIPLETS_ARG = "overlay-triplets";
std::vector<std::string> overlay_triplets;

Expand Down
7 changes: 1 addition & 6 deletions toolsrc/src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,13 +1174,8 @@ namespace vcpkg::Files

virtual std::vector<fs::path> find_from_PATH(const std::string& name) const override
{
#if defined(_WIN32)
static constexpr StringLiteral EXTS[] = {".cmd", ".exe", ".bat"};
auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ';');
#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv
static constexpr StringLiteral EXTS[] = {""};
auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ':');
#endif // ^^^ !defined(_WIN32)
auto paths = Strings::split_paths(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO));

std::vector<fs::path> ret;
std::error_code ec;
Expand Down
9 changes: 9 additions & 0 deletions toolsrc/src/vcpkg/base/strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ std::vector<std::string> Strings::split(StringView s, const char delimiter)
}
}

std::vector<std::string> Strings::split_paths(StringView s)
{
#if defined(_WIN32)
return Strings::split(s, ';');
#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv
return Strings::split(s, ':');
#endif
}

const char* Strings::find_first_of(StringView input, StringView chars)
{
return std::find_first_of(input.begin(), input.end(), chars.begin(), chars.end());
Expand Down
16 changes: 11 additions & 5 deletions toolsrc/src/vcpkg/vcpkgcmdarguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ namespace vcpkg
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("", "(also: " + format_environment_variable("VCPKG_OVERLAY_TRIPLETS") + ')');
table.format(opt(BINARY_SOURCES_ARG, "=", "<path>"),
"Add sources for binary caching. See 'vcpkg help binarycaching'");
table.format(opt(DOWNLOADS_ROOT_DIR_ARG, "=", "<path>"), "Specify the downloads root directory");
Expand Down Expand Up @@ -652,15 +653,20 @@ 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
auto overlays = Strings::split_paths(*unpacked);
overlay_ports.insert(std::end(overlay_ports), std::begin(overlays), std::end(overlays));
}
}

{
const auto vcpkg_overlay_triplets_env = System::get_environment_variable(OVERLAY_TRIPLETS_ENV);
if (const auto unpacked = vcpkg_overlay_triplets_env.get())
{
auto triplets = Strings::split_paths(*unpacked);
overlay_triplets.insert(std::end(overlay_triplets), std::begin(triplets), std::end(triplets));
}
}

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