cmPolicies: Introduce XMacro table for policy data.

Use it to populate the policy enum.
This commit is contained in:
Stephen Kelly 2015-05-03 10:10:06 +02:00
parent fdca04db68
commit 6eaade8a82
1 changed files with 199 additions and 72 deletions

View File

@ -17,6 +17,202 @@
class cmMakefile;
class cmPolicy;
#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
SELECT(POLICY, CMP0000, \
"A minimum required CMake version must be specified.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0001, \
"CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0002, \
"Logical target names must be globally unique.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0003, \
"Libraries linked via full path no longer produce linker search paths.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0004, \
"Libraries linked may not have leading or trailing whitespace.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0005, \
"Preprocessor definition values are now escaped automatically.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0006, \
"Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0007, \
"list command no longer ignores empty elements.", \
2, 6, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0008, \
"Libraries linked by full-path must have a valid library file name.", \
2, 6, 1, cmPolicies::WARN) \
SELECT(POLICY, CMP0009, \
"FILE GLOB_RECURSE calls should not follow symlinks by default.", \
2, 6, 2, cmPolicies::WARN) \
SELECT(POLICY, CMP0010, \
"Bad variable reference syntax is an error.", \
2, 6, 3, cmPolicies::WARN) \
SELECT(POLICY, CMP0011, \
"Included scripts do automatic cmake_policy PUSH and POP.", \
2, 6, 3, cmPolicies::WARN) \
SELECT(POLICY, CMP0012, \
"if() recognizes numbers and boolean constants.", \
2, 8, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0013, \
"Duplicate binary directories are not allowed.", \
2, 8, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0014, \
"Input directories must have CMakeLists.txt.", \
2, 8, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0015, \
"link_directories() treats paths relative to the source dir.", \
2, 8, 1, cmPolicies::WARN) \
SELECT(POLICY, CMP0016, \
"target_link_libraries() reports error if its only argument " \
"is not a target.", \
2, 8, 3, cmPolicies::WARN) \
SELECT(POLICY, CMP0017, \
"Prefer files from the CMake module directory when including from " \
"there.", \
2, 8, 4, cmPolicies::WARN) \
SELECT(POLICY, CMP0018, \
"Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", \
2, 8, 9, cmPolicies::WARN) \
SELECT(POLICY, CMP0019, \
"Do not re-expand variables in include and link information.", \
2, 8, 11, cmPolicies::WARN) \
SELECT(POLICY, CMP0020, \
"Automatically link Qt executables to qtmain target on Windows.", \
2, 8, 11, cmPolicies::WARN) \
SELECT(POLICY, CMP0021, \
"Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
2, 8, 12, cmPolicies::WARN) \
SELECT(POLICY, CMP0022, \
"INTERFACE_LINK_LIBRARIES defines the link interface.", \
2, 8, 12, cmPolicies::WARN) \
SELECT(POLICY, CMP0023, \
"Plain and keyword target_link_libraries signatures cannot be mixed.", \
2, 8, 12, cmPolicies::WARN) \
SELECT(POLICY, CMP0024, \
"Disallow include export result.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0025, \
"Compiler id for Apple Clang is now AppleClang.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0026, \
"Disallow use of the LOCATION target property.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0027, \
"Conditionally linked imported targets with missing include " \
"directories.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0028, \
"Double colon in target name means ALIAS or IMPORTED target.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0029, \
"The subdir_depends command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0030, \
"The use_mangled_mesa command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0031, \
"The load_command command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0032, \
"The output_required_files command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0033, \
"The export_library_dependencies command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0034, \
"The utility_source command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0035, \
"The variable_requires command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0036, \
"The build_name command should not be called.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0037, \
"Target names should not be reserved and should match a validity " \
"pattern.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0038, \
"Targets may not link directly to themselves.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0039, \
"Utility targets may not have link dependencies.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0040, \
"The target in the TARGET signature of add_custom_command() must " \
"exist.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0041, \
"Error on relative include with generator expression.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0042, \
"MACOSX_RPATH is enabled by default.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0043, \
"Ignore COMPILE_DEFINITIONS_<Config> properties.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0044, \
"Case sensitive <LANG>_COMPILER_ID generator expressions.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0045, \
"Error on non-existent target in get_target_property.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0046, \
"Error on non-existent dependency in add_dependencies.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0047, \
"Use QCC compiler id for the qcc drivers on QNX.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0048, \
"project() command manages VERSION variables.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0049, \
"Do not expand variables in target source entries.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0050, \
"Disallow add_custom_command SOURCE signatures.", \
3, 0, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0051, \
"List TARGET_OBJECTS in SOURCES target property.", \
3, 1, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0052, \
"Reject source and build dirs in installed " \
"INTERFACE_INCLUDE_DIRECTORIES.", \
3, 1, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0053, \
"Simplify variable reference and escape sequence evaluation.", \
3, 1, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0054, \
"Only interpret if() arguments as variables or keywords when unquoted.", \
3, 1, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0055, \
"Strict checking for break() command.", \
3, 2, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0056, \
"Honor link flags in try_compile() source-file signature.", \
3, 2, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0057, \
"Support new IN_LIST if() operator.", \
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0058, \
"Ninja requires custom command byproducts to be explicit.", \
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0059, \
"Do no treat DEFINITIONS as a built-in directory property.", \
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0060, \
"Link libraries by full path even in implicit directories.", \
3, 3, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
*
@ -44,78 +240,9 @@ public:
/// Policy identifiers
enum PolicyID
{
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
CMP0018, ///< Ignore language flags for shared libs, and adhere to
/// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C}
/// instead.
CMP0019, ///< No variable re-expansion in include and link info
CMP0020, ///< Automatically link Qt executables to qtmain target
CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
/// target property
CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface
CMP0023, ///< Disallow mixing keyword and plain tll signatures
CMP0024, ///< Disallow including export() result.
CMP0025, ///< Compiler id for Apple Clang is now AppleClang
CMP0026, ///< Disallow use of the LOCATION target property.
CMP0027, ///< Conditionally linked imported targets with missing include
/// directories.
CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target.
CMP0029, ///< Disallow command: subdir_depends
CMP0030, ///< Disallow command: use_mangled_mesa
CMP0031, ///< Disallow command: load_command
CMP0032, ///< Disallow command: output_required_files
CMP0033, ///< Disallow command: export_library_dependencies
CMP0034, ///< Disallow command: utility_source
CMP0035, ///< Disallow command: variable_requires
CMP0036, ///< Disallow command: build_name
CMP0037, ///< Target names should not be reserved and
/// should match a validity pattern.
CMP0038, ///< Targets may not link directly to themselves
CMP0039, ///< Utility targets may not have link dependencies
CMP0040, ///< The target in the TARGET signature of
/// add_custom_command() must exist.
CMP0041, ///< Error on relative include with generator expression
CMP0042, ///< Enable MACOSX_RPATH by default
CMP0043, ///< Ignore COMPILE_DEFINITIONS_<Config> properties
CMP0044, ///< Case sensitive <LANG>_COMPILER_ID generator expressions
CMP0045, ///< Error on non-existent target in get_target_property
CMP0046, ///< Error on non-existent dependency in add_dependencies
CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX.
CMP0048, ///< project() command manages VERSION variables
CMP0049, ///< Do not expand variables in target source entries
CMP0050, ///< Disallow add_custom_command SOURCE signatures
CMP0051, ///< List TARGET_OBJECTS in SOURCES target property
CMP0052, ///< Reject source and build dirs in installed
/// INTERFACE_INCLUDE_DIRECTORIES
CMP0053, ///< Simplify variable reference and escape sequence evaluation
CMP0054, ///< Only interpret if() arguments as variables
/// or keywords when unquoted.
CMP0055, ///< Strict checking for break() command.
CMP0056, ///< Honor link flags in try_compile() source-file signature.
CMP0057, ///< Support new IN_LIST if() operator.
CMP0058, ///< Ninja requires custom command byproducts to be explicit
CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory
/// property.
CMP0060, ///< Link libraries by full path even in implicit directories.
#define POLICY_ENUM(POLICY_ID) POLICY_ID,
CM_FOR_EACH_POLICY_ID(POLICY_ENUM)
#undef POLICY_ENUM
/** \brief Always the last entry.
*