aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/optional.h18
-rw-r--r--toolsrc/include/vcpkg/base/system.h1
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h4
3 files changed, 23 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h
index 54e370dff..caacf815e 100644
--- a/toolsrc/include/vcpkg/base/optional.h
+++ b/toolsrc/include/vcpkg/base/optional.h
@@ -29,6 +29,24 @@ namespace vcpkg
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() { }
constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) { }
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) { }
+ template<class U, class = std::enable_if_t<!std::is_reference<U>::value>>
+ constexpr explicit OptionalStorage(Optional<U>&& t) : m_is_present(false), m_inactive()
+ {
+ if (auto p = t.get())
+ {
+ m_is_present = true;
+ new (&m_t) T(std::move(*p));
+ }
+ }
+ template<class U>
+ constexpr explicit OptionalStorage(const Optional<U>& t) : m_is_present(false), m_inactive()
+ {
+ if (auto p = t.get())
+ {
+ m_is_present = true;
+ new (&m_t) T(*p);
+ }
+ }
~OptionalStorage() noexcept
{
diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h
index 2340728fd..8e45f6538 100644
--- a/toolsrc/include/vcpkg/base/system.h
+++ b/toolsrc/include/vcpkg/base/system.h
@@ -8,6 +8,7 @@
namespace vcpkg::System
{
Optional<std::string> get_environment_variable(ZStringView varname) noexcept;
+ void set_environment_variable(ZStringView varname, Optional<ZStringView> value) noexcept;
const ExpectedS<fs::path>& get_home_dir() noexcept;
diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index 3901000e3..eaf5cc3eb 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -174,10 +174,13 @@ namespace vcpkg
constexpr static StringLiteral REGISTRIES_FEATURE = "registries";
Optional<bool> registries_feature = nullopt;
+ constexpr static StringLiteral RECURSIVE_DATA_ENV = "VCPKG_X_RECURSIVE_DATA";
+
bool binary_caching_enabled() const { return binary_caching.value_or(true); }
bool compiler_tracking_enabled() const { return compiler_tracking.value_or(true); }
bool registries_enabled() const { return registries_feature.value_or(false); }
bool output_json() const { return json.value_or(false); }
+ bool is_recursive_invocation() const { return m_is_recursive_invocation; }
std::string command;
std::vector<std::string> command_arguments;
@@ -192,6 +195,7 @@ namespace vcpkg
void track_feature_flag_metrics() const;
private:
+ bool m_is_recursive_invocation = false;
std::unordered_set<std::string> command_switches;
std::unordered_map<std::string, std::vector<std::string>> command_options;
};