diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-01-31 17:09:48 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-01 11:42:41 -0800 |
| commit | 459999786960483f6d46229524500543459968ed (patch) | |
| tree | aa3cf7e44325983e693315f698622eb70153ec77 /toolsrc/src/BuildPolicies.cpp | |
| parent | bd1a10e5b97b073731cbb97e26611edf317c16d5 (diff) | |
| download | vcpkg-459999786960483f6d46229524500543459968ed.tar.gz vcpkg-459999786960483f6d46229524500543459968ed.zip | |
Introduce BuildPolicies (not used by the post_build checks yet)
Diffstat (limited to 'toolsrc/src/BuildPolicies.cpp')
| -rw-r--r-- | toolsrc/src/BuildPolicies.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/toolsrc/src/BuildPolicies.cpp b/toolsrc/src/BuildPolicies.cpp new file mode 100644 index 000000000..0f7c3c492 --- /dev/null +++ b/toolsrc/src/BuildPolicies.cpp @@ -0,0 +1,49 @@ +#include "pch.h" +#include "BuildPolicies.h" +#include "vcpkg_Checks.h" + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + static const std::string NAME_UNKNOWN = "PolicyUnknown"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + + const std::string& type::toString() const + { + switch (this->backing_enum) + { + case DLLS_WITHOUT_LIBS: + return NAME_DLLS_WITHOUT_LIBS; + case UNKNOWN: + return NAME_UNKNOWN; + default: + Checks::unreachable(); + } + } + + const std::string& type::cmake_variable() const + { + static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + + switch (this->backing_enum) + { + case DLLS_WITHOUT_LIBS: + return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; + case UNKNOWN: + Checks::exit_with_message("No CMake command corresponds to UNKNOWN"); + default: + Checks::unreachable(); + } + } + + type::type(): backing_enum(backing_enum_t::UNKNOWN) {} + + type parse(const std::string& s) + { + if (s == NAME_DLLS_WITHOUT_LIBS) + { + return BuildPolicies::DLLS_WITHOUT_LIBS; + } + + return BuildPolicies::UNKNOWN; + } +} |
