BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmPolicies.h
blob5c50dd310fa50416396b949313aa18b4fe77126f
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPolicies.h,v $
5 Language: C++
6 Date: $Date: 2008-09-24 12:51:19 $
7 Version: $Revision: 1.19 $
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
55 // Always the last entry. Useful mostly to avoid adding a comma
56 // the last policy when adding a new one.
57 CMPCOUNT
60 ///! convert a string policy ID into a number
61 bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
62 std::string GetPolicyIDString(cmPolicies::PolicyID pid);
64 ///! Get the default status for a policy
65 cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
67 ///! Define a Policy for CMake
68 void DefinePolicy(cmPolicies::PolicyID id,
69 const char *stringID,
70 const char *shortDescription,
71 const char *longDescription,
72 unsigned int majorVersionIntroduced,
73 unsigned int minorVersionIntroduced,
74 unsigned int patchVersionIntroduced,
75 cmPolicies::PolicyStatus status);
77 ///! Set a policy level for this listfile
78 bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
80 ///! return a warning string for a given policy
81 std::string GetPolicyWarning(cmPolicies::PolicyID id);
83 ///! return an error string for when a required policy is unspecified
84 std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
86 ///! return an error string for when a required policy is unspecified
87 std::string GetRequiredAlwaysPolicyError(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;
97 void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
98 unsigned int majorVer, unsigned int minorVer,
99 unsigned int patchVer, cmMakefile* mf);
102 #endif