2009-09-28 15:43:28 +00:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2008-02-29 20:28:46 +00:00
|
|
|
|
2009-09-28 15:43:28 +00:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2008-02-29 20:28:46 +00:00
|
|
|
|
2009-09-28 15:43:28 +00:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2008-02-29 20:28:46 +00:00
|
|
|
#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
|
|
|
|
*
|
2008-03-01 20:26:15 +00:00
|
|
|
* See the cmake wiki section on policies for an overview of this class's
|
|
|
|
* purpose
|
2008-02-29 20:28:46 +00:00
|
|
|
*/
|
|
|
|
class cmPolicies
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmPolicies();
|
|
|
|
~cmPolicies();
|
|
|
|
|
|
|
|
enum PolicyStatus { OLD, WARN, NEW, REQUIRED_IF_USED, REQUIRED_ALWAYS };
|
|
|
|
static const char* PolicyStatusNames[];
|
|
|
|
|
2008-03-07 20:30:35 +00:00
|
|
|
enum PolicyID
|
|
|
|
{
|
2008-03-13 15:38:46 +00:00
|
|
|
CMP0000, // Policy version specification
|
|
|
|
CMP0001, // Ignore old compatibility variable
|
|
|
|
CMP0002, // Target names must be unique
|
2008-03-13 20:23:18 +00:00
|
|
|
CMP0003, // Linking does not include extra -L paths
|
2008-03-13 20:35:39 +00:00
|
|
|
CMP0004, // Libraries linked may not have leading or trailing whitespace
|
2008-03-13 21:11:57 +00:00
|
|
|
CMP0005, // Definition value escaping
|
2008-04-14 21:53:11 +00:00
|
|
|
CMP0006, // BUNDLE install rules needed for MACOSX_BUNDLE targets
|
2008-04-21 20:57:11 +00:00
|
|
|
CMP0007, // list command handling of empty elements
|
2008-07-23 16:59:14 +00:00
|
|
|
CMP0008, // Full-path libraries must be a valid library file name
|
2008-09-11 18:34:04 +00:00
|
|
|
CMP0009, // GLOB_RECURSE should not follow symlinks by default
|
2008-09-24 12:51:19 +00:00
|
|
|
CMP0010, // Bad variable reference syntax is an error
|
2009-01-22 18:18:40 +00:00
|
|
|
CMP0011, // Strong policy scope for include and find_package
|
2009-10-27 13:07:39 +00:00
|
|
|
CMP0012, // Recognize numbers and boolean constants in if()
|
2009-06-17 17:40:09 +00:00
|
|
|
CMP0013, // Duplicate binary directories not allowed
|
2009-09-03 12:27:12 +00:00
|
|
|
CMP0014, // Input directories must have CMakeLists.txt
|
2009-11-24 16:16:38 +00:00
|
|
|
CMP0015, // link_directories() treats paths relative to source dir
|
2008-03-07 21:36:57 +00:00
|
|
|
|
|
|
|
// Always the last entry. Useful mostly to avoid adding a comma
|
|
|
|
// the last policy when adding a new one.
|
2008-03-13 15:38:46 +00:00
|
|
|
CMPCOUNT
|
2008-03-07 20:30:35 +00:00
|
|
|
};
|
2008-02-29 20:28:46 +00:00
|
|
|
|
|
|
|
///! 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,
|
2010-04-23 13:50:31 +00:00
|
|
|
unsigned int tweakVersionIntroduced,
|
2008-02-29 20:28:46 +00:00
|
|
|
cmPolicies::PolicyStatus status);
|
|
|
|
|
|
|
|
///! Set a policy level for this listfile
|
|
|
|
bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
|
|
|
|
|
|
|
|
///! 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);
|
|
|
|
|
2008-08-18 20:29:00 +00:00
|
|
|
///! return an error string for when a required policy is unspecified
|
|
|
|
std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
|
|
|
|
|
2008-03-04 14:16:33 +00:00
|
|
|
///! Get docs for policies
|
|
|
|
void GetDocumentation(std::vector<cmDocumentationEntry>& v);
|
|
|
|
|
2009-01-22 15:56:39 +00:00
|
|
|
/** Represent a set of policy values. */
|
2009-01-23 17:20:09 +00:00
|
|
|
typedef std::map<PolicyID, PolicyStatus> PolicyMap;
|
2009-01-22 15:56:39 +00:00
|
|
|
|
2008-02-29 20:28:46 +00:00
|
|
|
private:
|
2008-03-02 14:12:27 +00:00
|
|
|
// might have to make these internal for VS6 not sure yet
|
|
|
|
std::map<PolicyID,cmPolicy *> Policies;
|
|
|
|
std::map<std::string,PolicyID> PolicyStringMap;
|
2008-08-18 20:29:00 +00:00
|
|
|
|
|
|
|
void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
|
|
|
|
unsigned int majorVer, unsigned int minorVer,
|
|
|
|
unsigned int patchVer, cmMakefile* mf);
|
2008-02-29 20:28:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|