aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/PostBuildLint_BuildPolicies.cpp
diff options
context:
space:
mode:
authorJan HrubĂ˝ <jhruby.web@gmail.com>2017-03-13 08:56:05 +0100
committerGitHub <noreply@github.com>2017-03-13 08:56:05 +0100
commit665f4118f603c5858217ed7a2f2f824b18ff4fc5 (patch)
treef0167041edf71e90f2331b5025f603392a8de67a /toolsrc/src/PostBuildLint_BuildPolicies.cpp
parent1bec0fcb73073b5b1719f454c368a63f1bff625e (diff)
parent1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff)
downloadvcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.tar.gz
vcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.zip
Merge pull request #1 from Microsoft/master
pull
Diffstat (limited to 'toolsrc/src/PostBuildLint_BuildPolicies.cpp')
-rw-r--r--toolsrc/src/PostBuildLint_BuildPolicies.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp
new file mode 100644
index 000000000..f070a2a42
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp
@@ -0,0 +1,70 @@
+#include "pch.h"
+#include "PostBuildLint_BuildPolicies.h"
+#include "vcpkg_Enums.h"
+
+namespace vcpkg::PostBuildLint::BuildPolicies
+{
+ static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME);
+
+ static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
+ static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
+ static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
+
+ 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 ONLY_RELEASE_CRT:
+ return NAME_ONLY_RELEASE_CRT;
+ case NULLVALUE:
+ return NULLVALUE_STRING;
+ default:
+ Enums::unreachable(ENUM_NAME);
+ }
+ }
+
+ 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";
+ static const std::string CMAKE_VARIABLE_ONLY_RELEASE_CRT = "VCPKG_POLICY_ONLY_RELEASE_CRT";
+
+ switch (this->backing_enum)
+ {
+ case EMPTY_PACKAGE:
+ return CMAKE_VARIABLE_EMPTY_PACKAGE;
+ case DLLS_WITHOUT_LIBS:
+ return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
+ case ONLY_RELEASE_CRT:
+ return CMAKE_VARIABLE_ONLY_RELEASE_CRT;
+ case NULLVALUE:
+ Enums::nullvalue_used(ENUM_NAME);
+ default:
+ Enums::unreachable(ENUM_NAME);
+ }
+ }
+
+ 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;
+ }
+
+ if (s == NAME_ONLY_RELEASE_CRT)
+ {
+ return BuildPolicies::ONLY_RELEASE_CRT;
+ }
+
+ return BuildPolicies::NULLVALUE;
+ }
+}