cmPolicies.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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 missing its location property 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. SELECT(POLICY, CMP0117, \
  346. "MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
  347. 20, 0, cmPolicies::WARN) \
  348. SELECT( \
  349. POLICY, CMP0118, \
  350. "The GENERATED source file property is now visible in all directories.", \
  351. 3, 20, 0, cmPolicies::WARN) \
  352. SELECT(POLICY, CMP0119, \
  353. "LANGUAGE source file property explicitly compiles as specified " \
  354. "language.", \
  355. 3, 20, 0, cmPolicies::WARN) \
  356. SELECT(POLICY, CMP0120, \
  357. "The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \
  358. cmPolicies::WARN) \
  359. SELECT(POLICY, CMP0121, \
  360. "The list() command now validates parsing of index arguments.", 3, \
  361. 21, 0, cmPolicies::WARN) \
  362. SELECT( \
  363. POLICY, CMP0122, \
  364. "UseSWIG use standard library name conventions for csharp language.", 3, \
  365. 21, 0, cmPolicies::WARN) \
  366. SELECT(POLICY, CMP0123, \
  367. "ARMClang cpu/arch compile and link flags must be set explicitly.", \
  368. 3, 21, 0, cmPolicies::WARN) \
  369. SELECT(POLICY, CMP0124, \
  370. "foreach() loop variables are only available in the loop scope.", 3, \
  371. 21, 0, cmPolicies::WARN) \
  372. SELECT(POLICY, CMP0125, \
  373. "find_(path|file|library|program) have consistent behavior for " \
  374. "cache variables.", \
  375. 3, 21, 0, cmPolicies::WARN) \
  376. SELECT(POLICY, CMP0126, \
  377. "set(CACHE) does not remove a normal variable of the same name.", 3, \
  378. 21, 0, cmPolicies::WARN) \
  379. SELECT(POLICY, CMP0127, \
  380. "cmake_dependent_option() supports full Condition Syntax.", 3, 22, \
  381. 0, cmPolicies::WARN) \
  382. SELECT(POLICY, CMP0128, \
  383. "Selection of language standard and extension flags improved.", 3, \
  384. 22, 0, cmPolicies::WARN) \
  385. SELECT(POLICY, CMP0129, \
  386. "Compiler id for MCST LCC compilers is now LCC, not GNU.", 3, 23, 0, \
  387. cmPolicies::WARN) \
  388. SELECT(POLICY, CMP0130, "while() diagnoses condition evaluation errors.", \
  389. 3, 24, 0, cmPolicies::WARN) \
  390. SELECT(POLICY, CMP0131, \
  391. "LINK_LIBRARIES supports the LINK_ONLY generator expression.", 3, \
  392. 24, 0, cmPolicies::WARN) \
  393. SELECT(POLICY, CMP0132, \
  394. "Do not set compiler environment variables on first run", 3, 24, 0, \
  395. cmPolicies::WARN) \
  396. SELECT(POLICY, CMP0133, \
  397. "The CPack module disables SLA by default in the CPack DragNDrop " \
  398. "Generator.", \
  399. 3, 24, 0, cmPolicies::WARN) \
  400. SELECT(POLICY, CMP0134, \
  401. "Fallback to \"HOST\" Windows registry view when \"TARGET\" view " \
  402. "is not usable.", \
  403. 3, 24, 0, cmPolicies::WARN) \
  404. SELECT(POLICY, CMP0135, \
  405. "ExternalProject ignores timestamps in archives by default for the " \
  406. "URL download method", \
  407. 3, 24, 0, cmPolicies::WARN) \
  408. SELECT(POLICY, CMP0136, \
  409. "Watcom runtime library flags are selected by an abstraction.", 3, \
  410. 24, 0, cmPolicies::WARN) \
  411. SELECT(POLICY, CMP0137, \
  412. "try_compile() passes platform variables in project mode", 3, 24, 0, \
  413. cmPolicies::WARN) \
  414. SELECT(POLICY, CMP0138, \
  415. "CheckIPOSupported uses flags from calling project.", 3, 24, 0, \
  416. cmPolicies::WARN) \
  417. SELECT( \
  418. POLICY, CMP0139, \
  419. "The if() command supports path comparisons using PATH_EQUAL operator.", \
  420. 3, 24, 0, cmPolicies::WARN) \
  421. SELECT(POLICY, CMP0140, "The return() command checks its arguments.", 3, \
  422. 25, 0, cmPolicies::WARN) \
  423. SELECT( \
  424. POLICY, CMP0141, \
  425. "MSVC debug information format flags are selected by an abstraction.", 3, \
  426. 25, 0, cmPolicies::WARN) \
  427. SELECT(POLICY, CMP0142, \
  428. "The Xcode generator does not append per-config suffixes to " \
  429. "library search paths.", \
  430. 3, 25, 0, cmPolicies::WARN) \
  431. SELECT(POLICY, CMP0143, \
  432. "Global property USE_FOLDERS treated as ON by default", 3, 26, 0, \
  433. cmPolicies::WARN) \
  434. SELECT(POLICY, CMP0144, \
  435. "find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
  436. 0, cmPolicies::WARN) \
  437. SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \
  438. 27, 0, cmPolicies::WARN) \
  439. SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, \
  440. cmPolicies::WARN) \
  441. SELECT(POLICY, CMP0147, \
  442. "Visual Studio generators build custom commands in parallel.", 3, \
  443. 27, 0, cmPolicies::WARN) \
  444. SELECT(POLICY, CMP0148, \
  445. "The FindPythonInterp and FindPythonLibs modules are removed.", 3, \
  446. 27, 0, cmPolicies::WARN)
  447. #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
  448. #define CM_FOR_EACH_POLICY_ID(POLICY) \
  449. CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
  450. #define CM_FOR_EACH_TARGET_POLICY(F) \
  451. F(CMP0003) \
  452. F(CMP0004) \
  453. F(CMP0008) \
  454. F(CMP0020) \
  455. F(CMP0021) \
  456. F(CMP0022) \
  457. F(CMP0027) \
  458. F(CMP0037) \
  459. F(CMP0038) \
  460. F(CMP0041) \
  461. F(CMP0042) \
  462. F(CMP0046) \
  463. F(CMP0052) \
  464. F(CMP0060) \
  465. F(CMP0063) \
  466. F(CMP0065) \
  467. F(CMP0068) \
  468. F(CMP0069) \
  469. F(CMP0073) \
  470. F(CMP0076) \
  471. F(CMP0081) \
  472. F(CMP0083) \
  473. F(CMP0095) \
  474. F(CMP0099) \
  475. F(CMP0104) \
  476. F(CMP0105) \
  477. F(CMP0108) \
  478. F(CMP0112) \
  479. F(CMP0113) \
  480. F(CMP0119) \
  481. F(CMP0131) \
  482. F(CMP0142)
  483. #define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
  484. F(CMP0116) \
  485. F(CMP0147)
  486. /** \class cmPolicies
  487. * \brief Handles changes in CMake behavior and policies
  488. *
  489. * See the cmake-policies(7) manual for an overview of this class's purpose.
  490. */
  491. class cmPolicies
  492. {
  493. public:
  494. /// Status of a policy
  495. enum PolicyStatus
  496. {
  497. OLD, ///< Use old behavior
  498. WARN, ///< Use old behavior but issue a warning
  499. NEW, ///< Use new behavior
  500. /// Issue an error if user doesn't set policy status to NEW and hits the
  501. /// check
  502. REQUIRED_IF_USED,
  503. REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
  504. };
  505. /// Policy identifiers
  506. enum PolicyID
  507. {
  508. #define POLICY_ENUM(POLICY_ID) POLICY_ID,
  509. CM_FOR_EACH_POLICY_ID(POLICY_ENUM)
  510. #undef POLICY_ENUM
  511. /** \brief Always the last entry.
  512. *
  513. * Useful mostly to avoid adding a comma the last policy when adding a new
  514. * one.
  515. */
  516. CMPCOUNT
  517. };
  518. //! convert a string policy ID into a number
  519. static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid);
  520. //! Get the default status for a policy
  521. static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
  522. enum class WarnCompat
  523. {
  524. Off,
  525. On
  526. };
  527. //! Set a policy level for this listfile
  528. static bool ApplyPolicyVersion(cmMakefile* mf,
  529. std::string const& version_min,
  530. std::string const& version_max,
  531. WarnCompat warnCompat);
  532. static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
  533. unsigned int minorVer, unsigned int patchVer,
  534. WarnCompat warnCompat);
  535. //! return a warning string for a given policy
  536. static std::string GetPolicyWarning(cmPolicies::PolicyID id);
  537. static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
  538. //! return an error string for when a required policy is unspecified
  539. static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
  540. //! return an error string for when a required policy is unspecified
  541. static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
  542. /** Represent a set of policy values. */
  543. struct PolicyMap
  544. {
  545. PolicyStatus Get(PolicyID id) const;
  546. void Set(PolicyID id, PolicyStatus status);
  547. bool IsDefined(PolicyID id) const;
  548. bool IsEmpty() const;
  549. private:
  550. #define POLICY_STATUS_COUNT 3
  551. std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
  552. };
  553. };