diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-02-08 15:12:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-08 15:12:28 -0800 |
| commit | 7ddae17e2f520e83d25f78c078bf8b8a58fff447 (patch) | |
| tree | 87e2fc5c57a685367ec051b1efbdeb5d3ab43f4d /toolsrc/src/PostBuildLint_BuildPolicies.cpp | |
| parent | 5e588ddb5be9e6e27cebcc3be2e1a27f3ca83a50 (diff) | |
| parent | a9f7fc6e90feaad50c1221ef9bd56e2620302215 (diff) | |
| download | vcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.tar.gz vcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.zip | |
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/src/PostBuildLint_BuildPolicies.cpp')
| -rw-r--r-- | toolsrc/src/PostBuildLint_BuildPolicies.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp new file mode 100644 index 000000000..4e5ac3cea --- /dev/null +++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp @@ -0,0 +1,66 @@ +#include "pch.h" +#include "PostBuildLint_BuildPolicies.h" +#include "vcpkg_Checks.h" + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + static const std::string NAME_UNKNOWN = "PolicyUnknown"; + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + + const std::string& type::toString() const + { + switch (this->backing_enum) + { + case EMPTY_PACKAGE: + return NAME_EMPTY_PACKAGE; + 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_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE"; + static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + + switch (this->backing_enum) + { + case EMPTY_PACKAGE: + return CMAKE_VARIABLE_EMPTY_PACKAGE; + 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) {} + + const std::vector<type>& values() + { + static const std::vector<type>& v = {UNKNOWN, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS}; + return v; + } + + type parse(const std::string& s) + { + if (s == NAME_EMPTY_PACKAGE) + { + return BuildPolicies::EMPTY_PACKAGE; + } + + if (s == NAME_DLLS_WITHOUT_LIBS) + { + return BuildPolicies::DLLS_WITHOUT_LIBS; + } + + return BuildPolicies::UNKNOWN; + } +} |
