Resync (forgot to add new files?)
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmPolicies.h
blob7f3ebd052f4c8f19a694f8c204b678e26c1e1931
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPolicies.h,v $
5 Language: C++
6 Date: $Date: 2008-03-13 21:11:57 $
7 Version: $Revision: 1.13 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmPolicies_h
18 #define cmPolicies_h
20 #include "cmCustomCommand.h"
22 class cmake;
23 class cmMakefile;
24 class cmPolicy;
26 /** \class cmPolicies
27 * \brief Handles changes in CMake behavior and policies
29 * See the cmake wiki section on policies for an overview of this class's
30 * purpose
32 class cmPolicies
34 public:
35 cmPolicies();
36 ~cmPolicies();
38 enum PolicyStatus { OLD, WARN, NEW, REQUIRED_IF_USED, REQUIRED_ALWAYS };
39 static const char* PolicyStatusNames[];
41 enum PolicyID
43 CMP0000, // Policy version specification
44 CMP0001, // Ignore old compatibility variable
45 CMP0002, // Target names must be unique
46 CMP0003, // Linking does not include extra -L paths
47 CMP0004, // Libraries linked may not have leading or trailing whitespace
48 CMP0005, // Definition value escaping
50 // Always the last entry. Useful mostly to avoid adding a comma
51 // the last policy when adding a new one.
52 CMPCOUNT
55 ///! convert a string policy ID into a number
56 bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
57 std::string GetPolicyIDString(cmPolicies::PolicyID pid);
59 ///! Get the default status for a policy
60 cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
62 ///! Define a Policy for CMake
63 void DefinePolicy(cmPolicies::PolicyID id,
64 const char *stringID,
65 const char *shortDescription,
66 const char *longDescription,
67 unsigned int majorVersionIntroduced,
68 unsigned int minorVersionIntroduced,
69 unsigned int patchVersionIntroduced,
70 cmPolicies::PolicyStatus status);
72 ///! Set a policy level for this listfile
73 bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
75 ///! test to see if setting a policy to a specific value is valid
76 bool IsValidPolicyStatus(cmPolicies::PolicyID id,
77 cmPolicies::PolicyStatus status);
79 ///! test to see if setting a policy to a specific value is valid, when used
80 bool IsValidUsedPolicyStatus(cmPolicies::PolicyID id,
81 cmPolicies::PolicyStatus status);
83 ///! return a warning string for a given policy
84 std::string GetPolicyWarning(cmPolicies::PolicyID id);
86 ///! return an error string for when a required policy is unspecified
87 std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
89 ///! Get docs for policies
90 void GetDocumentation(std::vector<cmDocumentationEntry>& v);
92 private:
93 // might have to make these internal for VS6 not sure yet
94 std::map<PolicyID,cmPolicy *> Policies;
95 std::map<std::string,PolicyID> PolicyStringMap;
99 #endif