summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.h
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2008-02-29 20:28:46 (GMT)
committerKen Martin <ken.martin@kitware.com>2008-02-29 20:28:46 (GMT)
commitab851bf36b3d32d5f5284718d1c660356e4c56fb (patch)
tree2c795be6435360d455593a2d956424929b8954c2 /Source/cmPolicies.h
parent22dc873ef07bdb31ee80b6117a781b1253ae7f94 (diff)
downloadCMake-ab851bf36b3d32d5f5284718d1c660356e4c56fb.zip
CMake-ab851bf36b3d32d5f5284718d1c660356e4c56fb.tar.gz
CMake-ab851bf36b3d32d5f5284718d1c660356e4c56fb.tar.bz2
ENH: just getting somethng checked in, still work to do
Diffstat (limited to 'Source/cmPolicies.h')
-rw-r--r--Source/cmPolicies.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
new file mode 100644
index 0000000..81d5c05
--- /dev/null
+++ b/Source/cmPolicies.h
@@ -0,0 +1,85 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmPolicies_h
+#define cmPolicies_h
+
+#include "cmCustomCommand.h"
+
+class cmake;
+class cmMakefile;
+class cmPolicy;
+
+/** \class cmPolicies
+ * \brief Handles changes in CMake behavior and policies
+ *
+ * See the cmake wiki section on policies for an overview of this class's purpose
+ */
+class cmPolicies
+{
+public:
+ cmPolicies();
+ ~cmPolicies();
+
+ enum PolicyStatus { OLD, WARN, NEW, REQUIRED_IF_USED, REQUIRED_ALWAYS };
+ static const char* PolicyStatusNames[];
+
+ enum PolicyID {CMP_0000, CMP_POLICY_SPECIFICATION = CMP_0000,
+ CMP_0001, CMP_TARGET_NAMES_WITH_SLASHES = CMP_0001,
+ CMP_0002, CMP_REQUIRE_UNIQUE_TARGET_NAMES = CMP_0002};
+
+
+ ///! convert a string policy ID into a number
+ bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
+ std::string GetPolicyIDString(cmPolicies::PolicyID pid);
+
+ ///! Get the default status for a policy
+ cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
+
+ ///! Define a Policy for CMake
+ void DefinePolicy(cmPolicies::PolicyID id,
+ const char *stringID,
+ const char *shortDescription,
+ const char *longDescription,
+ unsigned int majorVersionIntroduced,
+ unsigned int minorVersionIntroduced,
+ unsigned int patchVersionIntroduced,
+ cmPolicies::PolicyStatus status);
+
+ ///! Set a policy level for this listfile
+ bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
+
+ ///! test to see if setting a policy to a specific value is valid
+ bool IsValidPolicyStatus(cmPolicies::PolicyID id,
+ cmPolicies::PolicyStatus status);
+
+ ///! test to see if setting a policy to a specific value is valid, when used
+ bool IsValidUsedPolicyStatus(cmPolicies::PolicyID id,
+ cmPolicies::PolicyStatus status);
+
+ ///! return a warning string for a given policy
+ std::string GetPolicyWarning(cmPolicies::PolicyID id);
+
+ ///! return an error string for when a required policy is unspecified
+ std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
+
+ private:
+ std::map<cmPolicies::PolicyID,cmPolicy *> Policies;
+ std::map<std::string,cmPolicies::PolicyID> PolicyStringMap;
+
+};
+
+#endif