Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmPolicies.h
blob3804ac461c8093590fbbf58b87ed996368b3a61d
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPolicies.h,v $
5 Language: C++
6 Date: $Date: 2009-01-23 17:20:09 $
7 Version: $Revision: 1.22 $
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
49 CMP0006, // BUNDLE install rules needed for MACOSX_BUNDLE targets
50 CMP0007, // list command handling of empty elements
51 CMP0008, // Full-path libraries must be a valid library file name
52 CMP0009, // GLOB_RECURSE should not follow symlinks by default
53 CMP0010, // Bad variable reference syntax is an error
54 CMP0011, // Strong policy scope for include and find_package
56 // Always the last entry. Useful mostly to avoid adding a comma
57 // the last policy when adding a new one.
58 CMPCOUNT
61 ///! convert a string policy ID into a number
62 bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
63 std::string GetPolicyIDString(cmPolicies::PolicyID pid);
65 ///! Get the default status for a policy
66 cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
68 ///! Define a Policy for CMake
69 void DefinePolicy(cmPolicies::PolicyID id,
70 const char *stringID,
71 const char *shortDescription,
72 const char *longDescription,
73 unsigned int majorVersionIntroduced,
74 unsigned int minorVersionIntroduced,
75 unsigned int patchVersionIntroduced,
76 cmPolicies::PolicyStatus status);
78 ///! Set a policy level for this listfile
79 bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
81 ///! return a warning string for a given policy
82 std::string GetPolicyWarning(cmPolicies::PolicyID id);
84 ///! return an error string for when a required policy is unspecified
85 std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
87 ///! return an error string for when a required policy is unspecified
88 std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
90 ///! Get docs for policies
91 void GetDocumentation(std::vector<cmDocumentationEntry>& v);
93 /** Represent a set of policy values. */
94 typedef std::map<PolicyID, PolicyStatus> PolicyMap;
96 private:
97 // might have to make these internal for VS6 not sure yet
98 std::map<PolicyID,cmPolicy *> Policies;
99 std::map<std::string,PolicyID> PolicyStringMap;
101 void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
102 unsigned int majorVer, unsigned int minorVer,
103 unsigned int patchVer, cmMakefile* mf);
106 #endif