cmPolicies.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <bitset>
  6. #include <string>
  7. class cmMakefile;
  8. #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
  9. SELECT(POLICY, CMP0000, \
  10. "A minimum required CMake version must be specified.", 2, 6, 0, \
  11. cmPolicies::WARN) \
  12. SELECT(POLICY, CMP0001, \
  13. "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0, \
  14. cmPolicies::WARN) \
  15. SELECT(POLICY, CMP0002, "Logical target names must be globally unique.", 2, \
  16. 6, 0, cmPolicies::WARN) \
  17. SELECT( \
  18. POLICY, CMP0003, \
  19. "Libraries linked via full path no longer produce linker search paths.", \
  20. 2, 6, 0, cmPolicies::WARN) \
  21. SELECT(POLICY, CMP0004, \
  22. "Libraries linked may not have leading or trailing whitespace.", 2, \
  23. 6, 0, cmPolicies::WARN) \
  24. SELECT(POLICY, CMP0005, \
  25. "Preprocessor definition values are now escaped automatically.", 2, \
  26. 6, 0, cmPolicies::WARN) \
  27. SELECT(POLICY, CMP0006, \
  28. "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
  29. 2, 6, 0, cmPolicies::WARN) \
  30. SELECT(POLICY, CMP0007, "list command no longer ignores empty elements.", \
  31. 2, 6, 0, cmPolicies::WARN) \
  32. SELECT( \
  33. POLICY, CMP0008, \
  34. "Libraries linked by full-path must have a valid library file name.", 2, \
  35. 6, 1, cmPolicies::WARN) \
  36. SELECT(POLICY, CMP0009, \
  37. "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
  38. 6, 2, cmPolicies::WARN) \
  39. SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
  40. 3, cmPolicies::WARN) \
  41. SELECT(POLICY, CMP0011, \
  42. "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
  43. cmPolicies::WARN) \
  44. SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.", \
  45. 2, 8, 0, cmPolicies::WARN) \
  46. SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \
  47. 8, 0, cmPolicies::WARN) \
  48. SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2, \
  49. 8, 0, cmPolicies::WARN) \
  50. SELECT(POLICY, CMP0015, \
  51. "link_directories() treats paths relative to the source dir.", 2, 8, \
  52. 1, cmPolicies::WARN) \
  53. SELECT(POLICY, CMP0016, \
  54. "target_link_libraries() reports error if its only argument " \
  55. "is not a target.", \
  56. 2, 8, 3, cmPolicies::WARN) \
  57. SELECT(POLICY, CMP0017, \
  58. "Prefer files from the CMake module directory when including from " \
  59. "there.", \
  60. 2, 8, 4, cmPolicies::WARN) \
  61. SELECT(POLICY, CMP0018, \
  62. "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, \
  63. cmPolicies::WARN) \
  64. SELECT(POLICY, CMP0019, \
  65. "Do not re-expand variables in include and link information.", 2, 8, \
  66. 11, cmPolicies::WARN) \
  67. SELECT(POLICY, CMP0020, \
  68. "Automatically link Qt executables to qtmain target on Windows.", 2, \
  69. 8, 11, cmPolicies::WARN) \
  70. SELECT( \
  71. POLICY, CMP0021, \
  72. "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
  73. 2, 8, 12, cmPolicies::WARN) \
  74. SELECT(POLICY, CMP0022, \
  75. "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \
  76. cmPolicies::WARN) \
  77. SELECT( \
  78. POLICY, CMP0023, \
  79. "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
  80. 8, 12, cmPolicies::WARN) \
  81. SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, \
  82. cmPolicies::WARN) \
  83. SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \
  84. 3, 0, 0, cmPolicies::WARN) \
  85. SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \
  86. 0, 0, cmPolicies::WARN) \
  87. SELECT(POLICY, CMP0027, \
  88. "Conditionally linked imported targets with missing include " \
  89. "directories.", \
  90. 3, 0, 0, cmPolicies::WARN) \
  91. SELECT(POLICY, CMP0028, \
  92. "Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \
  93. 0, cmPolicies::WARN) \
  94. SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
  95. 3, 0, 0, cmPolicies::WARN) \
  96. SELECT(POLICY, CMP0030, \
  97. "The use_mangled_mesa command should not be called.", 3, 0, 0, \
  98. cmPolicies::WARN) \
  99. SELECT(POLICY, CMP0031, "The load_command command should not be called.", \
  100. 3, 0, 0, cmPolicies::WARN) \
  101. SELECT(POLICY, CMP0032, \
  102. "The output_required_files command should not be called.", 3, 0, 0, \
  103. cmPolicies::WARN) \
  104. SELECT(POLICY, CMP0033, \
  105. "The export_library_dependencies command should not be called.", 3, \
  106. 0, 0, cmPolicies::WARN) \
  107. SELECT(POLICY, CMP0034, "The utility_source command should not be called.", \
  108. 3, 0, 0, cmPolicies::WARN) \
  109. SELECT(POLICY, CMP0035, \
  110. "The variable_requires command should not be called.", 3, 0, 0, \
  111. cmPolicies::WARN) \
  112. SELECT(POLICY, CMP0036, "The build_name command should not be called.", 3, \
  113. 0, 0, cmPolicies::WARN) \
  114. SELECT(POLICY, CMP0037, \
  115. "Target names should not be reserved and should match a validity " \
  116. "pattern.", \
  117. 3, 0, 0, cmPolicies::WARN) \
  118. SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3, \
  119. 0, 0, cmPolicies::WARN) \
  120. SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.", \
  121. 3, 0, 0, cmPolicies::WARN) \
  122. SELECT(POLICY, CMP0040, \
  123. "The target in the TARGET signature of add_custom_command() must " \
  124. "exist and must be defined in the current directory.", \
  125. 3, 0, 0, cmPolicies::WARN) \
  126. SELECT(POLICY, CMP0041, \
  127. "Error on relative include with generator expression.", 3, 0, 0, \
  128. cmPolicies::WARN) \
  129. SELECT(POLICY, CMP0042, "MACOSX_RPATH is enabled by default.", 3, 0, 0, \
  130. cmPolicies::WARN) \
  131. SELECT(POLICY, CMP0043, "Ignore COMPILE_DEFINITIONS_<Config> properties.", \
  132. 3, 0, 0, cmPolicies::WARN) \
  133. SELECT(POLICY, CMP0044, \
  134. "Case sensitive <LANG>_COMPILER_ID generator expressions.", 3, 0, 0, \
  135. cmPolicies::WARN) \
  136. SELECT(POLICY, CMP0045, \
  137. "Error on non-existent target in get_target_property.", 3, 0, 0, \
  138. cmPolicies::WARN) \
  139. SELECT(POLICY, CMP0046, \
  140. "Error on non-existent dependency in add_dependencies.", 3, 0, 0, \
  141. cmPolicies::WARN) \
  142. SELECT(POLICY, CMP0047, "Use QCC compiler id for the qcc drivers on QNX.", \
  143. 3, 0, 0, cmPolicies::WARN) \
  144. SELECT(POLICY, CMP0048, "project() command manages VERSION variables.", 3, \
  145. 0, 0, cmPolicies::WARN) \
  146. SELECT(POLICY, CMP0049, \
  147. "Do not expand variables in target source entries.", 3, 0, 0, \
  148. cmPolicies::WARN) \
  149. SELECT(POLICY, CMP0050, "Disallow add_custom_command SOURCE signatures.", \
  150. 3, 0, 0, cmPolicies::WARN) \
  151. SELECT(POLICY, CMP0051, "List TARGET_OBJECTS in SOURCES target property.", \
  152. 3, 1, 0, cmPolicies::WARN) \
  153. SELECT(POLICY, CMP0052, \
  154. "Reject source and build dirs in installed " \
  155. "INTERFACE_INCLUDE_DIRECTORIES.", \
  156. 3, 1, 0, cmPolicies::WARN) \
  157. SELECT(POLICY, CMP0053, \
  158. "Simplify variable reference and escape sequence evaluation.", 3, 1, \
  159. 0, cmPolicies::WARN) \
  160. SELECT( \
  161. POLICY, CMP0054, \
  162. "Only interpret if() arguments as variables or keywords when unquoted.", \
  163. 3, 1, 0, cmPolicies::WARN) \
  164. SELECT(POLICY, CMP0055, "Strict checking for break() command.", 3, 2, 0, \
  165. cmPolicies::WARN) \
  166. SELECT(POLICY, CMP0056, \
  167. "Honor link flags in try_compile() source-file signature.", 3, 2, 0, \
  168. cmPolicies::WARN) \
  169. SELECT(POLICY, CMP0057, "Support new IN_LIST if() operator.", 3, 3, 0, \
  170. cmPolicies::WARN) \
  171. SELECT(POLICY, CMP0058, \
  172. "Ninja requires custom command byproducts to be explicit.", 3, 3, 0, \
  173. cmPolicies::WARN) \
  174. SELECT(POLICY, CMP0059, \
  175. "Do not treat DEFINITIONS as a built-in directory property.", 3, 3, \
  176. 0, cmPolicies::WARN) \
  177. SELECT(POLICY, CMP0060, \
  178. "Link libraries by full path even in implicit directories.", 3, 3, \
  179. 0, cmPolicies::WARN) \
  180. SELECT(POLICY, CMP0061, \
  181. "CTest does not by default tell make to ignore errors (-i).", 3, 3, \
  182. 0, cmPolicies::WARN) \
  183. SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
  184. cmPolicies::WARN) \
  185. SELECT(POLICY, CMP0063, \
  186. "Honor visibility properties for all target types.", 3, 3, 0, \
  187. cmPolicies::WARN) \
  188. SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, \
  189. cmPolicies::WARN) \
  190. SELECT(POLICY, CMP0065, \
  191. "Do not add flags to export symbols from executables without " \
  192. "the ENABLE_EXPORTS target property.", \
  193. 3, 4, 0, cmPolicies::WARN) \
  194. SELECT(POLICY, CMP0066, \
  195. "Honor per-config flags in try_compile() source-file signature.", 3, \
  196. 7, 0, cmPolicies::WARN) \
  197. SELECT(POLICY, CMP0067, \
  198. "Honor language standard in try_compile() source-file signature.", \
  199. 3, 8, 0, cmPolicies::WARN) \
  200. SELECT(POLICY, CMP0068, \
  201. "RPATH settings on macOS do not affect install_name.", 3, 9, 0, \
  202. cmPolicies::WARN) \
  203. SELECT(POLICY, CMP0069, \
  204. "INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0, \
  205. cmPolicies::WARN) \
  206. SELECT(POLICY, CMP0070, \
  207. "Define file(GENERATE) behavior for relative paths.", 3, 10, 0, \
  208. cmPolicies::WARN) \
  209. SELECT(POLICY, CMP0071, "Let AUTOMOC and AUTOUIC process GENERATED files.", \
  210. 3, 10, 0, cmPolicies::WARN) \
  211. SELECT(POLICY, CMP0072, \
  212. "FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \
  213. cmPolicies::WARN) \
  214. SELECT(POLICY, CMP0073, \
  215. "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \
  216. cmPolicies::WARN) \
  217. SELECT(POLICY, CMP0074, "find_package uses <PackageName>_ROOT variables.", \
  218. 3, 12, 0, cmPolicies::WARN) \
  219. SELECT(POLICY, CMP0075, \
  220. "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \
  221. 0, cmPolicies::WARN) \
  222. SELECT(POLICY, CMP0076, \
  223. "target_sources() command converts relative paths to absolute.", 3, \
  224. 13, 0, cmPolicies::WARN) \
  225. SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \
  226. cmPolicies::WARN) \
  227. SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \
  228. 0, cmPolicies::WARN) \
  229. SELECT( \
  230. POLICY, CMP0079, \
  231. "target_link_libraries allows use with targets in other directories.", 3, \
  232. 13, 0, cmPolicies::WARN) \
  233. SELECT(POLICY, CMP0080, \
  234. "BundleUtilities cannot be included at configure time.", 3, 13, 0, \
  235. cmPolicies::WARN) \
  236. SELECT(POLICY, CMP0081, \
  237. "Relative paths not allowed in LINK_DIRECTORIES target property.", \
  238. 3, 13, 0, cmPolicies::WARN) \
  239. SELECT(POLICY, CMP0082, \
  240. "Install rules from add_subdirectory() are interleaved with those " \
  241. "in caller.", \
  242. 3, 14, 0, cmPolicies::WARN) \
  243. SELECT(POLICY, CMP0083, "Add PIE options when linking executable.", 3, 14, \
  244. 0, cmPolicies::WARN) \
  245. SELECT(POLICY, CMP0084, \
  246. "The FindQt module does not exist for find_package().", 3, 14, 0, \
  247. cmPolicies::WARN) \
  248. SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14, \
  249. 0, cmPolicies::WARN) \
  250. SELECT(POLICY, CMP0086, \
  251. "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, \
  252. cmPolicies::WARN) \
  253. SELECT(POLICY, CMP0087, \
  254. "Install CODE|SCRIPT allow the use of generator " \
  255. "expressions.", \
  256. 3, 14, 0, cmPolicies::WARN) \
  257. SELECT(POLICY, CMP0088, \
  258. "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \
  259. 3, 14, 0, cmPolicies::WARN) \
  260. SELECT(POLICY, CMP0089, \
  261. "Compiler id for IBM Clang-based XL compilers is now XLClang.", 3, \
  262. 15, 0, cmPolicies::WARN) \
  263. SELECT(POLICY, CMP0090, \
  264. "export(PACKAGE) does not populate package registry by default.", 3, \
  265. 15, 0, cmPolicies::WARN) \
  266. SELECT(POLICY, CMP0091, \
  267. "MSVC runtime library flags are selected by an abstraction.", 3, 15, \
  268. 0, cmPolicies::WARN) \
  269. SELECT(POLICY, CMP0092, \
  270. "MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3, \
  271. 15, 0, cmPolicies::WARN) \
  272. SELECT(POLICY, CMP0093, "FindBoost reports Boost_VERSION in x.y.z format.", \
  273. 3, 15, 0, cmPolicies::WARN) \
  274. SELECT(POLICY, CMP0094, \
  275. "FindPython3, FindPython2 and FindPyton use " \
  276. "LOCATION for lookup strategy.", \
  277. 3, 15, 0, cmPolicies::WARN) \
  278. SELECT(POLICY, CMP0095, \
  279. "RPATH entries are properly escaped in the intermediary CMake " \
  280. "install script.", \
  281. 3, 16, 0, cmPolicies::WARN) \
  282. SELECT(POLICY, CMP0096, \
  283. "project() preserves leading zeros in version components.", 3, 16, \
  284. 0, cmPolicies::WARN) \
  285. SELECT(POLICY, CMP0097, \
  286. "ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
  287. "submodules.", \
  288. 3, 16, 0, cmPolicies::WARN) \
  289. SELECT(POLICY, CMP0098, \
  290. "FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
  291. 17, 0, cmPolicies::WARN) \
  292. SELECT(POLICY, CMP0099, \
  293. "Link properties are transitive over private dependency on static " \
  294. "libraries.", \
  295. 3, 17, 0, cmPolicies::WARN) \
  296. SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \
  297. 17, 0, cmPolicies::WARN) \
  298. SELECT(POLICY, CMP0101, \
  299. "target_compile_options honors BEFORE keyword in all scopes.", 3, \
  300. 17, 0, cmPolicies::WARN) \
  301. SELECT(POLICY, CMP0102, \
  302. "mark_as_advanced() does nothing if a cache entry does not exist.", \
  303. 3, 17, 0, cmPolicies::WARN) \
  304. SELECT(POLICY, CMP0103, \
  305. "Multiple export() with same FILE without APPEND is not allowed.", \
  306. 3, 18, 0, cmPolicies::WARN) \
  307. SELECT(POLICY, CMP0104, \
  308. "CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty " \
  309. "CUDA_ARCHITECTURES not allowed.", \
  310. 3, 18, 0, cmPolicies::WARN) \
  311. SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18, \
  312. 0, cmPolicies::WARN) \
  313. SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \
  314. cmPolicies::WARN) \
  315. SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \
  316. 3, 18, 0, cmPolicies::WARN) \
  317. SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \
  318. 3, 18, 0, cmPolicies::WARN) \
  319. SELECT(POLICY, CMP0109, \
  320. "find_program() requires permission to execute but not to read.", 3, \
  321. 19, 0, cmPolicies::WARN) \
  322. SELECT(POLICY, CMP0110, \
  323. "add_test() supports arbitrary characters in test names.", 3, 19, 0, \
  324. cmPolicies::WARN) \
  325. SELECT(POLICY, CMP0111, \
  326. "An imported target with a missing location fails during " \
  327. "generation.", \
  328. 3, 19, 0, cmPolicies::WARN) \
  329. SELECT(POLICY, CMP0112, \
  330. "Target file component generator expressions do not add target " \
  331. "dependencies.", \
  332. 3, 19, 0, cmPolicies::WARN) \
  333. SELECT(POLICY, CMP0113, \
  334. "Makefile generators do not repeat custom commands from target " \
  335. "dependencies.", \
  336. 3, 19, 0, cmPolicies::WARN) \
  337. SELECT(POLICY, CMP0114, \
  338. "ExternalProject step targets fully adopt their steps.", 3, 19, 0, \
  339. cmPolicies::WARN) \
  340. SELECT(POLICY, CMP0115, "Source file extensions must be explicit.", 3, 20, \
  341. 0, cmPolicies::WARN) \
  342. SELECT(POLICY, CMP0116, \
  343. "Ninja generators transform DEPFILEs from add_custom_command().", 3, \
  344. 20, 0, cmPolicies::WARN)
  345. #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
  346. #define CM_FOR_EACH_POLICY_ID(POLICY) \
  347. CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
  348. #define CM_FOR_EACH_TARGET_POLICY(F) \
  349. F(CMP0003) \
  350. F(CMP0004) \
  351. F(CMP0008) \
  352. F(CMP0020) \
  353. F(CMP0021) \
  354. F(CMP0022) \
  355. F(CMP0027) \
  356. F(CMP0037) \
  357. F(CMP0038) \
  358. F(CMP0041) \
  359. F(CMP0042) \
  360. F(CMP0046) \
  361. F(CMP0052) \
  362. F(CMP0060) \
  363. F(CMP0063) \
  364. F(CMP0065) \
  365. F(CMP0068) \
  366. F(CMP0069) \
  367. F(CMP0073) \
  368. F(CMP0076) \
  369. F(CMP0081) \
  370. F(CMP0083) \
  371. F(CMP0095) \
  372. F(CMP0099) \
  373. F(CMP0104) \
  374. F(CMP0105) \
  375. F(CMP0108) \
  376. F(CMP0112) \
  377. F(CMP0113)
  378. /** \class cmPolicies
  379. * \brief Handles changes in CMake behavior and policies
  380. *
  381. * See the cmake-policies(7) manual for an overview of this class's purpose.
  382. */
  383. class cmPolicies
  384. {
  385. public:
  386. /// Status of a policy
  387. enum PolicyStatus
  388. {
  389. OLD, ///< Use old behavior
  390. WARN, ///< Use old behavior but issue a warning
  391. NEW, ///< Use new behavior
  392. /// Issue an error if user doesn't set policy status to NEW and hits the
  393. /// check
  394. REQUIRED_IF_USED,
  395. REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
  396. };
  397. /// Policy identifiers
  398. enum PolicyID
  399. {
  400. #define POLICY_ENUM(POLICY_ID) POLICY_ID,
  401. CM_FOR_EACH_POLICY_ID(POLICY_ENUM)
  402. #undef POLICY_ENUM
  403. /** \brief Always the last entry.
  404. *
  405. * Useful mostly to avoid adding a comma the last policy when adding a new
  406. * one.
  407. */
  408. CMPCOUNT
  409. };
  410. //! convert a string policy ID into a number
  411. static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid);
  412. //! Get the default status for a policy
  413. static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
  414. enum class WarnCompat
  415. {
  416. Off,
  417. On
  418. };
  419. //! Set a policy level for this listfile
  420. static bool ApplyPolicyVersion(cmMakefile* mf,
  421. std::string const& version_min,
  422. std::string const& version_max,
  423. WarnCompat warnCompat);
  424. static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
  425. unsigned int minorVer, unsigned int patchVer,
  426. WarnCompat warnCompat);
  427. //! return a warning string for a given policy
  428. static std::string GetPolicyWarning(cmPolicies::PolicyID id);
  429. static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
  430. //! return an error string for when a required policy is unspecified
  431. static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
  432. //! return an error string for when a required policy is unspecified
  433. static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
  434. /** Represent a set of policy values. */
  435. struct PolicyMap
  436. {
  437. PolicyStatus Get(PolicyID id) const;
  438. void Set(PolicyID id, PolicyStatus status);
  439. bool IsDefined(PolicyID id) const;
  440. bool IsEmpty() const;
  441. private:
  442. #define POLICY_STATUS_COUNT 3
  443. std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
  444. };
  445. };