2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2008-02-29 23:28:46 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2008-02-29 23:28:46 +03:00
|
|
|
|
2009-09-28 19:43:28 +04: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 23:28:46 +03: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
|
|
|
|
*
|
2012-02-26 15:54:41 +04:00
|
|
|
* See the cmake wiki section on
|
|
|
|
* <a href="http://www.cmake.org/Wiki/CMake/Policies">policies</a>
|
|
|
|
* for an overview of this class's purpose
|
2008-02-29 23:28:46 +03:00
|
|
|
*/
|
|
|
|
class cmPolicies
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmPolicies();
|
|
|
|
~cmPolicies();
|
|
|
|
|
2012-02-26 15:54:41 +04:00
|
|
|
/// Status of a policy
|
|
|
|
enum PolicyStatus {
|
|
|
|
OLD, ///< Use old behavior
|
|
|
|
WARN, ///< Use old behavior but issue a warning
|
|
|
|
NEW, ///< Use new behavior
|
|
|
|
/// Issue an error if user doesn't set policy status to NEW and hits the
|
|
|
|
/// check
|
|
|
|
REQUIRED_IF_USED,
|
|
|
|
REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
|
|
|
|
};
|
2008-02-29 23:28:46 +03:00
|
|
|
static const char* PolicyStatusNames[];
|
|
|
|
|
2012-02-26 15:54:41 +04:00
|
|
|
/// Policy identifiers
|
2008-03-07 23:30:35 +03:00
|
|
|
enum PolicyID
|
|
|
|
{
|
2012-02-26 15:54:41 +04:00
|
|
|
CMP0000, ///< Policy version specification
|
|
|
|
CMP0001, ///< Ignore old compatibility variable
|
|
|
|
CMP0002, ///< Target names must be unique
|
|
|
|
CMP0003, ///< Linking does not include extra -L paths
|
|
|
|
CMP0004, ///< Libraries linked may not have leading or trailing whitespace
|
|
|
|
CMP0005, ///< Definition value escaping
|
|
|
|
CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets
|
|
|
|
CMP0007, ///< list command handling of empty elements
|
|
|
|
CMP0008, ///< Full-path libraries must be a valid library file name
|
|
|
|
CMP0009, ///< GLOB_RECURSE should not follow symlinks by default
|
|
|
|
CMP0010, ///< Bad variable reference syntax is an error
|
|
|
|
CMP0011, ///< Strong policy scope for include and find_package
|
|
|
|
CMP0012, ///< Recognize numbers and boolean constants in if()
|
|
|
|
CMP0013, ///< Duplicate binary directories not allowed
|
|
|
|
CMP0014, ///< Input directories must have CMakeLists.txt
|
|
|
|
CMP0015, ///< link_directories() treats paths relative to source dir
|
|
|
|
/// target_link_libraries() fails if only argument is not a target
|
|
|
|
CMP0016,
|
|
|
|
CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT
|
2012-05-30 22:13:09 +04:00
|
|
|
CMP0018, ///< Ignore language flags for shared libs, and adhere to
|
|
|
|
/// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C}
|
|
|
|
/// instead.
|
2012-12-06 18:59:18 +04:00
|
|
|
CMP0019, ///< No variable re-expansion in include and link info
|
2012-11-20 17:53:41 +04:00
|
|
|
CMP0020, ///< Automatically link Qt executables to qtmain target
|
2013-03-26 21:08:29 +04:00
|
|
|
CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
|
|
|
|
/// target property
|
2013-06-04 18:25:47 +04:00
|
|
|
CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface
|
2013-06-04 18:21:33 +04:00
|
|
|
CMP0023, ///< Disallow mixing keyword and plain tll signatures
|
2013-06-18 18:33:33 +04:00
|
|
|
CMP0024, ///< Disallow including export() result.
|
2013-10-02 22:10:38 +04:00
|
|
|
CMP0025, ///< Compiler id for Apple Clang is now AppleClang
|
2013-06-28 18:37:39 +04:00
|
|
|
CMP0026, ///< Disallow use of the LOCATION target property.
|
2013-06-18 18:33:33 +04:00
|
|
|
CMP0027, ///< Conditionally linked imported targets with missing include
|
|
|
|
/// directories.
|
2013-07-30 11:51:56 +04:00
|
|
|
CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target.
|
2013-10-18 19:54:48 +04:00
|
|
|
CMP0029, ///< Disallow command: subdir_depends
|
2013-10-18 19:55:42 +04:00
|
|
|
CMP0030, ///< Disallow command: use_mangled_mesa
|
2013-10-18 20:41:54 +04:00
|
|
|
CMP0031, ///< Disallow command: load_command
|
2013-10-18 21:00:17 +04:00
|
|
|
CMP0032, ///< Disallow command: output_required_files
|
2013-10-18 21:09:32 +04:00
|
|
|
CMP0033, ///< Disallow command: export_library_dependencies
|
2013-10-21 19:50:47 +04:00
|
|
|
CMP0034, ///< Disallow command: utility_source
|
2013-10-21 19:58:48 +04:00
|
|
|
CMP0035, ///< Disallow command: variable_requires
|
2013-10-21 21:12:18 +04:00
|
|
|
CMP0036, ///< Disallow command: build_name
|
2013-11-16 14:07:24 +04:00
|
|
|
CMP0037, ///< Target names should not be reserved and
|
|
|
|
/// should match a validity pattern.
|
2013-11-05 21:01:09 +04:00
|
|
|
CMP0038, ///< Targets may not link directly to themselves
|
2013-11-05 22:15:53 +04:00
|
|
|
CMP0039, ///< Utility targets may not have link dependencies
|
2013-11-20 12:53:06 +04:00
|
|
|
CMP0040, ///< The target in the TARGET signature of
|
|
|
|
/// add_custom_command() must exist.
|
2008-03-08 00:36:57 +03:00
|
|
|
|
2012-02-26 15:54:41 +04:00
|
|
|
/** \brief Always the last entry.
|
|
|
|
*
|
|
|
|
* Useful mostly to avoid adding a comma the last policy when adding a new
|
|
|
|
* one.
|
|
|
|
*/
|
2008-03-13 18:38:46 +03:00
|
|
|
CMPCOUNT
|
2008-03-07 23:30:35 +03:00
|
|
|
};
|
2008-02-29 23:28:46 +03:00
|
|
|
|
|
|
|
///! convert a string policy ID into a number
|
|
|
|
bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
|
|
|
|
std::string GetPolicyIDString(cmPolicies::PolicyID pid);
|
2010-08-28 18:01:49 +04:00
|
|
|
|
2008-02-29 23:28:46 +03:00
|
|
|
///! Get the default status for a policy
|
|
|
|
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
|
2010-08-28 18:01:49 +04:00
|
|
|
|
2008-02-29 23:28:46 +03:00
|
|
|
///! Define a Policy for CMake
|
|
|
|
void DefinePolicy(cmPolicies::PolicyID id,
|
|
|
|
const char *stringID,
|
|
|
|
const char *shortDescription,
|
|
|
|
unsigned int majorVersionIntroduced,
|
|
|
|
unsigned int minorVersionIntroduced,
|
|
|
|
unsigned int patchVersionIntroduced,
|
2010-04-23 17:50:31 +04:00
|
|
|
unsigned int tweakVersionIntroduced,
|
2008-02-29 23:28:46 +03: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);
|
2010-08-28 18:01:49 +04:00
|
|
|
|
2008-02-29 23:28:46 +03:00
|
|
|
///! return an error string for when a required policy is unspecified
|
|
|
|
std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
|
|
|
|
|
2008-08-19 00:29:00 +04:00
|
|
|
///! return an error string for when a required policy is unspecified
|
|
|
|
std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
|
|
|
|
|
2009-01-22 18:56:39 +03:00
|
|
|
/** Represent a set of policy values. */
|
2009-01-23 20:20:09 +03:00
|
|
|
typedef std::map<PolicyID, PolicyStatus> PolicyMap;
|
2009-01-22 18:56:39 +03:00
|
|
|
|
2008-02-29 23:28:46 +03:00
|
|
|
private:
|
2008-03-02 17:12:27 +03: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-19 00:29:00 +04:00
|
|
|
|
|
|
|
void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
|
|
|
|
unsigned int majorVer, unsigned int minorVer,
|
|
|
|
unsigned int patchVer, cmMakefile* mf);
|
2011-01-04 02:04:58 +03:00
|
|
|
|
|
|
|
bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
|
|
|
|
cmPolicies::PolicyStatus* defaultStatus);
|
|
|
|
|
2008-02-29 23:28:46 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|