cmPolicies.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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. // Each policy has a short description, the version of CMake in which
  9. // it was introduced, and its default status. The status is WARN for
  10. // existing policies and NEW for removed policies.
  11. #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
  12. SELECT(POLICY, CMP0000, \
  13. "A minimum required CMake version must be specified.", 2, 6, 0, NEW) \
  14. SELECT(POLICY, CMP0001, \
  15. "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0, \
  16. NEW) \
  17. SELECT(POLICY, CMP0002, "Logical target names must be globally unique.", 2, \
  18. 6, 0, NEW) \
  19. SELECT( \
  20. POLICY, CMP0003, \
  21. "Libraries linked via full path no longer produce linker search paths.", \
  22. 2, 6, 0, NEW) \
  23. SELECT(POLICY, CMP0004, \
  24. "Libraries linked may not have leading or trailing whitespace.", 2, \
  25. 6, 0, NEW) \
  26. SELECT(POLICY, CMP0005, \
  27. "Preprocessor definition values are now escaped automatically.", 2, \
  28. 6, 0, NEW) \
  29. SELECT(POLICY, CMP0006, \
  30. "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
  31. 2, 6, 0, NEW) \
  32. SELECT(POLICY, CMP0007, "list command no longer ignores empty elements.", \
  33. 2, 6, 0, NEW) \
  34. SELECT( \
  35. POLICY, CMP0008, \
  36. "Libraries linked by full-path must have a valid library file name.", 2, \
  37. 6, 1, NEW) \
  38. SELECT(POLICY, CMP0009, \
  39. "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
  40. 6, 2, NEW) \
  41. SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
  42. 3, NEW) \
  43. SELECT(POLICY, CMP0011, \
  44. "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
  45. NEW) \
  46. SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.", \
  47. 2, 8, 0, NEW) \
  48. SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \
  49. 8, 0, NEW) \
  50. SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2, \
  51. 8, 0, NEW) \
  52. SELECT(POLICY, CMP0015, \
  53. "link_directories() treats paths relative to the source dir.", 2, 8, \
  54. 1, NEW) \
  55. SELECT(POLICY, CMP0016, \
  56. "target_link_libraries() reports error if its only argument " \
  57. "is not a target.", \
  58. 2, 8, 3, NEW) \
  59. SELECT(POLICY, CMP0017, \
  60. "Prefer files from the CMake module directory when including from " \
  61. "there.", \
  62. 2, 8, 4, NEW) \
  63. SELECT(POLICY, CMP0018, \
  64. "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, NEW) \
  65. SELECT(POLICY, CMP0019, \
  66. "Do not re-expand variables in include and link information.", 2, 8, \
  67. 11, NEW) \
  68. SELECT(POLICY, CMP0020, \
  69. "Automatically link Qt executables to qtmain target on Windows.", 2, \
  70. 8, 11, NEW) \
  71. SELECT( \
  72. POLICY, CMP0021, \
  73. "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
  74. 2, 8, 12, NEW) \
  75. SELECT(POLICY, CMP0022, \
  76. "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \
  77. NEW) \
  78. SELECT( \
  79. POLICY, CMP0023, \
  80. "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
  81. 8, 12, NEW) \
  82. SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, NEW) \
  83. SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \
  84. 3, 0, 0, NEW) \
  85. SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \
  86. 0, 0, NEW) \
  87. SELECT(POLICY, CMP0027, \
  88. "Conditionally linked imported targets with missing include " \
  89. "directories.", \
  90. 3, 0, 0, NEW) \
  91. SELECT(POLICY, CMP0028, \
  92. "Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \
  93. 0, NEW) \
  94. SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
  95. 3, 0, 0, NEW) \
  96. SELECT(POLICY, CMP0030, \
  97. "The use_mangled_mesa command should not be called.", 3, 0, 0, NEW) \
  98. SELECT(POLICY, CMP0031, "The load_command command should not be called.", \
  99. 3, 0, 0, NEW) \
  100. SELECT(POLICY, CMP0032, \
  101. "The output_required_files command should not be called.", 3, 0, 0, \
  102. NEW) \
  103. SELECT(POLICY, CMP0033, \
  104. "The export_library_dependencies command should not be called.", 3, \
  105. 0, 0, NEW) \
  106. SELECT(POLICY, CMP0034, "The utility_source command should not be called.", \
  107. 3, 0, 0, NEW) \
  108. SELECT(POLICY, CMP0035, \
  109. "The variable_requires command should not be called.", 3, 0, 0, NEW) \
  110. SELECT(POLICY, CMP0036, "The build_name command should not be called.", 3, \
  111. 0, 0, NEW) \
  112. SELECT(POLICY, CMP0037, \
  113. "Target names should not be reserved and should match a validity " \
  114. "pattern.", \
  115. 3, 0, 0, NEW) \
  116. SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3, \
  117. 0, 0, NEW) \
  118. SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.", \
  119. 3, 0, 0, NEW) \
  120. SELECT(POLICY, CMP0040, \
  121. "The target in the TARGET signature of add_custom_command() must " \
  122. "exist and must be defined in the current directory.", \
  123. 3, 0, 0, NEW) \
  124. SELECT(POLICY, CMP0041, \
  125. "Error on relative include with generator expression.", 3, 0, 0, \
  126. NEW) \
  127. SELECT(POLICY, CMP0042, "MACOSX_RPATH is enabled by default.", 3, 0, 0, \
  128. NEW) \
  129. SELECT(POLICY, CMP0043, "Ignore COMPILE_DEFINITIONS_<Config> properties.", \
  130. 3, 0, 0, NEW) \
  131. SELECT(POLICY, CMP0044, \
  132. "Case sensitive <LANG>_COMPILER_ID generator expressions.", 3, 0, 0, \
  133. NEW) \
  134. SELECT(POLICY, CMP0045, \
  135. "Error on non-existent target in get_target_property.", 3, 0, 0, \
  136. NEW) \
  137. SELECT(POLICY, CMP0046, \
  138. "Error on non-existent dependency in add_dependencies.", 3, 0, 0, \
  139. NEW) \
  140. SELECT(POLICY, CMP0047, "Use QCC compiler id for the qcc drivers on QNX.", \
  141. 3, 0, 0, NEW) \
  142. SELECT(POLICY, CMP0048, "project() command manages VERSION variables.", 3, \
  143. 0, 0, NEW) \
  144. SELECT(POLICY, CMP0049, \
  145. "Do not expand variables in target source entries.", 3, 0, 0, NEW) \
  146. SELECT(POLICY, CMP0050, "Disallow add_custom_command SOURCE signatures.", \
  147. 3, 0, 0, NEW) \
  148. SELECT(POLICY, CMP0051, "List TARGET_OBJECTS in SOURCES target property.", \
  149. 3, 1, 0, NEW) \
  150. SELECT(POLICY, CMP0052, \
  151. "Reject source and build dirs in installed " \
  152. "INTERFACE_INCLUDE_DIRECTORIES.", \
  153. 3, 1, 0, NEW) \
  154. SELECT(POLICY, CMP0053, \
  155. "Simplify variable reference and escape sequence evaluation.", 3, 1, \
  156. 0, NEW) \
  157. SELECT( \
  158. POLICY, CMP0054, \
  159. "Only interpret if() arguments as variables or keywords when unquoted.", \
  160. 3, 1, 0, NEW) \
  161. SELECT(POLICY, CMP0055, "Strict checking for break() command.", 3, 2, 0, \
  162. NEW) \
  163. SELECT(POLICY, CMP0056, \
  164. "Honor link flags in try_compile() source-file signature.", 3, 2, 0, \
  165. NEW) \
  166. SELECT(POLICY, CMP0057, "Support new IN_LIST if() operator.", 3, 3, 0, NEW) \
  167. SELECT(POLICY, CMP0058, \
  168. "Ninja requires custom command byproducts to be explicit.", 3, 3, 0, \
  169. NEW) \
  170. SELECT(POLICY, CMP0059, \
  171. "Do not treat DEFINITIONS as a built-in directory property.", 3, 3, \
  172. 0, NEW) \
  173. SELECT(POLICY, CMP0060, \
  174. "Link libraries by full path even in implicit directories.", 3, 3, \
  175. 0, NEW) \
  176. SELECT(POLICY, CMP0061, \
  177. "CTest does not by default tell make to ignore errors (-i).", 3, 3, \
  178. 0, NEW) \
  179. SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
  180. NEW) \
  181. SELECT(POLICY, CMP0063, \
  182. "Honor visibility properties for all target types.", 3, 3, 0, NEW) \
  183. SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, NEW) \
  184. SELECT(POLICY, CMP0065, \
  185. "Do not add flags to export symbols from executables without " \
  186. "the ENABLE_EXPORTS target property.", \
  187. 3, 4, 0, NEW) \
  188. SELECT(POLICY, CMP0066, \
  189. "Honor per-config flags in try_compile() source-file signature.", 3, \
  190. 7, 0, WARN) \
  191. SELECT(POLICY, CMP0067, \
  192. "Honor language standard in try_compile() source-file signature.", \
  193. 3, 8, 0, WARN) \
  194. SELECT(POLICY, CMP0068, \
  195. "RPATH settings on macOS do not affect install_name.", 3, 9, 0, \
  196. WARN) \
  197. SELECT(POLICY, CMP0069, \
  198. "INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0, \
  199. WARN) \
  200. SELECT(POLICY, CMP0070, \
  201. "Define file(GENERATE) behavior for relative paths.", 3, 10, 0, \
  202. WARN) \
  203. SELECT(POLICY, CMP0071, "Let AUTOMOC and AUTOUIC process GENERATED files.", \
  204. 3, 10, 0, WARN) \
  205. SELECT(POLICY, CMP0072, \
  206. "FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \
  207. WARN) \
  208. SELECT(POLICY, CMP0073, \
  209. "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, WARN) \
  210. SELECT(POLICY, CMP0074, "find_package uses <PackageName>_ROOT variables.", \
  211. 3, 12, 0, WARN) \
  212. SELECT(POLICY, CMP0075, \
  213. "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \
  214. 0, WARN) \
  215. SELECT(POLICY, CMP0076, \
  216. "target_sources() command converts relative paths to absolute.", 3, \
  217. 13, 0, WARN) \
  218. SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \
  219. WARN) \
  220. SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \
  221. 0, WARN) \
  222. SELECT( \
  223. POLICY, CMP0079, \
  224. "target_link_libraries allows use with targets in other directories.", 3, \
  225. 13, 0, WARN) \
  226. SELECT(POLICY, CMP0080, \
  227. "BundleUtilities cannot be included at configure time.", 3, 13, 0, \
  228. WARN) \
  229. SELECT(POLICY, CMP0081, \
  230. "Relative paths not allowed in LINK_DIRECTORIES target property.", \
  231. 3, 13, 0, WARN) \
  232. SELECT(POLICY, CMP0082, \
  233. "Install rules from add_subdirectory() are interleaved with those " \
  234. "in caller.", \
  235. 3, 14, 0, WARN) \
  236. SELECT(POLICY, CMP0083, "Add PIE options when linking executable.", 3, 14, \
  237. 0, WARN) \
  238. SELECT(POLICY, CMP0084, \
  239. "The FindQt module does not exist for find_package().", 3, 14, 0, \
  240. WARN) \
  241. SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14, \
  242. 0, WARN) \
  243. SELECT(POLICY, CMP0086, \
  244. "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, WARN) \
  245. SELECT(POLICY, CMP0087, \
  246. "Install CODE|SCRIPT allow the use of generator " \
  247. "expressions.", \
  248. 3, 14, 0, WARN) \
  249. SELECT(POLICY, CMP0088, \
  250. "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \
  251. 3, 14, 0, WARN) \
  252. SELECT(POLICY, CMP0089, \
  253. "Compiler id for IBM Clang-based XL compilers is now XLClang.", 3, \
  254. 15, 0, WARN) \
  255. SELECT(POLICY, CMP0090, \
  256. "export(PACKAGE) does not populate package registry by default.", 3, \
  257. 15, 0, WARN) \
  258. SELECT(POLICY, CMP0091, \
  259. "MSVC runtime library flags are selected by an abstraction.", 3, 15, \
  260. 0, WARN) \
  261. SELECT(POLICY, CMP0092, \
  262. "MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3, \
  263. 15, 0, WARN) \
  264. SELECT(POLICY, CMP0093, "FindBoost reports Boost_VERSION in x.y.z format.", \
  265. 3, 15, 0, WARN) \
  266. SELECT(POLICY, CMP0094, \
  267. "FindPython3, FindPython2 and FindPython use " \
  268. "LOCATION for lookup strategy.", \
  269. 3, 15, 0, WARN) \
  270. SELECT(POLICY, CMP0095, \
  271. "RPATH entries are properly escaped in the intermediary CMake " \
  272. "install script.", \
  273. 3, 16, 0, WARN) \
  274. SELECT(POLICY, CMP0096, \
  275. "project() preserves leading zeros in version components.", 3, 16, \
  276. 0, WARN) \
  277. SELECT(POLICY, CMP0097, \
  278. "ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
  279. "submodules.", \
  280. 3, 16, 0, WARN) \
  281. SELECT(POLICY, CMP0098, \
  282. "FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
  283. 17, 0, WARN) \
  284. SELECT(POLICY, CMP0099, \
  285. "Link properties are transitive over private dependencies of " \
  286. "static libraries.", \
  287. 3, 17, 0, WARN) \
  288. SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \
  289. 17, 0, WARN) \
  290. SELECT(POLICY, CMP0101, \
  291. "target_compile_options honors BEFORE keyword in all scopes.", 3, \
  292. 17, 0, WARN) \
  293. SELECT(POLICY, CMP0102, \
  294. "mark_as_advanced() does nothing if a cache entry does not exist.", \
  295. 3, 17, 0, WARN) \
  296. SELECT(POLICY, CMP0103, \
  297. "Multiple export() with same FILE without APPEND is not allowed.", \
  298. 3, 18, 0, WARN) \
  299. SELECT(POLICY, CMP0104, \
  300. "CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty " \
  301. "CUDA_ARCHITECTURES not allowed.", \
  302. 3, 18, 0, WARN) \
  303. SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18, \
  304. 0, WARN) \
  305. SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \
  306. WARN) \
  307. SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \
  308. 3, 18, 0, WARN) \
  309. SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \
  310. 3, 18, 0, WARN) \
  311. SELECT(POLICY, CMP0109, \
  312. "find_program() requires permission to execute but not to read.", 3, \
  313. 19, 0, WARN) \
  314. SELECT(POLICY, CMP0110, \
  315. "add_test() supports arbitrary characters in test names.", 3, 19, 0, \
  316. WARN) \
  317. SELECT(POLICY, CMP0111, \
  318. "An imported target missing its location property fails during " \
  319. "generation.", \
  320. 3, 19, 0, WARN) \
  321. SELECT(POLICY, CMP0112, \
  322. "Target file component generator expressions do not add target " \
  323. "dependencies.", \
  324. 3, 19, 0, WARN) \
  325. SELECT(POLICY, CMP0113, \
  326. "Makefile generators do not repeat custom commands from target " \
  327. "dependencies.", \
  328. 3, 19, 0, WARN) \
  329. SELECT(POLICY, CMP0114, \
  330. "ExternalProject step targets fully adopt their steps.", 3, 19, 0, \
  331. WARN) \
  332. SELECT(POLICY, CMP0115, "Source file extensions must be explicit.", 3, 20, \
  333. 0, WARN) \
  334. SELECT(POLICY, CMP0116, \
  335. "Ninja generators transform DEPFILEs from add_custom_command().", 3, \
  336. 20, 0, WARN) \
  337. SELECT(POLICY, CMP0117, \
  338. "MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
  339. 20, 0, WARN) \
  340. SELECT(POLICY, CMP0118, \
  341. "GENERATED sources may be used across directories without manual " \
  342. "marking.", \
  343. 3, 20, 0, WARN) \
  344. SELECT(POLICY, CMP0119, \
  345. "LANGUAGE source file property explicitly compiles as specified " \
  346. "language.", \
  347. 3, 20, 0, WARN) \
  348. SELECT(POLICY, CMP0120, \
  349. "The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \
  350. WARN) \
  351. SELECT(POLICY, CMP0121, \
  352. "The list() command now validates parsing of index arguments.", 3, \
  353. 21, 0, WARN) \
  354. SELECT( \
  355. POLICY, CMP0122, \
  356. "UseSWIG use standard library name conventions for csharp language.", 3, \
  357. 21, 0, WARN) \
  358. SELECT(POLICY, CMP0123, \
  359. "ARMClang cpu/arch compile and link flags must be set explicitly.", \
  360. 3, 21, 0, WARN) \
  361. SELECT(POLICY, CMP0124, \
  362. "foreach() loop variables are only available in the loop scope.", 3, \
  363. 21, 0, WARN) \
  364. SELECT(POLICY, CMP0125, \
  365. "find_(path|file|library|program) have consistent behavior for " \
  366. "cache variables.", \
  367. 3, 21, 0, WARN) \
  368. SELECT(POLICY, CMP0126, \
  369. "set(CACHE) does not remove a normal variable of the same name.", 3, \
  370. 21, 0, WARN) \
  371. SELECT(POLICY, CMP0127, \
  372. "cmake_dependent_option() supports full Condition Syntax.", 3, 22, \
  373. 0, WARN) \
  374. SELECT(POLICY, CMP0128, \
  375. "Selection of language standard and extension flags improved.", 3, \
  376. 22, 0, WARN) \
  377. SELECT(POLICY, CMP0129, \
  378. "Compiler id for MCST LCC compilers is now LCC, not GNU.", 3, 23, 0, \
  379. WARN) \
  380. SELECT(POLICY, CMP0130, "while() diagnoses condition evaluation errors.", \
  381. 3, 24, 0, WARN) \
  382. SELECT(POLICY, CMP0131, \
  383. "LINK_LIBRARIES supports the LINK_ONLY generator expression.", 3, \
  384. 24, 0, WARN) \
  385. SELECT(POLICY, CMP0132, \
  386. "Do not set compiler environment variables on first run", 3, 24, 0, \
  387. WARN) \
  388. SELECT(POLICY, CMP0133, \
  389. "The CPack module disables SLA by default in the CPack DragNDrop " \
  390. "Generator.", \
  391. 3, 24, 0, WARN) \
  392. SELECT(POLICY, CMP0134, \
  393. "Fallback to \"HOST\" Windows registry view when \"TARGET\" view " \
  394. "is not usable.", \
  395. 3, 24, 0, WARN) \
  396. SELECT(POLICY, CMP0135, \
  397. "ExternalProject and FetchContent ignore timestamps in archives by " \
  398. "default for the URL download method", \
  399. 3, 24, 0, WARN) \
  400. SELECT(POLICY, CMP0136, \
  401. "Watcom runtime library flags are selected by an abstraction.", 3, \
  402. 24, 0, WARN) \
  403. SELECT(POLICY, CMP0137, \
  404. "try_compile() passes platform variables in project mode", 3, 24, 0, \
  405. WARN) \
  406. SELECT(POLICY, CMP0138, \
  407. "CheckIPOSupported uses flags from calling project.", 3, 24, 0, \
  408. WARN) \
  409. SELECT( \
  410. POLICY, CMP0139, \
  411. "The if() command supports path comparisons using PATH_EQUAL operator.", \
  412. 3, 24, 0, WARN) \
  413. SELECT(POLICY, CMP0140, "The return() command checks its arguments.", 3, \
  414. 25, 0, WARN) \
  415. SELECT( \
  416. POLICY, CMP0141, \
  417. "MSVC debug information format flags are selected by an abstraction.", 3, \
  418. 25, 0, WARN) \
  419. SELECT(POLICY, CMP0142, \
  420. "The Xcode generator does not append per-config suffixes to " \
  421. "library search paths.", \
  422. 3, 25, 0, WARN) \
  423. SELECT(POLICY, CMP0143, \
  424. "Global property USE_FOLDERS treated as ON by default", 3, 26, 0, \
  425. WARN) \
  426. SELECT(POLICY, CMP0144, \
  427. "find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
  428. 0, WARN) \
  429. SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \
  430. 27, 0, WARN) \
  431. SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, WARN) \
  432. SELECT(POLICY, CMP0147, \
  433. "Visual Studio generators build custom commands in parallel.", 3, \
  434. 27, 0, WARN) \
  435. SELECT(POLICY, CMP0148, \
  436. "The FindPythonInterp and FindPythonLibs modules are removed.", 3, \
  437. 27, 0, WARN) \
  438. SELECT(POLICY, CMP0149, \
  439. "Visual Studio generators select latest Windows SDK by default.", 3, \
  440. 27, 0, WARN) \
  441. SELECT(POLICY, CMP0150, \
  442. "ExternalProject_Add and FetchContent_Declare commands " \
  443. "treat relative GIT_REPOSITORY paths as being relative " \
  444. "to the parent project's remote.", \
  445. 3, 27, 0, WARN) \
  446. SELECT(POLICY, CMP0151, \
  447. "AUTOMOC include directory is a system include directory by " \
  448. "default.", \
  449. 3, 27, 0, WARN) \
  450. SELECT( \
  451. POLICY, CMP0152, \
  452. "file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \
  453. 28, 0, WARN) \
  454. SELECT(POLICY, CMP0153, "The exec_program command should not be called.", \
  455. 3, 28, 0, WARN) \
  456. SELECT( \
  457. POLICY, CMP0154, \
  458. "Generated files are private by default in targets using file sets.", 3, \
  459. 28, 0, WARN) \
  460. SELECT(POLICY, CMP0155, \
  461. "C++ sources in targets with at least C++20 are scanned for " \
  462. "imports when supported.", \
  463. 3, 28, 0, WARN) \
  464. SELECT( \
  465. POLICY, CMP0156, \
  466. "De-duplicate libraries on link lines based on linker capabilities.", 3, \
  467. 29, 0, WARN) \
  468. SELECT(POLICY, CMP0157, \
  469. "Swift compilation mode selected by an abstraction.", 3, 29, 0, \
  470. WARN) \
  471. SELECT(POLICY, CMP0158, \
  472. "add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when " \
  473. "cross-compiling.", \
  474. 3, 29, 0, WARN) \
  475. SELECT(POLICY, CMP0159, \
  476. "file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, WARN) \
  477. SELECT( \
  478. POLICY, CMP0160, \
  479. "More read-only target properties now error when trying to set them.", 3, \
  480. 29, 0, WARN) \
  481. SELECT(POLICY, CMP0161, "CPACK_PRODUCTBUILD_DOMAINS defaults to true.", 3, \
  482. 29, 0, WARN) \
  483. SELECT( \
  484. POLICY, CMP0162, \
  485. "Visual Studio generators add UseDebugLibraries indicators by default.", \
  486. 3, 30, 0, WARN) \
  487. SELECT( \
  488. POLICY, CMP0163, \
  489. "The GENERATED source file property is now visible in all directories.", \
  490. 3, 30, 0, WARN) \
  491. SELECT(POLICY, CMP0164, \
  492. "add_library() rejects SHARED libraries when not supported by the " \
  493. "platform.", \
  494. 3, 30, 0, WARN) \
  495. SELECT(POLICY, CMP0165, \
  496. "enable_language() must not be called before project().", 3, 30, 0, \
  497. WARN) \
  498. SELECT(POLICY, CMP0166, \
  499. "TARGET_PROPERTY evaluates link properties transitively over " \
  500. "private dependencies of static libraries.", \
  501. 3, 30, 0, WARN) \
  502. SELECT(POLICY, CMP0167, "The FindBoost module is removed.", 3, 30, 0, WARN) \
  503. SELECT(POLICY, CMP0168, \
  504. "FetchContent implements steps directly instead of through a " \
  505. "sub-build.", \
  506. 3, 30, 0, WARN) \
  507. SELECT(POLICY, CMP0169, \
  508. "FetchContent_Populate(depName) single-argument signature is " \
  509. "deprecated.", \
  510. 3, 30, 0, WARN) \
  511. SELECT(POLICY, CMP0170, \
  512. "FETCHCONTENT_FULLY_DISCONNECTED requirements are enforced.", 3, 30, \
  513. 0, WARN) \
  514. SELECT(POLICY, CMP0171, "'codegen' is a reserved target name.", 3, 31, 0, \
  515. WARN) \
  516. SELECT(POLICY, CMP0172, \
  517. "The CPack module enables per-machine installation by default in " \
  518. "the CPack WIX Generator.", \
  519. 3, 31, 0, WARN) \
  520. SELECT(POLICY, CMP0173, "The CMakeFindFrameworks module is removed.", 3, \
  521. 31, 0, WARN) \
  522. SELECT(POLICY, CMP0174, \
  523. "cmake_parse_arguments(PARSE_ARGV) defines a variable for an empty " \
  524. "string after a single-value keyword.", \
  525. 3, 31, 0, WARN) \
  526. SELECT(POLICY, CMP0175, "add_custom_command() rejects invalid arguments.", \
  527. 3, 31, 0, WARN) \
  528. SELECT(POLICY, CMP0176, "execute_process() ENCODING is UTF-8 by default.", \
  529. 3, 31, 0, WARN) \
  530. SELECT(POLICY, CMP0177, "install() DESTINATION paths are normalized.", 3, \
  531. 31, 0, WARN) \
  532. SELECT(POLICY, CMP0178, "Test command lines preserve empty arguments.", 3, \
  533. 31, 0, WARN) \
  534. SELECT(POLICY, CMP0179, \
  535. "De-duplication of static libraries on link lines keeps first " \
  536. "occurrence.", \
  537. 3, 31, 0, WARN) \
  538. SELECT(POLICY, CMP0180, \
  539. "project() always sets <PROJECT-NAME>_* as normal variables.", 3, \
  540. 31, 0, WARN) \
  541. SELECT(POLICY, CMP0181, \
  542. "Link command-line fragment variables are parsed and re-quoted.", 4, \
  543. 0, 0, WARN) \
  544. SELECT(POLICY, CMP0182, \
  545. "Create shared library archives by default on AIX.", 4, 0, 0, WARN) \
  546. SELECT(POLICY, CMP0183, \
  547. "add_feature_info() supports full Condition Syntax.", 4, 0, 0, WARN)
  548. #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
  549. #define CM_FOR_EACH_POLICY_ID(POLICY) \
  550. CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
  551. #define CM_FOR_EACH_TARGET_POLICY(F) \
  552. F(CMP0003) \
  553. F(CMP0004) \
  554. F(CMP0008) \
  555. F(CMP0020) \
  556. F(CMP0021) \
  557. F(CMP0022) \
  558. F(CMP0027) \
  559. F(CMP0037) \
  560. F(CMP0038) \
  561. F(CMP0041) \
  562. F(CMP0042) \
  563. F(CMP0046) \
  564. F(CMP0052) \
  565. F(CMP0060) \
  566. F(CMP0063) \
  567. F(CMP0065) \
  568. F(CMP0068) \
  569. F(CMP0069) \
  570. F(CMP0073) \
  571. F(CMP0076) \
  572. F(CMP0081) \
  573. F(CMP0083) \
  574. F(CMP0095) \
  575. F(CMP0099) \
  576. F(CMP0104) \
  577. F(CMP0105) \
  578. F(CMP0108) \
  579. F(CMP0112) \
  580. F(CMP0113) \
  581. F(CMP0119) \
  582. F(CMP0131) \
  583. F(CMP0142) \
  584. F(CMP0154) \
  585. F(CMP0155) \
  586. F(CMP0156) \
  587. F(CMP0157) \
  588. F(CMP0160) \
  589. F(CMP0162) \
  590. F(CMP0179) \
  591. F(CMP0181) \
  592. F(CMP0182)
  593. #define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
  594. F(CMP0116) \
  595. F(CMP0147)
  596. /** \class cmPolicies
  597. * \brief Handles changes in CMake behavior and policies
  598. *
  599. * See the cmake-policies(7) manual for an overview of this class's purpose.
  600. */
  601. class cmPolicies
  602. {
  603. public:
  604. /// Status of a policy
  605. enum PolicyStatus
  606. {
  607. OLD, ///< Use old behavior
  608. WARN, ///< Use old behavior but issue a warning
  609. NEW, ///< Use new behavior
  610. };
  611. /// Policy identifiers
  612. enum PolicyID
  613. {
  614. #define POLICY_ENUM(POLICY_ID) POLICY_ID,
  615. CM_FOR_EACH_POLICY_ID(POLICY_ENUM)
  616. #undef POLICY_ENUM
  617. /** \brief Always the last entry.
  618. *
  619. * Useful mostly to avoid adding a comma the last policy when adding a new
  620. * one.
  621. */
  622. CMPCOUNT
  623. };
  624. //! convert a string policy ID into a number
  625. static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid);
  626. //! Return whether a policy has been removed.
  627. static bool IsRemoved(cmPolicies::PolicyID id);
  628. enum class WarnCompat
  629. {
  630. Off,
  631. On
  632. };
  633. //! Set a policy level for this listfile
  634. static bool ApplyPolicyVersion(cmMakefile* mf,
  635. std::string const& version_min,
  636. std::string const& version_max,
  637. WarnCompat warnCompat);
  638. static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
  639. unsigned int minorVer, unsigned int patchVer,
  640. WarnCompat warnCompat);
  641. //! return a warning string for a given policy
  642. static std::string GetPolicyWarning(cmPolicies::PolicyID id);
  643. static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
  644. //! return an error string for when a required policy is unspecified
  645. static std::string GetRemovedPolicyError(cmPolicies::PolicyID id);
  646. /** Represent a set of policy values. */
  647. struct PolicyMap
  648. {
  649. PolicyStatus Get(PolicyID id) const;
  650. void Set(PolicyID id, PolicyStatus status);
  651. bool IsDefined(PolicyID id) const;
  652. bool IsEmpty() const;
  653. private:
  654. #define POLICY_STATUS_COUNT 3
  655. std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
  656. };
  657. };