1CMAKE-POLICIES(7) CMake CMAKE-POLICIES(7)
2
3
4
6 cmake-policies - CMake Policies Reference
7
9 Policies in CMake are used to preserve backward compatible behavior
10 across multiple releases. When a new policy is introduced, newer CMake
11 versions will begin to warn about the backward compatible behavior. It
12 is possible to disable the warning by explicitly requesting the OLD, or
13 backward compatible behavior using the cmake_policy() command. It is
14 also possible to request NEW, or non-backward compatible behavior for a
15 policy, also avoiding the warning. Each policy can also be set to ei‐
16 ther NEW or OLD behavior explicitly on the command line with the
17 CMAKE_POLICY_DEFAULT_CMP<NNNN> variable.
18
19 A policy is a deprecation mechanism and not a reliable feature toggle.
20 A policy should almost never be set to OLD, except to silence warnings
21 in an otherwise frozen or stable codebase, or temporarily as part of a
22 larger migration path. The OLD behavior of each policy is undesirable
23 and will be replaced with an error condition in a future release.
24
25 The cmake_minimum_required() command does more than report an error if
26 a too-old version of CMake is used to build a project. It also sets
27 all policies introduced in that CMake version or earlier to NEW behav‐
28 ior. To manage policies without increasing the minimum required CMake
29 version, the if(POLICY) command may be used:
30
31 if(POLICY CMP0990)
32 cmake_policy(SET CMP0990 NEW)
33 endif()
34
35 This has the effect of using the NEW behavior with newer CMake releases
36 which users may be using and not issuing a compatibility warning.
37
38 The setting of a policy is confined in some cases to not propagate to
39 the parent scope. For example, if the files read by the include() com‐
40 mand or the find_package() command contain a use of cmake_policy(),
41 that policy setting will not affect the caller by default. Both com‐
42 mands accept an optional NO_POLICY_SCOPE keyword to control this behav‐
43 ior.
44
45 The CMAKE_MINIMUM_REQUIRED_VERSION variable may also be used to deter‐
46 mine whether to report an error on use of deprecated macros or func‐
47 tions.
48
50 CMP0142
51 New in version 3.25.
52
53
54 The Xcode generator does not append per-config suffixes to library
55 search paths.
56
57 In CMake 3.24 and below, the Xcode generator preceded each entry of a
58 library search path with a copy of itself appended with $(CONFIGURA‐
59 TION)$(EFFECTIVE_PLATFORM_NAME). This was left from very early ver‐
60 sions of CMake in which per-config directories were not well modeled.
61 Such paths often do not exist, resulting in warnings from the
62 toolchain. CMake 3.25 and above prefer to not add such library search
63 paths. This policy provides compatibility for projects that may have
64 been accidentally relying on the old behavior.
65
66 The OLD behavior for this policy is to append $(CONFIGURATION)$(EFFEC‐
67 TIVE_PLATFORM_NAME) to all library search paths. The NEW behavior is
68 to not modify library search paths.
69
70 This policy was introduced in CMake version 3.25. Use the
71 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
72 policies, CMake version 3.25.2 does not warn when this policy is not
73 set and simply uses OLD behavior.
74
75 NOTE:
76 The OLD behavior of a policy is deprecated by definition and may be
77 removed in a future version of CMake.
78
79 CMP0141
80 New in version 3.25.
81
82
83 MSVC debug information format flags are selected by an abstraction.
84
85 Compilers targeting the MSVC ABI have flags to select the debug infor‐
86 mation format. Debug information format selection typically varies with
87 build configuration.
88
89 In CMake 3.24 and below, debug information format flags are added to
90 the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries by CMake automat‐
91 ically. This allows users to edit their cache entries to adjust the
92 flags. However, the presence of such default flags is problematic for
93 projects that want to choose a different runtime library programmati‐
94 cally. In particular, it requires string editing of the
95 CMAKE_<LANG>_FLAGS_<CONFIG> variables with knowledge of the CMake
96 builtin defaults so they can be replaced.
97
98 CMake 3.25 and above prefer to leave the debug information format flags
99 out of the default CMAKE_<LANG>_FLAGS_<CONFIG> values and instead offer
100 a first-class abstraction. The CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
101 variable and MSVC_DEBUG_INFORMATION_FORMAT target property may be set
102 to select the MSVC debug information format. If they are not set,
103 CMake enables debug information in debug configurations using the de‐
104 fault value $<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>, if sup‐
105 ported by the compiler, and otherwise $<$<CONFIG:Debug,RelWithDe‐
106 bInfo>:Embedded>.
107
108 This policy provides compatibility with projects that have not been up‐
109 dated to be aware of the abstraction. The policy setting takes effect
110 as of the first project() or enable_language() command that enables a
111 language whose compiler targets the MSVC ABI.
112
113 NOTE:
114 Once the policy has taken effect at the top of a project, that
115 choice will be used throughout the tree. In projects that have
116 nested projects in subdirectories, be sure to confirm if everything
117 is working with the selected policy behavior.
118
119 The OLD behavior for this policy is to place MSVC debug information
120 format flags in the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries
121 and ignore the CMAKE_MSVC_DEBUG_INFORMATION_FORMAT abstraction. The
122 NEW behavior for this policy is to not place MSVC debug information
123 format flags in the default cache entries and use the abstraction in‐
124 stead.
125
126 This policy was introduced in CMake version 3.25. Use the
127 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
128 policies, CMake version 3.25.2 does not warn when this policy is not
129 set and simply uses OLD behavior.
130
131 NOTE:
132 The OLD behavior of a policy is deprecated by definition and may be
133 removed in a future version of CMake.
134
135 CMP0140
136 New in version 3.25.
137
138
139 The return() command checks its parameters.
140
141 The OLD behavior for this policy is to ignore any parameters given to
142 the command. The NEW behavior is to check the validity of the parame‐
143 ters.
144
145 This policy was introduced in CMake version 3.25. CMake version 3.25.2
146 warns when the policy is not set and uses OLD behavior. Use the
147 cmake_policy() command to set it to OLD or NEW explicitly.
148
149 NOTE:
150 The OLD behavior of a policy is deprecated by definition and may be
151 removed in a future version of CMake.
152
154 CMP0139
155 New in version 3.24.
156
157
158 The if() command supports path comparisons using PATH_EQUAL operator.
159
160 The OLD behavior for this policy is to ignore the PATH_EQUAL operator.
161 The NEW behavior is to interpret the PATH_EQUAL operator.
162
163 This policy was introduced in CMake version 3.24. CMake version 3.25.2
164 warns when the policy is not set and uses OLD behavior. Use the
165 cmake_policy() command to set it to OLD or NEW explicitly.
166
167 NOTE:
168 The OLD behavior of a policy is deprecated by definition and may be
169 removed in a future version of CMake.
170
171 CMP0138
172 New in version 3.24.
173
174
175 CheckIPOSupported uses flags from calling project.
176
177 The CheckIPOSupported module check_ipo_supported() command compiles a
178 test project to determine whether the toolchain supports
179 INTERPROCEDURAL_OPTIMIZATION. CMake 3.23 and below run the check with
180 the default values of the CMAKE_<LANG>_FLAGS and
181 CMAKE_<LANG>_FLAGS_<CONFIG> variables for the current environment and
182 toolchain settings. However, some projects may modify these flag vari‐
183 ables to add flags that affect availability of the toolchain's IPO fea‐
184 tures. CMake 3.24 and above prefer to honor the calling project's val‐
185 ues for these variables. This policy provides compatibility for
186 projects that have not been updated to expect this behavior.
187
188 The OLD behavior for this policy is to ignore the calling project's
189 values of CMAKE_<LANG>_FLAGS and CMAKE_<LANG>_FLAGS_<CONFIG>. The NEW
190 behavior for this policy is to use the values of those variables as
191 compiler flags in the test project.
192
193 This policy was introduced in CMake version 3.24. Use the
194 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
195 policies, CMake version 3.25.2 does not warn when this policy is not
196 set and simply uses OLD behavior.
197
198 NOTE:
199 The OLD behavior of a policy is deprecated by definition and may be
200 removed in a future version of CMake.
201
202 CMP0137
203 New in version 3.24.
204
205
206 try_compile() passes platform variables in project mode.
207
208 The try_compile() command source file signature propagates CMake vari‐
209 ables containing platform settings, and those specified by the
210 CMAKE_TRY_COMPILE_PLATFORM_VARIABLES variable, into the generated test
211 project. This helps the test project drive the toolchain the same way
212 the calling project will. In CMake 3.23 and below, the whole-project
213 signature does not propagate platform variables automatically. CMake
214 3.24 and above prefer to propagate platform variables in the
215 whole-project signature. This policy provides compatibility with
216 projects that have not been updated to expect the behavior.
217
218 The OLD behavior for this policy is to not pass any additional vari‐
219 ables to the whole-project signature. The NEW behavior for this policy
220 is to pass the same variables that the source file signature does.
221
222 Regardless of the policy setting, the
223 CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES variable may be set to suppress
224 passing the platform variables through either signature.
225
226 This policy was introduced in CMake version 3.24. Use the
227 cmake_policy() command to set this policy to OLD or NEW explicitly. Un‐
228 like many policies, CMake version 3.25.2 does not warn by default when
229 this policy is not set and simply uses OLD behavior.
230
231 NOTE:
232 The OLD behavior of a policy is deprecated by definition and may be
233 removed in a future version of CMake.
234
235 CMP0136
236 New in version 3.24.
237
238
239 Watcom runtime library flags are selected by an abstraction.
240
241 Compilers targeting the Watcom ABI have flags to select the Watcom run‐
242 time library.
243
244 In CMake 3.23 and below, Watcom runtime library selection flags are
245 added to the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries by CMake
246 automatically. This allows users to edit their cache entries to adjust
247 the flags. However, the presence of such default flags is problematic
248 for projects that want to choose a different runtime library program‐
249 matically. In particular, it requires string editing of the
250 CMAKE_<LANG>_FLAGS_<CONFIG> variables with knowledge of the CMake
251 builtin defaults so they can be replaced.
252
253 CMake 3.24 and above prefer to leave the Watcom runtime library selec‐
254 tion flags out of the default CMAKE_<LANG>_FLAGS_<CONFIG> values and
255 instead offer a first-class abstraction. The
256 CMAKE_WATCOM_RUNTIME_LIBRARY variable and WATCOM_RUNTIME_LIBRARY target
257 property may be set to select the Watcom runtime library. If they are
258 not set then CMake uses the default value MultiThreadedDLL on Windows
259 and SingleThreaded on other platforms, which is equivalent to the orig‐
260 inal flags.
261
262 This policy provides compatibility with projects that have not been up‐
263 dated to be aware of the abstraction. The policy setting takes effect
264 as of the first project() or enable_language() command that enables a
265 language whose compiler targets the Watcom ABI.
266
267 NOTE:
268 Once the policy has taken effect at the top of a project, that
269 choice must be used throughout the tree. In projects that have
270 nested projects in subdirectories, be sure to convert everything to‐
271 gether.
272
273 The OLD behavior for this policy is to place Watcom runtime library
274 flags in the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and ig‐
275 nore the CMAKE_WATCOM_RUNTIME_LIBRARY abstraction. The NEW behavior
276 for this policy is to not place Watcom runtime library flags in the de‐
277 fault cache entries and use the abstraction instead.
278
279 This policy was introduced in CMake version 3.24. Use the
280 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
281 policies, CMake version 3.25.2 does not warn when this policy is not
282 set and simply uses OLD behavior.
283
284 NOTE:
285 The OLD behavior of a policy is deprecated by definition and may be
286 removed in a future version of CMake.
287
288 CMP0135
289 New in version 3.24.
290
291
292 When using the URL download method with the ExternalProject_Add() com‐
293 mand, CMake 3.23 and below sets the timestamps of the extracted con‐
294 tents to the same as the timestamps in the archive. When the URL
295 changes, the new archive is downloaded and extracted, but the time‐
296 stamps of the extracted contents might not be newer than the previous
297 contents. Anything that depends on the extracted contents might not be
298 rebuilt, even though the contents may change.
299
300 CMake 3.24 and above prefers to set the timestamps of all extracted
301 contents to the time of the extraction. This ensures that anything that
302 depends on the extracted contents will be rebuilt whenever the URL
303 changes.
304
305 The DOWNLOAD_EXTRACT_TIMESTAMP option to the ExternalProject_Add() com‐
306 mand can be used to explicitly specify how timestamps should be han‐
307 dled. When DOWNLOAD_EXTRACT_TIMESTAMP is not given, this policy con‐
308 trols the default behavior. The OLD behavior for this policy is to re‐
309 store the timestamps from the archive. The NEW behavior sets the time‐
310 stamps of extracted contents to the time of extraction.
311
312 This policy was introduced in CMake version 3.24. CMake version 3.25.2
313 warns when the policy is not set and uses OLD behavior. Use the
314 cmake_policy() command to set it to OLD or NEW explicitly.
315
316 NOTE:
317 The OLD behavior of a policy is deprecated by definition and may be
318 removed in a future version of CMake.
319
320 CMP0134
321 New in version 3.24.
322
323
324 The default registry view is TARGET for the find_file(), find_path(),
325 find_library(), and find_package() commands and BOTH for the
326 find_program() command.
327
328 The default registry views in CMake 3.23 and below are selected using
329 the following rules:
330
331 • if CMAKE_SIZEOF_VOID_P has value 8:
332
333 • Use view 64 for all find_* commands except find_program() command.
334
335 • Use view 64_32 for find_program() command.
336
337 • if CMAKE_SIZEOF_VOID_P has value 4 or is undefined:
338
339 • Use view 32 for all find_* commands except find_program() command.
340
341 • Use view 32_64 for find_program() command.
342
343 The OLD behavior for this policy is to use registry views 64 and 64_32
344 or 32_64 and 32 as default, depending of CMAKE_SIZEOF_VOID_P variable
345 value. The NEW behavior for this policy is to use registry views TAR‐
346 GET and BOTH as default.
347
348 This policy was introduced in CMake version 3.24. Use the
349 cmake_policy() command to set this policy to OLD or NEW explicitly. Un‐
350 like many policies, CMake version 3.25.2 does not warn when this policy
351 is not set and simply uses OLD behavior.
352
353 NOTE:
354 The OLD behavior of a policy is deprecated by definition and may be
355 removed in a future version of CMake.
356
357 CMP0133
358 New in version 3.24.
359
360
361 The CPack module disables SLA by default in the CPack DragNDrop Genera‐
362 tor.
363
364 The CPack DragNDrop Generator in CMake 3.22 and below attach a Software
365 License Agreement (SLA) to .dmg files using the file specified by
366 CPACK_RESOURCE_FILE_LICENSE, if set to a non-default value. macOS 12.0
367 deprecated the tools used to do this, so CMake 3.23 added the
368 CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE option to control the behavior.
369 CMake 3.23 enables that option by default for compatibility with older
370 versions. CMake 3.24 and above prefer to not enable the
371 CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE option by default. This policy
372 provides compatibility with projects that have not been updated to ac‐
373 count for the lack of a SLA in their .dmg packages.
374
375 The OLD behavior for this policy is to enable
376 CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE by default. The NEW behavior
377 for this policy is to not enable it by default.
378
379 This policy was introduced in CMake version 3.24. Use the
380 cmake_policy() command to set this policy to OLD or NEW explicitly. Un‐
381 like many policies, CMake version 3.25.2 does not warn by default when
382 this policy is not set and simply uses OLD behavior. See documentation
383 of the CMAKE_POLICY_WARNING_CMP0133 variable to control the warning.
384
385 NOTE:
386 The OLD behavior of a policy is deprecated by definition and may be
387 removed in a future version of CMake.
388
389 CMP0132
390 New in version 3.24.
391
392
393 Apart from when using the Xcode generator and some Visual Studio gener‐
394 ators, CMake 3.23 and below will set environment variables like CC,
395 CXX, etc. when the corresponding language is enabled. This only occurs
396 on the very first time CMake is run in a build directory, and the envi‐
397 ronment variables are only defined at configure time, not build time.
398 On subsequent CMake runs, these environment variables are not set,
399 opening up the opportunity for different behavior between the first and
400 subsequent CMake runs. CMake 3.24 and above prefer to not set these en‐
401 vironment variables when a language is enabled, even on the first run
402 in a build directory.
403
404 The OLD behavior for this policy sets the relevant environment variable
405 on the first run when a language is enabled. The NEW behavior for this
406 policy does not set any such environment variables.
407
408 This policy was introduced in CMake version 3.24. Use the
409 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
410 policies, CMake version 3.25.2 does not warn when this policy is not
411 set and simply uses OLD behavior.
412
413 NOTE:
414 The OLD behavior of a policy is deprecated by definition and may be
415 removed in a future version of CMake.
416
417 CMP0131
418 New in version 3.24.
419
420
421 LINK_LIBRARIES supports the $<LINK_ONLY:...> generator expression.
422
423 CMake 3.23 and below documented the $<LINK_ONLY:...> generator expres‐
424 sion only for use in INTERFACE_LINK_LIBRARIES. When used in
425 LINK_LIBRARIES, the content guarded inside $<LINK_ONLY:...> was always
426 used, even when collecting non-linking usage requirements such as
427 INTERFACE_COMPILE_DEFINITIONS.
428
429 CMake 3.24 and above prefer to support $<LINK_ONLY:...>, when used in
430 LINK_LIBRARIES, by using the guarded content only for link dependencies
431 and not other usage requirements. This policy provides compatibility
432 for projects that have not been updated to account for this change.
433
434 The OLD behavior for this policy is to use LINK_LIBRARIES content
435 guarded by $<LINK_ONLY:...> even for non-linking usage requirements.
436 The NEW behavior for this policy is to use the guarded content only for
437 link dependencies.
438
439 This policy was introduced in CMake version 3.24. Use the
440 cmake_policy() command to set this policy to OLD or NEW explicitly.
441 Unlike many policies, CMake version 3.25.2 does not warn when this pol‐
442 icy is not set, and simply uses OLD behavior.
443
444 NOTE:
445 The OLD behavior of a policy is deprecated by definition and may be
446 removed in a future version of CMake.
447
448 CMP0130
449 New in version 3.24.
450
451
452 while() diagnoses condition evaluation errors.
453
454 CMake 3.23 and below accidentally tolerated errors encountered while
455 evaluating the condition passed to the while() command (but not the
456 if() command). For example, the code
457
458 set(paren "(")
459 while(${paren})
460 endwhile()
461
462 creates an unbalanced parenthesis during condition evaluation.
463
464 CMake 3.24 and above prefer to diagnose such errors. This policy pro‐
465 vides compatibility for projects that have not been updated to fix
466 their condition errors.
467
468 The OLD behavior for this policy is to ignore errors in while() condi‐
469 tions. The NEW behavior for this policy is to diagnose errors in
470 while() conditions.
471
472 This policy was introduced in CMake version 3.24. CMake version 3.25.2
473 warns when the policy is not set and uses OLD behavior. Use the
474 cmake_policy() command to set it to OLD or NEW explicitly.
475
476 NOTE:
477 The OLD behavior of a policy is deprecated by definition and may be
478 removed in a future version of CMake.
479
481 CMP0129
482 New in version 3.23.
483
484
485 Compiler id for MCST LCC compilers is now LCC, not GNU.
486
487 CMake 3.23 and above recognize MCST LCC compiler as a different from
488 GNU, with its own command line and set of capabilities. CMake now pre‐
489 fers to present this to projects by setting the
490 CMAKE_<LANG>_COMPILER_ID variable to LCC instead of GNU. However, ex‐
491 isting projects may assume the compiler id for LCC is GNU as it was in
492 CMake versions prior to 3.23. Therefore this policy determines for
493 MCST LCC compiler which compiler id to report in the
494 CMAKE_<LANG>_COMPILER_ID variable after language <LANG> is enabled by
495 the project() or enable_language() command. The policy must be set
496 prior to the invocation of either command.
497
498 The OLD behavior for this policy is to use compiler id GNU (and set
499 CMAKE_<LANG>_COMPILER_VERSION to the supported GNU compiler version.)
500 NEW behavior for this policy is to use compiler id LCC, and set
501 CMAKE_<LANG>_SIMULATE_ID to GNU, and CMAKE_<LANG>_SIMULATE_VERSION to
502 the supported GNU compiler version.
503
504 This policy was introduced in CMake version 3.23. Use the
505 cmake_policy() command to set this policy to OLD or NEW explicitly.
506 Unlike most policies, CMake version 3.25.2 does not warn by default
507 when this policy is not set and simply uses OLD behavior. See documen‐
508 tation of the CMAKE_POLICY_WARNING_CMP0129 variable to control the
509 warning.
510
511 NOTE:
512 The OLD behavior of a policy is deprecated by definition and may be
513 removed in a future version of CMake.
514
516 CMP0128
517 New in version 3.22.
518
519
520 When this policy is set to NEW:
521
522 • <LANG>_EXTENSIONS is initialized to CMAKE_<LANG>_EXTENSIONS if set,
523 otherwise falling back to CMAKE_<LANG>_EXTENSIONS_DEFAULT.
524
525 • Extensions are correctly enabled/disabled if <LANG>_STANDARD is unset
526 or satisfied by the default.
527
528 • Standard mode-affecting flags aren't added unless necessary to
529 achieve the specified mode.
530
531 The OLD behavior:
532
533 • Initializes <LANG>_EXTENSIONS to CMAKE_<LANG>_EXTENSIONS if set, oth‐
534 erwise falling back to ON.
535
536 • Always adds a flag if <LANG>_STANDARD is set and
537 <LANG>_STANDARD_REQUIRED is OFF.
538
539 • If <LANG>_STANDARD is unset:
540
541 • Doesn't disable extensions even if <LANG>_EXTENSIONS is OFF.
542
543 • Fails to enable extensions if <LANG>_EXTENSIONS is ON except for
544 the IAR compiler.
545
546 Code may need to be updated for the NEW behavior in the following
547 cases:
548
549 • If a standard mode flag previously overridden by CMake's and not used
550 during compiler detection now takes effect due to CMake no longer
551 adding one as the default detected is appropriate.
552
553 Such code should be converted to either:
554
555 • Use <LANG>_STANDARD and <LANG>_EXTENSIONS instead of manually
556 adding flags.
557
558 • Or ensure the manually-specified flags are used during compiler de‐
559 tection.
560
561 • If extensions were disabled without <LANG>_STANDARD being set CMake
562 previously wouldn't actually disable extensions.
563
564 Such code should be updated to not disable extensions if they are re‐
565 quired.
566
567 • If extensions were enabled/disabled when <LANG>_STANDARD was satis‐
568 fied by the compiler's default CMake previously wouldn't actually en‐
569 able/disable extensions.
570
571 Such code should be updated to set the correct extensions mode.
572
573 If compiler flags affecting the standard mode are used during compiler
574 detection (for example in a toolchain file using
575 CMAKE_<LANG>_FLAGS_INIT) then they will affect the detected default
576 standard and extensions.
577
578 Unlike many policies, CMake version 3.25.2 does not warn when the pol‐
579 icy is not set and simply uses the OLD behavior. Use the cmake_policy()
580 command to set it to OLD or NEW explicitly. See documentation of the
581 CMAKE_POLICY_WARNING_CMP0128 variable to control the warning.
582
583 NOTE:
584 The OLD behavior of a policy is deprecated by definition and may be
585 removed in a future version of CMake.
586
587 CMP0127
588 New in version 3.22.
589
590
591 cmake_dependent_option() supports full Condition Syntax.
592
593 The <depends> parameter accepts a semicolon-separated list of condi‐
594 tions. CMake 3.21 and lower evaluates each condition as if(${condi‐
595 tion}), which does not properly handle conditions with nested paren
596 groups. CMake 3.22 and above instead prefer to evaluate each condition
597 as if(<condition>), where <condition> is re-parsed as if literally
598 written in a call to if(). This allows expressions like:
599
600 "A AND (B OR C)"
601
602 but requires expressions like:
603
604 "FOO MATCHES (UPPER|lower)"
605
606 to be re-written as:
607
608 "FOO MATCHES \"(UPPER|lower)\""
609
610 Policy CMP0127 provides compatibility for projects that have not been
611 updated to expect the new behavior.
612
613 This policy was introduced in CMake version 3.22. CMake version 3.25.2
614 warns when the policy is not set and uses OLD behavior. Use the
615 cmake_policy() command to set it to OLD or NEW explicitly.
616
617 NOTE:
618 The OLD behavior of a policy is deprecated by definition and may be
619 removed in a future version of CMake.
620
622 CMP0126
623 New in version 3.21.
624
625
626 When this policy is set to NEW, the set(CACHE) command does not remove
627 any normal variable of the same name from the current scope. The OLD
628 behavior removes any normal variable of the same name from the current
629 scope in the following situations:
630
631 • No cache variable of that name existed previously.
632
633 • A cache variable of that name existed previously, but it had no type.
634 This can occur when the variable was set on the command line using a
635 form like cmake -DMYVAR=blah instead of cmake -DMYVAR:STRING=blah.
636
637 • The FORCE or INTERNAL keywords were used when setting the cache vari‐
638 able.
639
640 Note that the NEW behavior has an important difference to the similar
641 NEW behavior of policy CMP0077. The set(CACHE) command always sets the
642 cache variable if it did not exist previously, regardless of the
643 CMP0126 policy setting. The option() command will not set the cache
644 variable if a non-cache variable of the same name already exists and
645 CMP0077 is set to NEW.
646
647 Policy CMP0126 was introduced in CMake version 3.21. Use the
648 cmake_policy() command to set it to OLD or NEW explicitly within a
649 project. Use the CMAKE_POLICY_DEFAULT_CMP0126 variable to set the pol‐
650 icy for a third-party project in a subdirectory without modifying it.
651 Unlike many policies, CMake version 3.25.2 does not warn when the pol‐
652 icy is not set and simply uses OLD behavior. See documentation of the
653 CMAKE_POLICY_WARNING_CMP0126 variable to control the warning.
654
655 NOTE:
656 The OLD behavior of a policy is deprecated by definition and may be
657 removed in a future version of CMake.
658
659 CMP0125
660 New in version 3.21.
661
662
663 The find_file(), find_path(), find_library() and find_program() com‐
664 mands cache their result in the variable specified by their first argu‐
665 ment. Prior to CMake 3.21, if a cache variable of that name already
666 existed before the call but the cache variable had no type, any
667 non-cache variable of the same name would be discarded and the cache
668 variable was always used (see also CMP0126 for a different but similar
669 behavior). This contradicts the convention that a non-cache variable
670 should take precedence over a cache variable of the same name. Such a
671 situation can arise if a user sets a cache variable on the command line
672 without specifying a type, such as cmake -DMYVAR=blah ... instead of
673 cmake -DMYVAR:FILEPATH=blah.
674
675 Related to the above, if a cache variable of the specified name already
676 exists and it does have a type, the various find_...() commands would
677 return that value unchanged. In particular, if it contained a relative
678 path, it would not be converted to an absolute path in this situation.
679
680 When policy CMP0125 is set to OLD or is unset, the behavior is as de‐
681 scribed above. When it is set to NEW, the behavior is as follows:
682
683 • If a non-cache variable of the specified name exists when the
684 find_...() command is called, its value will be used regardless of
685 whether a cache variable of the same name already exists or not. A
686 cache variable will not be created in this case if no such cache
687 variable existed before. If a cache variable of the specified name
688 did already exist, the cache will be updated to match the non-cache
689 variable.
690
691 • The various find...() commands will always provide an absolute path
692 in the result variable, except where a relative path provided by a
693 cache or non-cache variable cannot be resolved to an existing path.
694
695 This policy was introduced in CMake version 3.21. Use the
696 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
697 policies, CMake version 3.25.2 does not warn when the policy is not set
698 and simply uses OLD behavior.
699
700 NOTE:
701 The OLD behavior of a policy is deprecated by definition and may be
702 removed in a future version of CMake.
703
704 CMP0124
705 New in version 3.21.
706
707
708 When this policy is set to NEW, the scope of loop variables defined by
709 the foreach() command is restricted to the loop only. They will be un‐
710 set at the end of the loop.
711
712 The OLD behavior for this policy still clears the loop variables at the
713 end of the loop, but does not unset them. This leaves them as defined,
714 but empty.
715
716 This policy was introduced in CMake version 3.21. Use the
717 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
718 policies, CMake version 3.25.2 does not warn when the policy is not set
719 and simply uses OLD behavior.
720
721 NOTE:
722 The OLD behavior of a policy is deprecated by definition and may be
723 removed in a future version of CMake.
724
725 CMP0123
726 New in version 3.21.
727
728
729 ARMClang cpu/arch compile and link flags must be set explicitly.
730
731 CMake 3.20 and lower automatically maps the CMAKE_SYSTEM_PROCESSOR
732 variable and an undocumented CMAKE_SYSTEM_ARCH to compile and link op‐
733 tions for ARMClang. For example, the -mcpu=cortex-m33 flag is added
734 when CMAKE_SYSTEM_PROCESSOR equals cortex-m33. CMake requires projects
735 to set either variable or it raises a fatal error. However, the
736 project may need to additionally specify CPU features using e.g.
737 -mcpu=cortex-m33+nodsp, conflicting with the -mcpu=cortex-m33 added by
738 CMake. This results in either link errors or unusable binaries.
739
740 CMake 3.21 and above prefer instead to not add any cpu/arch compile and
741 link flags automatically. Instead, projects must specify them explic‐
742 itly. This policy provides compatibility for projects that have not
743 been updated.
744
745 The OLD behavior of this policy requires projects that use ARMClang to
746 set either CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH and it automati‐
747 cally adds a compile option -mcpu= or -march= and a link option --cpu=
748 based on those variables. The NEW behavior does not add compile or
749 link options, and projects are responsible for setting correct options.
750
751 This policy was introduced in CMake version 3.21. CMake version 3.25.2
752 warns when the policy is not set and uses OLD behavior. Use the
753 cmake_policy() command to set it to OLD or NEW explicitly.
754
755 NOTE:
756 The OLD behavior of a policy is deprecated by definition and may be
757 removed in a future version of CMake.
758
759 CMP0122
760 New in version 3.21.
761
762
763 UseSWIG use library name conventions for CSharp language.
764
765 Starting with CMake 3.21, UseSWIG generates now a library using default
766 naming conventions. This policy provides compatibility with projects
767 that expect the legacy behavior.
768
769 This policy was introduced in CMake version 3.21. CMake version 3.25.2
770 warns when the policy is not set and uses OLD behavior. Use the
771 cmake_policy() command to set it to OLD or NEW explicitly.
772
773 NOTE:
774 The OLD behavior of a policy is deprecated by definition and may be
775 removed in a future version of CMake.
776
777 CMP0121
778 New in version 3.21.
779
780
781 The list() command now detects invalid indices.
782
783 Prior to CMake version 3.21, the list() command's GET, INSERT, SUBLIST,
784 and REMOVE_AT subcommands did not detect invalid index arguments.
785
786 The OLD behavior of this policy is for invalid indices to be treated as
787 their integer value (if any) at the start of the string. For example,
788 2good4you is a 2 and not_an_integer is a 0. The NEW behavior is for in‐
789 valid indices to trigger an error.
790
791 This policy was introduced in CMake version 3.21. CMake version 3.25.2
792 warns when the policy is not set and uses OLD behavior. Use the
793 cmake_policy() command to set it to OLD or NEW explicitly.
794
795 NOTE:
796 The OLD behavior of a policy is deprecated by definition and may be
797 removed in a future version of CMake.
798
800 CMP0120
801 New in version 3.20.
802
803
804 The WriteCompilerDetectionHeader module is removed.
805
806 CMake versions 3.1 through 3.19 provide this module to generate a C++
807 compatibility layer by re-using information from CMake's table of pre‐
808 processor checks for cmake-compile-features(7). However:
809
810 • Those granular features have been superseded by meta-features for
811 Requiring Language Standards such as cxx_std_11. Therefore no new
812 granular feature checks will be added and projects will need to use
813 other means to conditionally use new C++ features.
814
815 • The module exposes some of CMake's implementation details directly to
816 C++ translation units.
817
818 • The module's approach effectively provides a header file with CMake,
819 thus tying the version of the header to the version of CMake. Many
820 projects found that the WriteCompilerDetectionHeader was best used by
821 manually generating its header locally with a recent version of CMake
822 and then bundling it with the project source so that it could be used
823 with older CMake versions.
824
825 For reasons including the above, CMake 3.20 and above prefer to not
826 provide the WriteCompilerDetectionHeader module. This policy provides
827 compatibility for projects that have not been ported away from it.
828 Projects using the module should be updated to stop using it. Alterna‐
829 tives include:
830
831 • Bundle a copy of the generated header in the project's source.
832
833 • Use a third-party alternative, such as the CC0-licensed Hedley.
834
835 • Drop support for compilers too old to provide the features natively.
836
837 The OLD behavior of this policy is for inclusion of the deprecated
838 WriteCompilerDetectionHeader module to work. The NEW behavior is for
839 inclusion of the module to fail as if it does not exist.
840
841 This policy was introduced in CMake version 3.20. CMake version 3.25.2
842 warns when the policy is not set and uses OLD behavior. Use the
843 cmake_policy() command to set it to OLD or NEW explicitly.
844
845 NOTE:
846 The OLD behavior of a policy is deprecated by definition and may be
847 removed in a future version of CMake.
848
849 CMP0119
850 New in version 3.20.
851
852
853 LANGUAGE source file property explicitly compiles as specified lan‐
854 guage.
855
856 The LANGUAGE source file property is documented to mean that the source
857 file is written in the specified language. In CMake 3.19 and below,
858 setting this property causes CMake to compile the source file using the
859 compiler for the specified language. However, it only passes an ex‐
860 plicit flag to tell the compiler to treat the source as the specified
861 language for MSVC-like, XL, and Embarcadero compilers for the CXX lan‐
862 guage. CMake 3.20 and above prefer to also explicitly tell the com‐
863 piler to use the specified language using a flag such as -x c on all
864 compilers for which such flags are known.
865
866 This policy provides compatibility for projects that have not been up‐
867 dated to expect this behavior. For example, some projects were setting
868 the LANGUAGE property to C on assembly-language .S source files in or‐
869 der to compile them using the C compiler. Such projects should be up‐
870 dated to use enable_language(ASM), for which CMake will often choose
871 the C compiler as the assembler on relevant platforms anyway.
872
873 The OLD behavior for this policy is to interpret the LANGUAGE <LANG>
874 property using its undocumented meaning to "use the <LANG> compiler".
875 The NEW behavior for this policy is to interpret the LANGUAGE <LANG>
876 property using its documented meaning to "compile as a <LANG> source".
877
878 This policy was introduced in CMake version 3.20. Use the
879 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
880 policies, CMake version 3.25.2 does not warn when this policy is not
881 set and simply uses OLD behavior.
882
883 NOTE:
884 The OLD behavior of a policy is deprecated by definition and may be
885 removed in a future version of CMake.
886
887 CMP0118
888 New in version 3.20.
889
890
891 The GENERATED source file property is now visible in all directories.
892
893 Whether or not a source file is generated is an all-or-nothing global
894 property of the source. Consequently, the associated GENERATED prop‐
895 erty is now visible from any directory scope, not only from the scope
896 for which it was set.
897
898 Additionally, the GENERATED property may now be set only to boolean
899 values, and may not be turned off once turned on.
900
901 The OLD behavior of this policy is to only allow GENERATED to be visi‐
902 ble from the directory scope for which it was set. The NEW behavior on
903 the other hand allows it to be visible from any scope.
904
905 This policy was introduced in CMake version 3.20. Use the
906 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
907 policies, CMake version 3.25.2 does not warn when this policy is not
908 set and simply uses OLD behavior with regard to visibility of the GEN‐
909 ERATED property. However, CMake does warn about setting the GENERATED
910 property to a non-boolean value.
911
912 CMP0117
913 New in version 3.20.
914
915
916 MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.
917
918 When using MSVC-like compilers in CMake 3.19 and below, the RTTI flag
919 /GR is added to CMAKE_CXX_FLAGS by default. This behavior is left from
920 support for MSVC versions from Visual Studio 2003 and below that did
921 not enable RTTI by default. It is no longer necessary. Furthermore,
922 it is problematic for projects that want to change to /GR- programmati‐
923 cally. In particular, it requires string editing of the
924 CMAKE_CXX_FLAGS variable with knowledge of the CMake builtin default so
925 it can be replaced.
926
927 CMake 3.20 and above prefer to leave out /GR from the value of
928 CMAKE_CXX_FLAGS by default.
929
930 This policy provides compatibility with projects that have not been up‐
931 dated to expect the lack of the /GR flag. The policy setting takes ef‐
932 fect as of the first project() or enable_language() command that ini‐
933 tializes CMAKE_CXX_FLAGS.
934
935 NOTE:
936 Once the policy has taken effect at the top of a project for a given
937 language, that choice must be used throughout the tree for that lan‐
938 guage. In projects that have nested projects in subdirectories, be
939 sure to convert everything together.
940
941 The OLD behavior for this policy is to place the MSVC /GR flag in the
942 default CMAKE_CXX_FLAGS cache entry. The NEW behavior for this policy
943 is to not place the MSVC /GR flag in the default cache entry.
944
945 This policy was introduced in CMake version 3.20. Use the
946 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
947 policies, CMake version 3.25.2 does not warn when this policy is not
948 set and simply uses OLD behavior.
949
950 NOTE:
951 The OLD behavior of a policy is deprecated by definition and may be
952 removed in a future version of CMake.
953
954 CMP0116
955 New in version 3.20.
956
957
958 Ninja generators transform DEPFILE s from add_custom_command().
959
960 In CMake 3.19 and below, files given to the DEPFILE argument of
961 add_custom_command() were passed directly to Ninja's depfile variable
962 without any path resolution. This meant that if add_custom_command()
963 was called from a subdirectory (created by add_subdirectory()), the
964 DEPFILE argument would have to be either an absolute path or a path
965 relative to CMAKE_BINARY_DIR, rather than CMAKE_CURRENT_BINARY_DIR. In
966 addition, no transformation was done on the file listed in DEPFILE,
967 which meant that the paths within the DEPFILE had the same restric‐
968 tions.
969
970 Starting with CMake 3.20, the DEPFILE argument is relative to
971 CMAKE_CURRENT_BINARY_DIR (unless it is absolute), and the paths in the
972 DEPFILE are also relative to CMAKE_CURRENT_BINARY_DIR. CMake automati‐
973 cally transforms the paths in the DEPFILE (unless they are absolute)
974 after the custom command is run. The file listed in DEPFILE is not mod‐
975 ified in any way. Instead, CMake writes the transformation to its own
976 internal file, and passes this internal file to Ninja's depfile vari‐
977 able. This transformation happens regardless of whether or not DEPFILE
978 is relative, and regardless of whether or not add_custom_command() is
979 called from a subdirectory.
980
981 The OLD behavior for this policy is to pass the DEPFILE to Ninja unal‐
982 tered. The NEW behavior for this policy is to transform the DEPFILE af‐
983 ter running the custom command. The status of CMP0116 is recorded at
984 the time of the custom command's creation, and you can have custom com‐
985 mands in the same directory with different values for CMP0116 by set‐
986 ting the policy before each custom command.
987
988 This policy was introduced in CMake version 3.20. Unlike most poli‐
989 cies, CMake version 3.25.2 does not warn by default when this policy is
990 not set (unless DEPFILE is used in a subdirectory) and simply uses OLD
991 behavior. See documentation of the CMAKE_POLICY_WARNING_CMP0116 vari‐
992 able to control the warning.
993
994 CMP0115
995 New in version 3.20.
996
997
998 Source file extensions must be explicit.
999
1000 In CMake 3.19 and below, if a source file could not be found by the
1001 name specified, it would append a list of known extensions to the name
1002 to see if the file with the extension could be found. For example, this
1003 would allow the user to run:
1004
1005 add_executable(exe main)
1006
1007 and put main.c in the executable without specifying the extension.
1008
1009 Starting in CMake 3.20, CMake prefers all source files to have their
1010 extensions explicitly listed:
1011
1012 add_executable(exe main.c)
1013
1014 The OLD behavior for this policy is to implicitly append known exten‐
1015 sions to source files if they can't be found. The NEW behavior of this
1016 policy is to not append known extensions and require them to be ex‐
1017 plicit.
1018
1019 This policy was introduced in CMake version 3.20. CMake version 3.25.2
1020 warns when the policy is not set and uses OLD behavior. Use the
1021 cmake_policy() command to set it to OLD or NEW explicitly.
1022
1023 NOTE:
1024 The OLD behavior of a policy is deprecated by definition and may be
1025 removed in a future version of CMake.
1026
1028 CMP0114
1029 New in version 3.19.
1030
1031
1032 ExternalProject step targets fully adopt their steps.
1033
1034 The ExternalProject_Add() STEP_TARGETS option, and the
1035 ExternalProject_Add_StepTargets() function, can be used to create build
1036 targets for individual steps of an external project.
1037
1038 In CMake 3.18 and below, step targets have some limitations:
1039
1040 • Step targets always depend on targets named by the
1041 ExternalProject_Add() DEPENDS option even though not all steps need
1042 them. In order to allow step targets to be created without those de‐
1043 pendencies, the ExternalProject_Add() INDEPENDENT_STEP_TARGETS option
1044 or the ExternalProject_Add_StepTargets() NO_DEPENDS option may be
1045 used. However, adding such "independent" step targets makes sense
1046 only for specific steps such as download, update, and patch because
1047 they do not need any of the external project's build dependencies.
1048 Furthermore, it does not make sense to create independent step tar‐
1049 gets for steps that depend on non-independent steps. Such rules are
1050 not enforced, and projects that do not follow them can generate build
1051 systems with confusing and generator-specific behavior.
1052
1053 • Step targets hold copies of the custom commands implementing their
1054 steps that are separate from the copies in the primary target created
1055 by ExternalProject_Add(), and the primary target does not depend on
1056 the step targets. In parallel builds that drive the primary target
1057 and step targets concurrently, multiple copies of the steps' commands
1058 may run concurrently and race each other.
1059
1060 Also, prior to policy CMP0113, the step targets generated by Makefile
1061 Generators also contain all the custom commands on which their step
1062 depends. This can lead to repeated execution of those steps even in
1063 serial builds.
1064
1065 In CMake 3.19 and above, the ExternalProject module prefers a revised
1066 design to address these problems:
1067
1068 • Each step is classified as "independent" if it does not depend on
1069 other targets named by the ExternalProject_Add() DEPENDS. The prede‐
1070 fined steps are automatically classified by default:
1071
1072 • The download, update, and patch steps are independent.
1073
1074 • The configure, build, test, and install steps are not.
1075
1076 For custom steps, the ExternalProject_Add_Step() command provides an
1077 INDEPENDENT option to mark them as independent. It is an error to
1078 mark a step as independent if it depends on other steps that are not.
1079 Note that this use of the term "independent" refers only to indepen‐
1080 dence from external targets and is orthogonal to a step's dependen‐
1081 cies on other steps.
1082
1083 • Step targets created by the ExternalProject_Add() STEP_TARGETS option
1084 or the ExternalProject_Add_Step() function are now independent if and
1085 only if their steps are marked as independent. The
1086 ExternalProject_Add() INDEPENDENT_STEP_TARGETS option and
1087 ExternalProject_Add_StepTargets() NO_DEPENDS option are no longer al‐
1088 lowed.
1089
1090 • Step targets, when created, are fully responsible for holding the
1091 custom commands implementing their steps. The primary target created
1092 by ExternalProject_Add() depends on the step targets, and the step
1093 targets depend on each other. The target-level dependencies match
1094 the file-level dependencies used by the custom commands for each
1095 step.
1096
1097 When the ExternalProject_Add() UPDATE_DISCONNECTED or TEST_EX‐
1098 CLUDE_FROM_MAIN option is used, or the ExternalProject_Add_Step() EX‐
1099 CLUDE_FROM_MAIN option is used for a custom step, some step targets
1100 may be created automatically. These are needed to hold the steps
1101 commonly depended upon by the primary target and the disconnected
1102 step targets.
1103
1104 Policy CMP0114 provides compatibility for projects that have not been
1105 updated to expect the new behavior. The OLD behavior for this policy
1106 is to use the above-documented behavior from 3.18 and below. The NEW
1107 behavior for this policy is to use the above-documented behavior pre‐
1108 ferred by 3.19 and above.
1109
1110 This policy was introduced in CMake version 3.19. CMake version 3.25.2
1111 warns when the policy is not set and uses OLD behavior. Use the
1112 cmake_policy() command to set it to OLD or NEW explicitly.
1113
1114 CMP0113
1115 New in version 3.19.
1116
1117
1118 Makefile Generators do not repeat custom commands from target dependen‐
1119 cies.
1120
1121 Consider a chain of custom commands split across two dependent targets:
1122
1123 add_custom_command(OUTPUT output-not-created
1124 COMMAND ... DEPENDS ...)
1125 set_property(SOURCE output-not-created PROPERTY SYMBOLIC 1)
1126 add_custom_command(OUTPUT output-created
1127 COMMAND ... DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output-not-created)
1128 add_custom_target(first DEPENDS output-not-created)
1129 add_custom_target(second DEPENDS output-created)
1130 add_dependencies(second first)
1131
1132 In CMake 3.18 and lower, the Makefile generators put a copy of both
1133 custom commands in the Makefile for target second even though its de‐
1134 pendency on target first ensures that the first custom command runs be‐
1135 fore the second. Running make second would cause the first custom com‐
1136 mand to run once in the first target and then again in the second tar‐
1137 get.
1138
1139 CMake 3.19 and above prefer to not duplicate custom commands in a tar‐
1140 get that are already generated in other targets on which the target de‐
1141 pends (directly or indirectly). This policy provides compatibility for
1142 projects that have not been updated to expect the new behavior. In
1143 particular, projects that relied on the duplicate execution or that did
1144 not properly set the SYMBOLIC source file property may be affected.
1145
1146 The OLD behavior for this policy is to duplicate custom commands in de‐
1147 pendent targets. The NEW behavior of this policy is to not duplicate
1148 custom commands in dependent targets.
1149
1150 This policy was introduced in CMake version 3.19. Unlike many poli‐
1151 cies, CMake version 3.25.2 does not warn when this policy is not set
1152 and simply uses OLD behavior.
1153
1154 NOTE:
1155 The OLD behavior of a policy is deprecated by definition and may be
1156 removed in a future version of CMake.
1157
1158 CMP0112
1159 New in version 3.19.
1160
1161
1162 Target file component generator expressions do not add target dependen‐
1163 cies.
1164
1165 The following target-based generator expressions that query for direc‐
1166 tory or file name components no longer add a dependency on the evalu‐
1167 ated target.
1168
1169 • TARGET_FILE_NAME
1170
1171 • TARGET_FILE_DIR
1172
1173 • TARGET_LINKER_FILE_BASE_NAME
1174
1175 • TARGET_LINKER_FILE_NAME
1176
1177 • TARGET_LINKER_FILE_DIR
1178
1179 • TARGET_SONAME_FILE_NAME
1180
1181 • TARGET_SONAME_FILE_DIR
1182
1183 • TARGET_PDB_FILE_NAME
1184
1185 • TARGET_PDB_FILE_DIR
1186
1187 • TARGET_BUNDLE_DIR
1188
1189 • TARGET_BUNDLE_DIR_NAME
1190
1191 • TARGET_BUNDLE_CONTENT_DIR
1192
1193 In CMake 3.18 and lower a dependency on the evaluated target of the
1194 above generator expressions would always be added. CMake 3.19 and
1195 above prefer to not add this dependency. This policy provides compati‐
1196 bility for projects that have not been updated to expect the new behav‐
1197 ior. The policy setting is recorded on each target when it is created,
1198 and decides whether generator expressions referencing that target imply
1199 a dependency on it.
1200
1201 The OLD behavior for this policy is to add a dependency on the evalu‐
1202 ated target for the above generator expressions. The NEW behavior of
1203 this policy is to not add a dependency on the evaluated target for the
1204 above generator expressions.
1205
1206 This policy was introduced in CMake version 3.19. Unlike many poli‐
1207 cies, CMake version 3.25.2 does not warn by default when this policy is
1208 not set and simply uses OLD behavior. See documentation of the
1209 CMAKE_POLICY_WARNING_CMP0112 variable to control the warning.
1210
1211 NOTE:
1212 The OLD behavior of a policy is deprecated by definition and may be
1213 removed in a future version of CMake.
1214
1215 CMP0111
1216 New in version 3.19.
1217
1218
1219 An imported target missing its location property fails during genera‐
1220 tion.
1221
1222 Imported Targets for library files and executables require that their
1223 location on disk is specified in a target property such as
1224 IMPORTED_LOCATION, IMPORTED_IMPLIB, or a per-configuration equivalent.
1225 If a needed location property is not set, CMake 3.18 and below generate
1226 the string <TARGET_NAME>-NOTFOUND in its place, which results in fail‐
1227 ures of the corresponding rules at build time. CMake 3.19 and above
1228 prefer instead to raise an error during generation. This policy pro‐
1229 vides compatibility for projects that have not been updated to expect
1230 the new behavior.
1231
1232 The OLD behavior of this policy is to generate the location of an im‐
1233 ported unknown, static or shared library target as <TARGET_NAME>-NOT‐
1234 FOUND if not set. The NEW behavior is to raise an error.
1235
1236 This policy was introduced in CMake version 3.19. CMake version 3.25.2
1237 warns when the policy is not set and uses OLD behavior. Use the
1238 cmake_policy() command to set it to OLD or NEW explicitly.
1239
1240 NOTE:
1241 The OLD behavior of a policy is deprecated by definition and may be
1242 removed in a future version of CMake.
1243
1244 CMP0110
1245 New in version 3.19.
1246
1247
1248 add_test() supports arbitrary characters in test names.
1249
1250 add_test() can now (officially) create tests with whitespace and other
1251 special characters in its name. Before CMake version 3.19 that was not
1252 allowed, however, it was possible to work around this limitation by ex‐
1253 plicitly putting escaped quotes around the test's name in the add_test
1254 command.
1255
1256 Although never officially supported several projects in the wild found
1257 and implemented this workaround. However, the new change which offi‐
1258 cially allows the add_test command to support whitespace and other spe‐
1259 cial characters in test names now breaks that workaround. In order for
1260 these projects to work smoothly with newer CMake versions, this policy
1261 was introduced.
1262
1263 The OLD behavior of this policy is to still prevent add_test from han‐
1264 dling whitespace and special characters properly (if not using the men‐
1265 tioned workaround). The NEW behavior on the other hand allows names
1266 with whitespace and special characters for tests created by add_test.
1267
1268 This policy was introduced in CMake version 3.19. CMake version 3.25.2
1269 warns when the policy is not set and uses OLD behavior. Use the
1270 cmake_policy() command to set it to OLD or NEW explicitly.
1271
1272 CMP0109
1273 New in version 3.19.
1274
1275
1276 find_program() requires permission to execute but not to read.
1277
1278 In CMake 3.18 and below, the find_program() command on UNIX would find
1279 files that are readable without requiring execute permission, and would
1280 not find files that are executable without read permission. In CMake
1281 3.19 and above, find_program now prefers to require execute permission
1282 but not read permission. This policy provides compatibility with
1283 projects that have not been updated to expect the new behavior.
1284
1285 The OLD behavior for this policy is for find_program to require read
1286 permission but not execute permission. The NEW behavior for this pol‐
1287 icy is for find_program to require execute permission but not read per‐
1288 mission.
1289
1290 This policy was introduced in CMake version 3.19. CMake version 3.25.2
1291 warns when the policy is not set and uses OLD behavior. Use the
1292 cmake_policy() command to set it to OLD or NEW explicitly.
1293
1294 NOTE:
1295 The OLD behavior of a policy is deprecated by definition and may be
1296 removed in a future version of CMake.
1297
1299 CMP0108
1300 New in version 3.18.
1301
1302
1303 A target is not allowed to link to itself even through an ALIAS target.
1304
1305 In CMake 3.17 and below, a target can link to a target aliased to it‐
1306 self.
1307
1308 The OLD behavior for this policy is to allow a target to link to a tar‐
1309 get aliased to itself.
1310
1311 The NEW behavior of this policy is to prevent a target to link to it‐
1312 self through an ALIAS target.
1313
1314 This policy was introduced in CMake version 3.17. Use the
1315 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1316 policies, CMake version 3.25.2 does not warn when this policy is not
1317 set and simply uses OLD behavior.
1318
1319 NOTE:
1320 The OLD behavior of a policy is deprecated by definition and may be
1321 removed in a future version of CMake.
1322
1323 CMP0107
1324 New in version 3.18.
1325
1326
1327 It is not allowed to create an ALIAS target with the same name as an
1328 another target.
1329
1330 In CMake 3.17 and below, an ALIAS target can overwrite silently an ex‐
1331 isting target with the same name.
1332
1333 The OLD behavior for this policy is to allow target overwrite.
1334
1335 The NEW behavior of this policy is to prevent target overwriting.
1336
1337 This policy was introduced in CMake version 3.17. Use the
1338 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1339 policies, CMake version 3.25.2 does not warn when this policy is not
1340 set and simply uses OLD behavior.
1341
1342 NOTE:
1343 The OLD behavior of a policy is deprecated by definition and may be
1344 removed in a future version of CMake.
1345
1346 CMP0106
1347 New in version 3.18.
1348
1349
1350 The Documentation module is removed.
1351
1352 The Documentation was added as a support mechanism for the VTK project
1353 and was tuned for that project. Instead of CMake providing this module
1354 with (now old) VTK patterns for cache variables and required packages,
1355 the module is now deprecated by CMake itself.
1356
1357 The OLD behavior of this policy is for Documentation to add cache vari‐
1358 ables and find VTK documentation dependent packages. The NEW behavior
1359 is to act as an empty module.
1360
1361 This policy was introduced in CMake version 3.18. CMake version 3.25.2
1362 warns when the policy is not set and uses OLD behavior. Use the
1363 cmake_policy() command to set it to OLD or NEW explicitly.
1364
1365 NOTE:
1366 The OLD behavior of a policy is deprecated by definition and may be
1367 removed in a future version of CMake.
1368
1369 CMP0105
1370 New in version 3.18.
1371
1372
1373 LINK_OPTIONS and INTERFACE_LINK_OPTIONS target properties are now used
1374 for the device link step.
1375
1376 In CMake 3.17 and below, link options are not used by the device link
1377 step.
1378
1379 The OLD behavior for this policy is to ignore the link options.
1380
1381 The NEW behavior of this policy is to use the link options during the
1382 device link step.
1383
1384 This policy was introduced in CMake version 3.17. Use the
1385 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1386 policies, CMake version 3.25.2 does not warn when this policy is not
1387 set and simply uses OLD behavior.
1388
1389 NOTE:
1390 The OLD behavior of a policy is deprecated by definition and may be
1391 removed in a future version of CMake.
1392
1393 CMP0104
1394 New in version 3.18.
1395
1396
1397 Initialize CMAKE_CUDA_ARCHITECTURES when CMAKE_CUDA_COMPILER_ID is
1398 NVIDIA. Raise an error if CUDA_ARCHITECTURES is empty.
1399
1400 CMAKE_CUDA_ARCHITECTURES introduced in CMake 3.18 is used to initialize
1401 CUDA_ARCHITECTURES, which passes correct code generation flags to the
1402 CUDA compiler.
1403
1404 Previous to this users had to manually specify the code generation
1405 flags. This policy is for backwards compatibility with manually speci‐
1406 fying code generation flags.
1407
1408 The OLD behavior for this policy is to not initialize
1409 CMAKE_CUDA_ARCHITECTURES when CMAKE_CUDA_COMPILER_ID is NVIDIA. Empty
1410 CUDA_ARCHITECTURES is allowed.
1411
1412 The NEW behavior of this policy is to initialize
1413 CMAKE_CUDA_ARCHITECTURES when CMAKE_CUDA_COMPILER_ID is NVIDIA and
1414 raise an error if CUDA_ARCHITECTURES is empty during generation.
1415
1416 If CUDA_ARCHITECTURES is set to a false value no architectures flags
1417 are passed to the compiler. This is intended to support packagers and
1418 the rare cases where full control over the passed flags is required.
1419
1420 This policy was introduced in CMake version 3.18. CMake version 3.25.2
1421 warns when the policy is not set and uses OLD behavior. Use the
1422 cmake_policy() command to set it to OLD or NEW explicitly.
1423
1424 NOTE:
1425 The OLD behavior of a policy is deprecated by definition and may be
1426 removed in a future version of CMake.
1427
1428 Examples
1429 set_target_properties(tgt PROPERTIES CUDA_ARCHITECTURES "35;50;72")
1430
1431 Generates code for real and virtual architectures 30, 50 and 72.
1432
1433 set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 70-real 72-virtual)
1434
1435 Generates code for real architecture 70 and virtual architecture 72.
1436
1437 set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES OFF)
1438
1439 CMake will not pass any architecture flags to the compiler.
1440
1441 CMP0103
1442 New in version 3.18.
1443
1444
1445 Multiple calls to export() command with same FILE without APPEND is no
1446 longer allowed.
1447
1448 In CMake 3.17 and below, multiple calls to export() command with the
1449 same FILE without APPEND are accepted silently but only the last occur‐
1450 rence is taken into account during the generation.
1451
1452 The OLD behavior for this policy is to ignore the multiple occurrences
1453 of
1454 export() command except the last one.
1455
1456 The NEW behavior of this policy is to raise an error on second call to
1457 export() command with same FILE without APPEND.
1458
1459 This policy was introduced in CMake version 3.18. CMake version 3.25.2
1460 warns when the policy is not set and uses OLD behavior. Use the
1461 cmake_policy() command to set it to OLD or NEW explicitly.
1462
1463 NOTE:
1464 The OLD behavior of a policy is deprecated by definition and may be
1465 removed in a future version of CMake.
1466
1468 CMP0102
1469 New in version 3.17.
1470
1471
1472 The mark_as_advanced() command no longer creates a cache entry if one
1473 does not already exist.
1474
1475 In CMake 3.16 and below, if a variable was not defined at all or just
1476 defined locally, the mark_as_advanced() command would create a new
1477 cache entry with an UNINITIALIZED type and no value. When a find_path()
1478 (or other similar find_ command) would next run, it would find this un‐
1479 defined cache entry and set it up with an empty string value. This
1480 process would end up deleting the local variable in the process (due to
1481 the way the cache works), effectively clearing any stored find_ results
1482 that were only available in the local scope.
1483
1484 The OLD behavior for this policy is to create the empty cache defini‐
1485 tion. The NEW behavior of this policy is to ignore variables which do
1486 not already exist in the cache.
1487
1488 This policy was introduced in CMake version 3.17. Use the
1489 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1490 policies, CMake version 3.25.2 does not warn when this policy is not
1491 set and simply uses OLD behavior. See documentation of the
1492 CMAKE_POLICY_WARNING_CMP0102 variable to control the warning.
1493
1494 NOTE:
1495 The OLD behavior of a policy is deprecated by definition and may be
1496 removed in a future version of CMake.
1497
1498 CMP0101
1499 New in version 3.17.
1500
1501
1502 target_compile_options() now honors BEFORE keyword in all scopes.
1503
1504 In CMake 3.16 and below the target_compile_options() ignores the BEFORE
1505 keyword in private scope. CMake 3.17 and later honors BEFORE keyword in
1506 all scopes. This policy provides compatibility for projects that have
1507 not been updated to expect the new behavior.
1508
1509 The OLD behavior for this policy is to not honor BEFORE keyword in pri‐
1510 vate scope. The NEW behavior of this policy is to honor BEFORE keyword
1511 in all scopes.
1512
1513 This policy was introduced in CMake version 3.17. Use the
1514 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1515 policies, CMake version 3.25.2 does not warn when this policy is not
1516 set and simply uses OLD behavior.
1517
1518 NOTE:
1519 The OLD behavior of a policy is deprecated by definition and may be
1520 removed in a future version of CMake.
1521
1522 CMP0100
1523 New in version 3.17.
1524
1525
1526 Let AUTOMOC and AUTOUIC process header files that end with a .hh exten‐
1527 sion.
1528
1529 Since version 3.17, CMake processes header files that end with a .hh
1530 extension in AUTOMOC and AUTOUIC. In earlier CMake versions, these
1531 header files were ignored by AUTOMOC and AUTOUIC.
1532
1533 This policy affects how header files that end with a .hh extension get
1534 treated in AUTOMOC and AUTOUIC.
1535
1536 The OLD behavior for this policy is to ignore .hh header files in
1537 AUTOMOC and AUTOUIC.
1538
1539 The NEW behavior for this policy is to process .hh header files in
1540 AUTOMOC and AUTOUIC just like other header files.
1541
1542 NOTE:
1543 To silence the CMP0100 warning source files can be excluded from
1544 AUTOMOC and AUTOUIC processing by setting the source file properties
1545 SKIP_AUTOMOC, SKIP_AUTOUIC or SKIP_AUTOGEN.
1546
1547 # Source skip example:
1548 set_property(SOURCE /path/to/file1.hh PROPERTY SKIP_AUTOMOC ON)
1549 set_property(SOURCE /path/to/file2.hh PROPERTY SKIP_AUTOUIC ON)
1550 set_property(SOURCE /path/to/file3.hh PROPERTY SKIP_AUTOGEN ON)
1551
1552 This policy was introduced in CMake version 3.17.0. CMake version
1553 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
1554 cmake_policy() command to set it to OLD or NEW explicitly.
1555
1556 NOTE:
1557 The OLD behavior of a policy is deprecated by definition and may be
1558 removed in a future version of CMake.
1559
1560 CMP0099
1561 New in version 3.17.
1562
1563
1564 Target link properties INTERFACE_LINK_OPTIONS,
1565 INTERFACE_LINK_DIRECTORIES and INTERFACE_LINK_DEPENDS are now transi‐
1566 tive over private dependencies of static libraries.
1567
1568 In CMake 3.16 and below the interface link properties attached to li‐
1569 braries are not propagated for private dependencies of static li‐
1570 braries. Only the libraries themselves are propagated to link the de‐
1571 pendent binary. CMake 3.17 and later prefer to propagate all interface
1572 link properties. This policy provides compatibility for projects that
1573 have not been updated to expect the new behavior.
1574
1575 The OLD behavior for this policy is to not propagate interface link
1576 properties. The NEW behavior of this policy is to propagate interface
1577 link properties.
1578
1579 This policy was introduced in CMake version 3.17. Use the
1580 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1581 policies, CMake version 3.25.2 does not warn when this policy is not
1582 set and simply uses OLD behavior.
1583
1584 NOTE:
1585 The OLD behavior of a policy is deprecated by definition and may be
1586 removed in a future version of CMake.
1587
1588 CMP0098
1589 New in version 3.17.
1590
1591
1592 FindFLEX runs flex in directory CMAKE_CURRENT_BINARY_DIR when execut‐
1593 ing.
1594
1595 The module provides a FLEX_TARGET macro which generates FLEX output.
1596 In CMake 3.16 and below the macro would generate a custom command that
1597 runs flex in the current source directory. CMake 3.17 and later prefer
1598 to run it in the build directory and use CMAKE_CURRENT_BINARY_DIR as
1599 the WORKING_DIRECTORY of its add_custom_command() invocation. This en‐
1600 sures that any implicitly generated file is written relative to the
1601 build tree rather than the source tree, unless the generated file is
1602 provided as absolute path.
1603
1604 This policy provides compatibility for projects that have not been up‐
1605 dated to expect the new behavior.
1606
1607 The OLD behavior for this policy is for FLEX_TARGET to use the current
1608 source directory for the WORKING_DIRECTORY and where to generate im‐
1609 plicit files. The NEW behavior of this policy is to use the current bi‐
1610 nary directory for the WORKING_DIRECTORY relative to which implicit
1611 files are generated unless provided as absolute path.
1612
1613 This policy was introduced in CMake version 3.17. Use the
1614 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1615 policies, CMake version 3.25.2 does not warn when this policy is not
1616 set and simply uses OLD behavior.
1617
1618 NOTE:
1619 The OLD behavior of a policy is deprecated by definition and may be
1620 removed in a future version of CMake.
1621
1623 CMP0097
1624 New in version 3.16.
1625
1626
1627 ExternalProject_Add() with GIT_SUBMODULES "" initializes no submodules.
1628 The policy also applies to FetchContent_Declare(), which uses the same
1629 download and update features as ExternalProject_Add().
1630
1631 The commands provide a GIT_SUBMODULES option which controls what sub‐
1632 modules to initialize and update. Starting with CMake 3.16, explicitly
1633 setting GIT_SUBMODULES to an empty string means no submodules will be
1634 initialized or updated.
1635
1636 This policy provides compatibility for projects that have not been up‐
1637 dated to expect the new behavior.
1638
1639 The OLD behavior for this policy is for GIT_SUBMODULES when set to an
1640 empty string to initialize and update all git submodules. The NEW be‐
1641 havior for this policy is for GIT_SUBMODULES when set to an empty
1642 string to initialize and update no git submodules.
1643
1644 This policy was introduced in CMake version 3.16. Use the
1645 cmake_policy() command to set it to OLD or NEW explicitly. Unlike most
1646 policies, CMake version 3.25.2 does not warn when this policy is not
1647 set and simply uses OLD behavior.
1648
1649 CMP0096
1650 New in version 3.16.
1651
1652
1653 The project() command preserves leading zeros in version components.
1654
1655 When a VERSION <major>[.<minor>[.<patch>[.<tweak>]]]] argument is given
1656 to the project() command, it stores the version string in the
1657 PROJECT_VERSION variable and stores individual integer version compo‐
1658 nents in PROJECT_VERSION_{MAJOR,MINOR,PATCH,TWEAK} variables (see pol‐
1659 icy CMP0048). CMake 3.15 and below dropped leading zeros from each
1660 component. CMake 3.16 and higher prefer to preserve leading zeros.
1661 This policy provides compatibility for projects that have not been up‐
1662 dated to expect the new behavior.
1663
1664 The OLD behavior of this policy drops leading zeros in all components,
1665 e.g. such that version 1.07.06 becomes 1.7.6. The NEW behavior of
1666 this policy preserves the leading zeros in all components, such that
1667 version 1.07.06 remains unchanged.
1668
1669 This policy was introduced in CMake version 3.16. Unlike many poli‐
1670 cies, CMake version 3.25.2 does not warn when this policy is not set
1671 and simply uses the OLD behavior. Use the cmake_policy() command to
1672 set it to OLD or NEW explicitly.
1673
1674 NOTE:
1675 The OLD behavior of a policy is deprecated by definition and may be
1676 removed in a future version of CMake.
1677
1678 CMP0095
1679 New in version 3.16.
1680
1681
1682 RPATH entries are properly escaped in the intermediary CMake install
1683 script.
1684
1685 In CMake 3.15 and earlier, RPATH entries set via CMAKE_INSTALL_RPATH or
1686 via INSTALL_RPATH have not been escaped before being inserted into the
1687 cmake_install.cmake script. Dynamic linkers on ELF-based systems (e.g.
1688 Linux and FreeBSD) allow certain keywords in RPATH entries, such as
1689 ${ORIGIN} (More details are available in the ld.so man pages on those
1690 systems). The syntax of these keywords can match CMake's variable syn‐
1691 tax. In order to not be substituted (usually to an empty string) al‐
1692 ready by the intermediary cmake_install.cmake script, the user had to
1693 double-escape such RPATH keywords, e.g. set(CMAKE_INSTALL_RPATH
1694 "\\\${ORIGIN}/../lib"). Since the intermediary cmake_install.cmake
1695 script is an implementation detail of CMake, CMake 3.16 and later will
1696 make sure RPATH entries are inserted literally by escaping any coinci‐
1697 dental CMake syntax.
1698
1699 The OLD behavior of this policy is to not escape RPATH entries in the
1700 intermediary cmake_install.cmake script. The NEW behavior is to prop‐
1701 erly escape coincidental CMake syntax in RPATH entries when generating
1702 the intermediary cmake_install.cmake script.
1703
1704 This policy was introduced in CMake version 3.16. CMake version 3.25.2
1705 warns when the policy is not set and detected usage of CMake-like syn‐
1706 tax and uses OLD behavior. Use the cmake_policy() command to set it to
1707 OLD or NEW explicitly.
1708
1709 NOTE:
1710 The OLD behavior of a policy is deprecated by definition and may be
1711 removed in a future version of CMake.
1712
1714 CMP0094
1715 New in version 3.15.
1716
1717
1718 Modules FindPython3, FindPython2 and FindPython use LOCATION for lookup
1719 strategy.
1720
1721 Starting with CMake 3.15, Modules FindPython3, FindPython2 and
1722 FindPython set value LOCATION for, respectively, variables
1723 Python3_FIND_STRATEGY, Python2_FIND_STRATEGY and Python_FIND_STRATEGY.
1724 This policy provides compatibility with projects that expect the legacy
1725 behavior.
1726
1727 The OLD behavior for this policy set value VERSION for variables
1728 Python3_FIND_STRATEGY, Python2_FIND_STRATEGY and Python_FIND_STRATEGY.
1729
1730 This policy was introduced in CMake version 3.15. Use the
1731 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1732 policies, CMake version 3.25.2 does not warn when this policy is not
1733 set and simply uses the OLD behavior.
1734
1735 NOTE:
1736 The OLD behavior of a policy is deprecated by definition and may be
1737 removed in a future version of CMake.
1738
1739 CMP0093
1740 New in version 3.15.
1741
1742
1743 FindBoost reports Boost_VERSION in x.y.z format.
1744
1745 In CMake 3.14 and below the module would report the Boost version num‐
1746 ber as specified in the preprocessor definition BOOST_VERSION in the
1747 boost/version.hpp file. In CMake 3.15 and later it is preferred that
1748 the reported version number matches the x.y.z format reported by the
1749 CMake package shipped with Boost 1.70.0 and later. The macro value is
1750 still reported in the Boost_VERSION_MACRO variable.
1751
1752 The OLD behavior for this policy is for FindBoost to report Boost_VER‐
1753 SION as specified in the preprocessor definition BOOST_VERSION in
1754 boost/version.hpp. The NEW behavior for this policy is for FindBoost to
1755 report Boost_VERSION in x.y.z format.
1756
1757 This policy was introduced in CMake version 3.15. Use the
1758 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1759 policies, CMake version 3.25.2 does not warn when this policy is not
1760 set and simply uses the OLD behavior.
1761
1762 NOTE:
1763 The OLD behavior of a policy is deprecated by definition and may be
1764 removed in a future version of CMake.
1765
1766 CMP0092
1767 New in version 3.15.
1768
1769
1770 MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
1771
1772 When using MSVC-like compilers in CMake 3.14 and below, warning flags
1773 like /W3 are added to CMAKE_<LANG>_FLAGS by default. This is problem‐
1774 atic for projects that want to choose a different warning level pro‐
1775 grammatically. In particular, it requires string editing of the
1776 CMAKE_<LANG>_FLAGS variables with knowledge of the CMake builtin de‐
1777 faults so they can be replaced.
1778
1779 CMake 3.15 and above prefer to leave out warning flags from the value
1780 of CMAKE_<LANG>_FLAGS by default.
1781
1782 This policy provides compatibility with projects that have not been up‐
1783 dated to expect the lack of warning flags. The policy setting takes
1784 effect as of the first project() or enable_language() command that ini‐
1785 tializes CMAKE_<LANG>_FLAGS for a given language <LANG>.
1786
1787 NOTE:
1788 Once the policy has taken effect at the top of a project for a given
1789 language, that choice must be used throughout the tree for that lan‐
1790 guage. In projects that have nested projects in subdirectories, be
1791 sure to convert everything together.
1792
1793 The OLD behavior for this policy is to place MSVC warning flags in the
1794 default CMAKE_<LANG>_FLAGS cache entries. The NEW behavior for this
1795 policy is to not place MSVC warning flags in the default cache entries.
1796
1797 This policy was introduced in CMake version 3.15. Use the
1798 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1799 policies, CMake version 3.25.2 does not warn when this policy is not
1800 set and simply uses OLD behavior.
1801
1802 NOTE:
1803 The OLD behavior of a policy is deprecated by definition and may be
1804 removed in a future version of CMake.
1805
1806 CMP0091
1807 New in version 3.15.
1808
1809
1810 MSVC runtime library flags are selected by an abstraction.
1811
1812 Compilers targeting the MSVC ABI have flags to select the MSVC runtime
1813 library. Runtime library selection typically varies with build config‐
1814 uration because there is a separate runtime library for Debug builds.
1815
1816 In CMake 3.14 and below, MSVC runtime library selection flags are added
1817 to the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries by CMake auto‐
1818 matically. This allows users to edit their cache entries to adjust the
1819 flags. However, the presence of such default flags is problematic for
1820 projects that want to choose a different runtime library programmati‐
1821 cally. In particular, it requires string editing of the
1822 CMAKE_<LANG>_FLAGS_<CONFIG> variables with knowledge of the CMake
1823 builtin defaults so they can be replaced.
1824
1825 CMake 3.15 and above prefer to leave the MSVC runtime library selection
1826 flags out of the default CMAKE_<LANG>_FLAGS_<CONFIG> values and instead
1827 offer a first-class abstraction. The CMAKE_MSVC_RUNTIME_LIBRARY vari‐
1828 able and MSVC_RUNTIME_LIBRARY target property may be set to select the
1829 MSVC runtime library. If they are not set then CMake uses the default
1830 value MultiThreaded$<$<CONFIG:Debug>:Debug>DLL which is equivalent to
1831 the original flags.
1832
1833 This policy provides compatibility with projects that have not been up‐
1834 dated to be aware of the abstraction. The policy setting takes effect
1835 as of the first project() or enable_language() command that enables a
1836 language whose compiler targets the MSVC ABI.
1837
1838 NOTE:
1839 Once the policy has taken effect at the top of a project, that
1840 choice must be used throughout the tree. In projects that have
1841 nested projects in subdirectories, be sure to convert everything to‐
1842 gether.
1843
1844 The OLD behavior for this policy is to place MSVC runtime library flags
1845 in the default CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and ignore the
1846 CMAKE_MSVC_RUNTIME_LIBRARY abstraction. The NEW behavior for this pol‐
1847 icy is to not place MSVC runtime library flags in the default cache en‐
1848 tries and use the abstraction instead.
1849
1850 This policy was introduced in CMake version 3.15. Use the
1851 cmake_policy() command to set it to OLD or NEW explicitly. Unlike many
1852 policies, CMake version 3.25.2 does not warn when this policy is not
1853 set and simply uses OLD behavior.
1854
1855 NOTE:
1856 The OLD behavior of a policy is deprecated by definition and may be
1857 removed in a future version of CMake.
1858
1859 CMP0090
1860 New in version 3.15.
1861
1862
1863 export(PACKAGE) does not populate package registry by default.
1864
1865 In CMake 3.14 and below the export(PACKAGE) command populated the user
1866 package registry by default and users needed to set the
1867 CMAKE_EXPORT_NO_PACKAGE_REGISTRY to disable it, e.g. in automated build
1868 and packaging environments. Since the user package registry is stored
1869 outside the build tree, this side effect should not be enabled by de‐
1870 fault. Therefore CMake 3.15 and above prefer that export(PACKAGE) does
1871 nothing unless an explicit CMAKE_EXPORT_PACKAGE_REGISTRY variable is
1872 set to enable it. This policy provides compatibility with projects
1873 that have not been updated.
1874
1875 The OLD behavior for this policy is for export(PACKAGE) command to pop‐
1876 ulate the user package registry unless CMAKE_EXPORT_NO_PACKAGE_REGISTRY
1877 is enabled. The NEW behavior is for export(PACKAGE) command to do
1878 nothing unless the CMAKE_EXPORT_PACKAGE_REGISTRY is enabled.
1879
1880 This policy was introduced in CMake version 3.15. Use the
1881 cmake_policy() command to set it to OLD or NEW explicitly. Unlike most
1882 policies, CMake version 3.25.2 does not warn when this policy is not
1883 set and simply uses OLD behavior.
1884
1885 NOTE:
1886 The OLD behavior of a policy is deprecated by definition and may be
1887 removed in a future version of CMake.
1888
1889 CMP0089
1890 New in version 3.15.
1891
1892
1893 Compiler id for IBM Clang-based XL compilers is now XLClang.
1894
1895 CMake 3.15 and above recognize that IBM's Clang-based XL compilers that
1896 define __ibmxl__ are a new front-end distinct from xlc with a different
1897 command line and set of capabilities. CMake now prefers to present
1898 this to projects by setting the CMAKE_<LANG>_COMPILER_ID variable to
1899 XLClang instead of XL. However, existing projects may assume the com‐
1900 piler id for Clang-based XL is just XL as it was in CMake versions
1901 prior to 3.15. Therefore this policy determines for Clang-based XL
1902 compilers which compiler id to report in the CMAKE_<LANG>_COMPILER_ID
1903 variable after language <LANG> is enabled by the project() or
1904 enable_language() command. The policy must be set prior to the invoca‐
1905 tion of either command.
1906
1907 The OLD behavior for this policy is to use compiler id XL. The NEW be‐
1908 havior for this policy is to use compiler id XLClang.
1909
1910 This policy was introduced in CMake version 3.15. Use the
1911 cmake_policy() command to set this policy to OLD or NEW explicitly.
1912 Unlike most policies, CMake version 3.25.2 does not warn by default
1913 when this policy is not set and simply uses OLD behavior. See documen‐
1914 tation of the CMAKE_POLICY_WARNING_CMP0089 variable to control the
1915 warning.
1916
1917 NOTE:
1918 The OLD behavior of a policy is deprecated by definition and may be
1919 removed in a future version of CMake.
1920
1922 CMP0088
1923 New in version 3.14.
1924
1925
1926 FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.
1927
1928 The module provides a BISON_TARGET macro which generates BISON output.
1929 In CMake 3.13 and below the macro would generate a custom command that
1930 runs bison in the source directory. CMake 3.14 and later prefer to run
1931 it in the build directory and use CMAKE_CURRENT_BINARY_DIR as the WORK‐
1932 ING_DIRECTORY of its add_custom_command() invocation. This ensures
1933 that any implicitly generated file is written to the build tree rather
1934 than the source.
1935
1936 This policy provides compatibility for projects that have not been up‐
1937 dated to expect the new behavior.
1938
1939 The OLD behavior for this policy is for BISON_TARGET to use the current
1940 source directory for the WORKING_DIRECTORY and where to generate im‐
1941 plicit files. The NEW behavior of this policy is to use the current bi‐
1942 nary directory for the WORKING_DIRECTORY and where to generate implicit
1943 files.
1944
1945 This policy was introduced in CMake version 3.14. Use the
1946 cmake_policy() command to set it to OLD or NEW explicitly. Unlike most
1947 policies, CMake version 3.25.2 does not warn when this policy is not
1948 set and simply uses OLD behavior.
1949
1950 NOTE:
1951 The OLD behavior of a policy is deprecated by definition and may be
1952 removed in a future version of CMake.
1953
1954 CMP0087
1955 New in version 3.14.
1956
1957
1958 install(CODE) and install(SCRIPT) support generator expressions.
1959
1960 In CMake 3.13 and earlier, install(CODE) and install(SCRIPT) did not
1961 evaluate generator expressions. CMake 3.14 and later will evaluate
1962 generator expressions for install(CODE) and install(SCRIPT).
1963
1964 The OLD behavior of this policy is for install(CODE) and
1965 install(SCRIPT) to not evaluate generator expressions. The NEW behav‐
1966 ior is to evaluate generator expressions for install(CODE) and
1967 install(SCRIPT).
1968
1969 Note that it is the value of this policy setting at the end of the di‐
1970 rectory scope that is important, not its setting at the time of the
1971 call to install(CODE) or install(SCRIPT). This has implications for
1972 calling these commands from places that have their own policy scope but
1973 not their own directory scope (e.g. from files brought in via include()
1974 rather than add_subdirectory()).
1975
1976 This policy was introduced in CMake version 3.14. CMake version 3.25.2
1977 warns when the policy is not set and uses OLD behavior. Use the
1978 cmake_policy() command to set it to OLD or NEW explicitly.
1979
1980 NOTE:
1981 The OLD behavior of a policy is deprecated by definition and may be
1982 removed in a future version of CMake.
1983
1984 CMP0086
1985 New in version 3.14.
1986
1987
1988 UseSWIG honors SWIG_MODULE_NAME via -module flag.
1989
1990 Starting with CMake 3.14, UseSWIG passes option -module <module_name>
1991 to SWIG compiler if the file property SWIG_MODULE_NAME is specified.
1992 This policy provides compatibility with projects that expect the legacy
1993 behavior.
1994
1995 The OLD behavior for this policy is to never pass -module option. The
1996 NEW behavior is to pass -module option to SWIG compiler if SWIG_MOD‐
1997 ULE_NAME is specified.
1998
1999 This policy was introduced in CMake version 3.14. CMake version 3.25.2
2000 warns when the policy is not set and uses OLD behavior. Use the
2001 cmake_policy() command to set it to OLD or NEW explicitly.
2002
2003 NOTE:
2004 The OLD behavior of a policy is deprecated by definition and may be
2005 removed in a future version of CMake.
2006
2007 CMP0085
2008 New in version 3.14.
2009
2010
2011 $<IN_LIST:...> handles empty list items.
2012
2013 In CMake 3.13 and lower, the $<IN_LIST:...> generator expression always
2014 returned 0 if the first argument was empty, even if the list contained
2015 an empty item. This behavior is inconsistent with the IN_LIST behavior
2016 of if(), which this generator expression is meant to emulate. CMake
2017 3.14 and later handles this case correctly.
2018
2019 The OLD behavior of this policy is for $<IN_LIST:...> to always return
2020 0 if the first argument is empty. The NEW behavior is to return 1 if
2021 the first argument is empty and the list contains an empty item.
2022
2023 This policy was introduced in CMake version 3.14. CMake version 3.25.2
2024 warns when the policy is not set and uses OLD behavior. Use the
2025 cmake_policy() command to set it to OLD or NEW explicitly.
2026
2027 NOTE:
2028 The OLD behavior of a policy is deprecated by definition and may be
2029 removed in a future version of CMake.
2030
2031 CMP0084
2032 New in version 3.14.
2033
2034
2035 The FindQt module does not exist for find_package().
2036
2037 The existence of FindQt means that for Qt upstream to provide package
2038 config files that can be found by find_package(Qt), the consuming
2039 project has to explicitly specify find_package(Qt CONFIG). Removing
2040 this module gives Qt a path forward for exporting its own config files
2041 which can easily be found by consuming projects.
2042
2043 This policy pretends that CMake's internal FindQt module does not exist
2044 for find_package(). If a project really wants to use Qt 3 or 4, it can
2045 call find_package(Qt[34]), include(FindQt), or add FindQt to their
2046 CMAKE_MODULE_PATH.
2047
2048 The OLD behavior of this policy is for FindQt to exist for
2049 find_package(). The NEW behavior is to pretend that it doesn't exist
2050 for find_package().
2051
2052 This policy was introduced in CMake version 3.14. CMake version 3.25.2
2053 warns when the policy is not set and uses OLD behavior. Use the
2054 cmake_policy() command to set it to OLD or NEW explicitly.
2055
2056 NOTE:
2057 The OLD behavior of a policy is deprecated by definition and may be
2058 removed in a future version of CMake.
2059
2060 CMP0083
2061 New in version 3.14.
2062
2063
2064 To control generation of Position Independent Executable (PIE) or not,
2065 some flags are required at link time.
2066
2067 CMake 3.13 and lower did not add these link flags when
2068 POSITION_INDEPENDENT_CODE is set.
2069
2070 The OLD behavior for this policy is to not manage PIE link flags. The
2071 NEW behavior is to add link flags if POSITION_INDEPENDENT_CODE is set:
2072
2073 • Set to TRUE: flags to produce a position independent executable are
2074 passed to the linker step. For example -pie for GCC.
2075
2076 • Set to FALSE: flags not to produce a position independent executable
2077 are passed to the linker step. For example -no-pie for GCC.
2078
2079 • Not set: no flags are passed to the linker step.
2080
2081 Since a given linker may not support PIE flags in all environments in
2082 which it is used, it is the project's responsibility to use the
2083 CheckPIESupported module to check for support to ensure that the
2084 POSITION_INDEPENDENT_CODE target property for executables will be hon‐
2085 ored at link time.
2086
2087 This policy was introduced in CMake version 3.14. Use the
2088 cmake_policy() command to set it to OLD or NEW explicitly. Unlike most
2089 policies, CMake version 3.25.2 does not warn when this policy is not
2090 set and simply uses OLD behavior.
2091
2092 NOTE:
2093 Android platform has a special handling of PIE so it is not required
2094 to use the CheckPIESupported module to ensure flags are passed to
2095 the linker.
2096
2097 NOTE:
2098 The OLD behavior of a policy is deprecated by definition and may be
2099 removed in a future version of CMake.
2100
2101 Examples
2102 Behave like CMake 3.13 and do not apply any PIE flags at link stage.
2103
2104 cmake_minimum_required(VERSION 3.13)
2105 project(foo)
2106
2107 # ...
2108
2109 add_executable(foo ...)
2110 set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE)
2111
2112 Use the CheckPIESupported module to detect whether PIE is supported by
2113 the current linker and environment. Apply PIE flags only if the linker
2114 supports them.
2115
2116 cmake_minimum_required(VERSION 3.14) # CMP0083 NEW
2117 project(foo)
2118
2119 include(CheckPIESupported)
2120 check_pie_supported()
2121
2122 # ...
2123
2124 add_executable(foo ...)
2125 set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE)
2126
2127 CMP0082
2128 New in version 3.14.
2129
2130
2131 Install rules from add_subdirectory() calls are interleaved with those
2132 in caller.
2133
2134 CMake 3.13 and lower ran the install rules from add_subdirectory() af‐
2135 ter all other install rules, even if add_subdirectory() was called be‐
2136 fore the other install rules. CMake 3.14 and above prefer to inter‐
2137 leave these add_subdirectory() install rules with the others so that
2138 they are run in the order they are declared. This policy provides com‐
2139 patibility for projects that have not been updated to expect the new
2140 behavior.
2141
2142 The OLD behavior for this policy is to run the install rules from
2143 add_subdirectory() after the other install rules. The NEW behavior for
2144 this policy is to run all install rules in the order they are declared.
2145
2146 This policy was introduced in CMake version 3.14. Unlike most poli‐
2147 cies, CMake version 3.25.2 does not warn by default when this policy is
2148 not set and simply uses OLD behavior. See documentation of the
2149 CMAKE_POLICY_WARNING_CMP0082 variable to control the warning.
2150
2151 NOTE:
2152 The OLD behavior of a policy is deprecated by definition and may be
2153 removed in a future version of CMake.
2154
2156 CMP0081
2157 New in version 3.13.
2158
2159
2160 Relative paths not allowed in LINK_DIRECTORIES target property.
2161
2162 CMake 3.12 and lower allowed the LINK_DIRECTORIES directory property to
2163 contain relative paths. The base path for such relative entries is not
2164 well defined. CMake 3.13 and later will issue a FATAL_ERROR if the
2165 LINK_DIRECTORIES target property (which is initialized by the
2166 LINK_DIRECTORIES directory property) contains a relative path.
2167
2168 The OLD behavior for this policy is not to warn about relative paths in
2169 the LINK_DIRECTORIES target property. The NEW behavior for this policy
2170 is to issue a FATAL_ERROR if LINK_DIRECTORIES contains a relative path.
2171
2172 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2173 warns when the policy is not set and uses OLD behavior. Use the
2174 cmake_policy() command to set it to OLD or NEW explicitly.
2175
2176 NOTE:
2177 The OLD behavior of a policy is deprecated by definition and may be
2178 removed in a future version of CMake.
2179
2180 CMP0080
2181 New in version 3.13.
2182
2183
2184 BundleUtilities cannot be included at configure time.
2185
2186 The macros provided by BundleUtilities are intended to be invoked at
2187 install time rather than at configure time, because they depend on the
2188 listed targets already existing at the time they are invoked. If they
2189 are invoked at configure time, the targets haven't been built yet, and
2190 the commands will fail.
2191
2192 This policy restricts the inclusion of BundleUtilities to cmake -P
2193 style scripts and install rules. Specifically, it looks for the pres‐
2194 ence of CMAKE_GENERATOR and throws a fatal error if it exists.
2195
2196 The OLD behavior of this policy is to allow BundleUtilities to be in‐
2197 cluded at configure time. The NEW behavior of this policy is to disal‐
2198 low such inclusion.
2199
2200 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2201 warns when the policy is not set and uses OLD behavior. Use the
2202 cmake_policy() command to set it to OLD or NEW explicitly.
2203
2204 NOTE:
2205 The OLD behavior of a policy is deprecated by definition and may be
2206 removed in a future version of CMake.
2207
2208 CMP0079
2209 New in version 3.13.
2210
2211
2212 target_link_libraries() allows use with targets in other directories.
2213
2214 Prior to CMake 3.13 the target_link_libraries() command did not accept
2215 targets not created in the calling directory as its first argument for
2216 calls that update the LINK_LIBRARIES of the target itself. It did ac‐
2217 cidentally accept targets from other directories on calls that only up‐
2218 date the INTERFACE_LINK_LIBRARIES, but would simply add entries to the
2219 property as if the call were made in the original directory. Thus link
2220 interface libraries specified this way were always looked up by genera‐
2221 tors in the scope of the original target rather than in the scope that
2222 called target_link_libraries().
2223
2224 CMake 3.13 now allows the target_link_libraries() command to be called
2225 from any directory to add link dependencies and link interface li‐
2226 braries to targets created in other directories. The entries are added
2227 to LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES using a special (inter‐
2228 nal) suffix to tell the generators to look up the names in the calling
2229 scope rather than the scope that created the target.
2230
2231 This policy provides compatibility with projects that already use
2232 target_link_libraries() with the INTERFACE keyword on a target in an‐
2233 other directory to add INTERFACE_LINK_LIBRARIES entries to be looked up
2234 in the target's directory. Such projects should be updated to be aware
2235 of the new scoping rules in that case.
2236
2237 The OLD behavior of this policy is to disallow target_link_libraries()
2238 calls naming targets from another directory except in the previously
2239 accidentally allowed case of using the INTERFACE keyword only. The NEW
2240 behavior of this policy is to allow all such calls but use the new
2241 scoping rules.
2242
2243 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2244 warns when the policy is not set and uses OLD behavior. Use the
2245 cmake_policy() command to set it to OLD or NEW explicitly.
2246
2247 NOTE:
2248 The OLD behavior of a policy is deprecated by definition and may be
2249 removed in a future version of CMake.
2250
2251 CMP0078
2252 New in version 3.13.
2253
2254
2255 UseSWIG generates standard target names.
2256
2257 Starting with CMake 3.13, UseSWIG generates now standard target names.
2258 This policy provides compatibility with projects that expect the legacy
2259 behavior.
2260
2261 The OLD behavior for this policy relies on UseSWIG_TARGET_NAME_PREFER‐
2262 ENCE variable that can be used to specify an explicit preference. The
2263 value may be one of:
2264
2265 • LEGACY: legacy strategy is applied. Variable SWIG_MOD‐
2266 ULE_<name>_REAL_NAME must be used to get real target name. This is
2267 the default if not specified.
2268
2269 • STANDARD: target name matches specified name.
2270
2271 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2272 warns when the policy is not set and uses OLD behavior. Use the
2273 cmake_policy() command to set it to OLD or NEW explicitly.
2274
2275 NOTE:
2276 The OLD behavior of a policy is deprecated by definition and may be
2277 removed in a future version of CMake.
2278
2279 CMP0077
2280 New in version 3.13.
2281
2282
2283 option() honors normal variables.
2284
2285 The option() command is typically used to create a cache entry to allow
2286 users to set the option. However, there are cases in which a normal
2287 (non-cached) variable of the same name as the option may be defined by
2288 the project prior to calling the option() command. For example, a
2289 project that embeds another project as a subdirectory may want to
2290 hard-code options of the subproject to build the way it needs.
2291
2292 For historical reasons in CMake 3.12 and below the option() command re‐
2293 moves a normal (non-cached) variable of the same name when:
2294
2295 • a cache entry of the specified name does not exist at all, or
2296
2297 • a cache entry of the specified name exists but has not been given a
2298 type (e.g. via -D<name>=ON on the command line).
2299
2300 In both of these cases (typically on the first run in a new build
2301 tree), the option() command gives the cache entry type BOOL and removes
2302 any normal (non-cached) variable of the same name. In the remaining
2303 case that the cache entry of the specified name already exists and has
2304 a type (typically on later runs in a build tree), the option() command
2305 changes nothing and any normal variable of the same name remains set.
2306
2307 In CMake 3.13 and above the option() command prefers to do nothing when
2308 a normal variable of the given name already exists. It does not create
2309 or update a cache entry or remove the normal variable. The new behav‐
2310 ior is consistent between the first and later runs in a build tree.
2311 This policy provides compatibility with projects that have not been up‐
2312 dated to expect the new behavior.
2313
2314 When the option() command sees a normal variable of the given name:
2315
2316 • The OLD behavior for this policy is to proceed even when a normal
2317 variable of the same name exists. If the cache entry does not al‐
2318 ready exist and have a type then it is created and/or given a type
2319 and the normal variable is removed.
2320
2321 • The NEW behavior for this policy is to do nothing when a normal vari‐
2322 able of the same name exists. The normal variable is not removed.
2323 The cache entry is not created or updated and is ignored if it ex‐
2324 ists.
2325
2326 See CMP0126 for a similar policy for the set(CACHE) command, but note
2327 that there are some differences in NEW behavior between the two poli‐
2328 cies.
2329
2330 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2331 warns when the policy is not set and uses OLD behavior. Use the
2332 cmake_policy() command to set it to OLD or NEW explicitly within a
2333 project. Use the CMAKE_POLICY_DEFAULT_CMP0077 variable to set the pol‐
2334 icy for a third-party project in a subdirectory without modifying it.
2335
2336 NOTE:
2337 The OLD behavior of a policy is deprecated by definition and may be
2338 removed in a future version of CMake.
2339
2340 CMP0076
2341 New in version 3.13.
2342
2343
2344 The target_sources() command converts relative paths to absolute.
2345
2346 In CMake 3.13 and above, the target_sources() command now converts rel‐
2347 ative source file paths to absolute paths in the following cases:
2348
2349 • Source files are added to the target's INTERFACE_SOURCES property.
2350
2351 • The target's SOURCE_DIR property differs from
2352 CMAKE_CURRENT_SOURCE_DIR.
2353
2354 A path that begins with a generator expression is always left unmodi‐
2355 fied.
2356
2357 This policy provides compatibility with projects that have not been up‐
2358 dated to expect this behavior. The OLD behavior for this policy is to
2359 leave all relative source file paths unmodified. The NEW behavior of
2360 this policy is to convert relative paths to absolute according to above
2361 rules.
2362
2363 This policy was introduced in CMake version 3.13. CMake version 3.25.2
2364 warns when the policy is not set and uses OLD behavior. Use the
2365 cmake_policy() command to set it to OLD or NEW explicitly.
2366
2367 NOTE:
2368 The OLD behavior of a policy is deprecated by definition and may be
2369 removed in a future version of CMake.
2370
2372 CMP0075
2373 New in version 3.12.
2374
2375
2376 Include file check macros honor CMAKE_REQUIRED_LIBRARIES.
2377
2378 In CMake 3.12 and above, the
2379
2380 • check_include_file macro in the CheckIncludeFile module, the
2381
2382 • check_include_file_cxx macro in the CheckIncludeFileCXX module, and
2383 the
2384
2385 • check_include_files macro in the CheckIncludeFiles module
2386
2387 now prefer to link the check executable to the libraries listed in the
2388 CMAKE_REQUIRED_LIBRARIES variable. This policy provides compatibility
2389 with projects that have not been updated to expect this behavior.
2390
2391 The OLD behavior for this policy is to ignore CMAKE_REQUIRED_LIBRARIES
2392 in the include file check macros. The NEW behavior of this policy is
2393 to honor CMAKE_REQUIRED_LIBRARIES in the include file check macros.
2394
2395 This policy was introduced in CMake version 3.12. CMake version 3.25.2
2396 warns when the policy is not set and uses OLD behavior. Use the
2397 cmake_policy() command to set it to OLD or NEW explicitly.
2398
2399 NOTE:
2400 The OLD behavior of a policy is deprecated by definition and may be
2401 removed in a future version of CMake.
2402
2403 CMP0074
2404 New in version 3.12.
2405
2406
2407 find_package() uses <PackageName>_ROOT variables.
2408
2409 In CMake 3.12 and above the find_package(<PackageName>) command now
2410 searches prefixes specified by the <PackageName>_ROOT CMake variable
2411 and the <PackageName>_ROOT environment variable. Package roots are
2412 maintained as a stack so nested calls to all find_* commands inside
2413 find modules and config packages also search the roots as prefixes.
2414 This policy provides compatibility with projects that have not been up‐
2415 dated to avoid using <PackageName>_ROOT variables for other purposes.
2416
2417 The OLD behavior for this policy is to ignore <PackageName>_ROOT vari‐
2418 ables. The NEW behavior for this policy is to use <PackageName>_ROOT
2419 variables.
2420
2421 This policy was introduced in CMake version 3.12. CMake version 3.25.2
2422 warns when the policy is not set and uses OLD behavior. Use the
2423 cmake_policy() command to set it to OLD or NEW explicitly.
2424
2425 NOTE:
2426 The OLD behavior of a policy is deprecated by definition and may be
2427 removed in a future version of CMake.
2428
2429 CMP0073
2430 New in version 3.12.
2431
2432
2433 Do not produce legacy _LIB_DEPENDS cache entries.
2434
2435 Ancient CMake versions once used <tgt>_LIB_DEPENDS cache entries to
2436 propagate library link dependencies. This has long been done by other
2437 means, leaving the export_library_dependencies() command as the only
2438 user of these values. That command has long been disallowed by policy
2439 CMP0033, but the <tgt>_LIB_DEPENDS cache entries were left for compati‐
2440 bility with possible non-standard uses by projects.
2441
2442 CMake 3.12 and above now prefer to not produce these cache entries at
2443 all. This policy provides compatibility with projects that have not
2444 been updated to avoid using them.
2445
2446 The OLD behavior for this policy is to set <tgt>_LIB_DEPENDS cache en‐
2447 tries. The NEW behavior for this policy is to not set them.
2448
2449 This policy was introduced in CMake version 3.12. Use the
2450 cmake_policy() command to set it to OLD or NEW explicitly. Unlike most
2451 policies, CMake version 3.25.2 does not warn when this policy is not
2452 set and simply uses OLD behavior.
2453
2454 NOTE:
2455 The OLD behavior of a policy is deprecated by definition and may be
2456 removed in a future version of CMake.
2457
2459 CMP0072
2460 New in version 3.11.
2461
2462
2463 FindOpenGL prefers GLVND by default when available.
2464
2465 The FindOpenGL module provides an OpenGL::GL target and an OPENGL_LI‐
2466 BRARIES variable for projects to use for legacy GL interfaces. When
2467 both a legacy GL library (e.g. libGL.so) and GLVND libraries for OpenGL
2468 and GLX (e.g. libOpenGL.so and libGLX.so) are available, the module
2469 must choose between them. It documents an OpenGL_GL_PREFERENCE vari‐
2470 able that can be used to specify an explicit preference. When no such
2471 preference is set, the module must choose a default preference.
2472
2473 CMake 3.11 and above prefer to choose GLVND libraries. This policy
2474 provides compatibility with projects that expect the legacy GL library
2475 to be used.
2476
2477 The OLD behavior for this policy is to set OpenGL_GL_PREFERENCE to
2478 LEGACY. The NEW behavior for this policy is to set OpenGL_GL_PREFER‐
2479 ENCE to GLVND.
2480
2481 This policy was introduced in CMake version 3.11. CMake version 3.25.2
2482 warns when the policy is not set and uses OLD behavior. Use the
2483 cmake_policy() command to set it to OLD or NEW explicitly.
2484
2485 NOTE:
2486 The OLD behavior of a policy is deprecated by definition and may be
2487 removed in a future version of CMake.
2488
2490 CMP0071
2491 New in version 3.10.
2492
2493
2494 Let AUTOMOC and AUTOUIC process GENERATED files.
2495
2496 Since version 3.10, CMake processes regular and GENERATED source files
2497 in AUTOMOC and AUTOUIC. In earlier CMake versions, only regular source
2498 files were processed. GENERATED source files were ignored silently.
2499
2500 This policy affects how source files that are GENERATED get treated in
2501 AUTOMOC and AUTOUIC.
2502
2503 The OLD behavior for this policy is to ignore GENERATED source files in
2504 AUTOMOC and AUTOUIC.
2505
2506 The NEW behavior for this policy is to process GENERATED source files
2507 in AUTOMOC and AUTOUIC just like regular source files.
2508
2509 NOTE:
2510 To silence the CMP0071 warning source files can be excluded from
2511 AUTOMOC and AUTOUIC processing by setting the source file properties
2512 SKIP_AUTOMOC, SKIP_AUTOUIC or SKIP_AUTOGEN.
2513
2514 Source skip example:
2515
2516 # ...
2517 set_property(SOURCE /path/to/file1.h PROPERTY SKIP_AUTOMOC ON)
2518 set_property(SOURCE /path/to/file2.h PROPERTY SKIP_AUTOUIC ON)
2519 set_property(SOURCE /path/to/file3.h PROPERTY SKIP_AUTOGEN ON)
2520 # ...
2521
2522 This policy was introduced in CMake version 3.10. CMake version 3.25.2
2523 warns when the policy is not set and uses OLD behavior. Use the
2524 cmake_policy() command to set it to OLD or NEW explicitly.
2525
2526 NOTE:
2527 The OLD behavior of a policy is deprecated by definition and may be
2528 removed in a future version of CMake.
2529
2530 CMP0070
2531 New in version 3.10.
2532
2533
2534 Define file(GENERATE) behavior for relative paths.
2535
2536 CMake 3.10 and newer define that relative paths given to INPUT and OUT‐
2537 PUT arguments of file(GENERATE) are interpreted relative to the current
2538 source and binary directories, respectively. CMake 3.9 and lower did
2539 not define any behavior for relative paths but did not diagnose them
2540 either and accidentally treated them relative to the process working
2541 directory. Policy CMP0070 provides compatibility with projects that
2542 used the old undefined behavior.
2543
2544 This policy affects behavior of relative paths given to file(GENERATE).
2545 The OLD behavior for this policy is to treat the paths relative to the
2546 working directory of CMake. The NEW behavior for this policy is to in‐
2547 terpret relative paths with respect to the current source or binary di‐
2548 rectory of the caller.
2549
2550 This policy was introduced in CMake version 3.10. CMake version 3.25.2
2551 warns when the policy is not set and uses OLD behavior. Use the
2552 cmake_policy() command to set it to OLD or NEW explicitly.
2553
2554 NOTE:
2555 The OLD behavior of a policy is deprecated by definition and may be
2556 removed in a future version of CMake.
2557
2559 CMP0069
2560 New in version 3.9.
2561
2562
2563 INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
2564
2565 CMake 3.9 and newer prefer to add IPO flags whenever the
2566 INTERPROCEDURAL_OPTIMIZATION target property is enabled and produce an
2567 error if flags are not known to CMake for the current compiler. Since
2568 a given compiler may not support IPO flags in all environments in which
2569 it is used, it is now the project's responsibility to use the
2570 CheckIPOSupported module to check for support before enabling the
2571 INTERPROCEDURAL_OPTIMIZATION target property. This approach allows a
2572 project to conditionally activate IPO when supported. It also allows
2573 an end user to set the CMAKE_INTERPROCEDURAL_OPTIMIZATION variable in
2574 an environment known to support IPO even if the project does not enable
2575 the property.
2576
2577 Since CMake 3.8 and lower only honored INTERPROCEDURAL_OPTIMIZATION for
2578 the Intel compiler on Linux, some projects may unconditionally enable
2579 the target property. Policy CMP0069 provides compatibility with such
2580 projects.
2581
2582 This policy takes effect whenever the IPO property is enabled. The OLD
2583 behavior for this policy is to add IPO flags only for Intel compiler on
2584 Linux. The NEW behavior for this policy is to add IPO flags for the
2585 current compiler or produce an error if CMake does not know the flags.
2586
2587 This policy was introduced in CMake version 3.9. CMake version 3.25.2
2588 warns when the policy is not set and uses OLD behavior. Use the
2589 cmake_policy() command to set it to OLD or NEW explicitly.
2590
2591 NOTE:
2592 The OLD behavior of a policy is deprecated by definition and may be
2593 removed in a future version of CMake.
2594
2595 Examples
2596 Behave like CMake 3.8 and do not apply any IPO flags except for Intel
2597 compiler on Linux:
2598
2599 cmake_minimum_required(VERSION 3.8)
2600 project(foo)
2601
2602 # ...
2603
2604 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
2605
2606 Use the CheckIPOSupported module to detect whether IPO is supported by
2607 the current compiler, environment, and CMake version. Produce a fatal
2608 error if support is not available:
2609
2610 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
2611 project(foo)
2612
2613 include(CheckIPOSupported)
2614 check_ipo_supported()
2615
2616 # ...
2617
2618 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
2619
2620 Apply IPO flags only if compiler supports it:
2621
2622 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
2623 project(foo)
2624
2625 include(CheckIPOSupported)
2626
2627 # ...
2628
2629 check_ipo_supported(RESULT result)
2630 if(result)
2631 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
2632 endif()
2633
2634 Apply IPO flags without any checks. This may lead to build errors if
2635 IPO is not supported by the compiler in the current environment. Pro‐
2636 duce an error if CMake does not know IPO flags for the current com‐
2637 piler:
2638
2639 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
2640 project(foo)
2641
2642 # ...
2643
2644 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
2645
2646 CMP0068
2647 New in version 3.9.
2648
2649
2650 RPATH settings on macOS do not affect install_name.
2651
2652 CMake 3.9 and newer remove any effect the following settings may have
2653 on the install_name of a target on macOS:
2654
2655 • BUILD_WITH_INSTALL_RPATH target property
2656
2657 • SKIP_BUILD_RPATH target property
2658
2659 • CMAKE_SKIP_RPATH variable
2660
2661 • CMAKE_SKIP_INSTALL_RPATH variable
2662
2663 Previously, setting BUILD_WITH_INSTALL_RPATH had the effect of setting
2664 both the install_name of a target to INSTALL_NAME_DIR and the RPATH to
2665 INSTALL_RPATH. In CMake 3.9, it only affects setting of RPATH. How‐
2666 ever, if one wants INSTALL_NAME_DIR to apply to the target in the build
2667 tree, one may set BUILD_WITH_INSTALL_NAME_DIR.
2668
2669 If SKIP_BUILD_RPATH, CMAKE_SKIP_RPATH or CMAKE_SKIP_INSTALL_RPATH were
2670 used to strip the directory portion of the install_name of a target,
2671 one may set INSTALL_NAME_DIR="" instead.
2672
2673 The OLD behavior of this policy is to use the RPATH settings for in‐
2674 stall_name on macOS. The NEW behavior of this policy is to ignore the
2675 RPATH settings for install_name on macOS.
2676
2677 This policy was introduced in CMake version 3.9. CMake version 3.25.2
2678 warns when the policy is not set and uses OLD behavior. Use the
2679 cmake_policy() command to set it to OLD or NEW explicitly.
2680
2681 NOTE:
2682 The OLD behavior of a policy is deprecated by definition and may be
2683 removed in a future version of CMake.
2684
2686 CMP0067
2687 New in version 3.8.
2688
2689
2690 Honor language standard in try_compile() source-file signature.
2691
2692 The try_compile() source file signature is intended to allow callers to
2693 check whether they will be able to compile a given source file with the
2694 current toolchain. In order to match compiler behavior, any language
2695 standard mode should match. However, CMake 3.7 and below did not do
2696 this. CMake 3.8 and above prefer to honor the language standard set‐
2697 tings for C, CXX (C++), and CUDA using the values of the variables:
2698
2699 • CMAKE_C_STANDARD
2700
2701 • CMAKE_C_STANDARD_REQUIRED
2702
2703 • CMAKE_C_EXTENSIONS
2704
2705 • CMAKE_CXX_STANDARD
2706
2707 • CMAKE_CXX_STANDARD_REQUIRED
2708
2709 • CMAKE_CXX_EXTENSIONS
2710
2711 • CMAKE_CUDA_STANDARD
2712
2713 • CMAKE_CUDA_STANDARD_REQUIRED
2714
2715 • CMAKE_CUDA_EXTENSIONS
2716
2717 This policy provides compatibility for projects that do not expect the
2718 language standard settings to be used automatically.
2719
2720 The OLD behavior of this policy is to ignore language standard setting
2721 variables when generating the try_compile test project. The NEW behav‐
2722 ior of this policy is to honor language standard setting variables.
2723
2724 This policy was introduced in CMake version 3.8. Unlike most policies,
2725 CMake version 3.25.2 does not warn by default when this policy is not
2726 set and simply uses OLD behavior. See documentation of the
2727 CMAKE_POLICY_WARNING_CMP0067 variable to control the warning.
2728
2729 NOTE:
2730 The OLD behavior of a policy is deprecated by definition and may be
2731 removed in a future version of CMake.
2732
2734 CMP0066
2735 New in version 3.7.
2736
2737
2738 Honor per-config flags in try_compile() source-file signature.
2739
2740 The source file signature of the try_compile() command uses the value
2741 of the CMAKE_<LANG>_FLAGS variable in the test project so that the test
2742 compilation works as it would in the main project. However, CMake 3.6
2743 and below do not also honor config-specific compiler flags such as
2744 those in the CMAKE_<LANG>_FLAGS_DEBUG variable. CMake 3.7 and above
2745 prefer to honor config-specific compiler flags too. This policy pro‐
2746 vides compatibility for projects that do not expect config-specific
2747 compiler flags to be used.
2748
2749 The OLD behavior of this policy is to ignore config-specific flag vari‐
2750 ables like CMAKE_<LANG>_FLAGS_DEBUG and only use CMake's built-in de‐
2751 faults for the current compiler and platform.
2752
2753 The NEW behavior of this policy is to honor config-specific flag vari‐
2754 abldes like CMAKE_<LANG>_FLAGS_DEBUG.
2755
2756 This policy was introduced in CMake version 3.7. Unlike most policies,
2757 CMake version 3.25.2 does not warn by default when this policy is not
2758 set and simply uses OLD behavior. See documentation of the
2759 CMAKE_POLICY_WARNING_CMP0066 variable to control the warning.
2760
2761 NOTE:
2762 The OLD behavior of a policy is deprecated by definition and may be
2763 removed in a future version of CMake.
2764
2766 CMP0065
2767 New in version 3.4.
2768
2769
2770 Do not add flags to export symbols from executables without the
2771 ENABLE_EXPORTS target property.
2772
2773 CMake 3.3 and below, for historical reasons, always linked executables
2774 on some platforms with flags like -rdynamic to export symbols from the
2775 executables for use by any plugins they may load via dlopen. CMake 3.4
2776 and above prefer to do this only for executables that are explicitly
2777 marked with the ENABLE_EXPORTS target property.
2778
2779 The OLD behavior of this policy is to always use the additional link
2780 flags when linking executables regardless of the value of the
2781 ENABLE_EXPORTS target property.
2782
2783 The NEW behavior of this policy is to only use the additional link
2784 flags when linking executables if the ENABLE_EXPORTS target property is
2785 set to True.
2786
2787 This policy was introduced in CMake version 3.4. Unlike most policies,
2788 CMake version 3.25.2 does not warn by default when this policy is not
2789 set and simply uses OLD behavior. See documentation of the
2790 CMAKE_POLICY_WARNING_CMP0065 variable to control the warning.
2791
2792 NOTE:
2793 The OLD behavior of a policy is deprecated by definition and may be
2794 removed in a future version of CMake.
2795
2796 CMP0064
2797 New in version 3.4.
2798
2799
2800 Recognize TEST as a operator for the if() command.
2801
2802 The TEST operator was added to the if() command to determine if a given
2803 test name was created by the add_test() command.
2804
2805 The OLD behavior for this policy is to ignore the TEST operator. The
2806 NEW behavior is to interpret the TEST operator.
2807
2808 This policy was introduced in CMake version 3.4. CMake version 3.25.2
2809 warns when the policy is not set and uses OLD behavior. Use the
2810 cmake_policy() command to set it to OLD or NEW explicitly.
2811
2812 NOTE:
2813 The OLD behavior of a policy is deprecated by definition and may be
2814 removed in a future version of CMake.
2815
2817 CMP0063
2818 New in version 3.3.
2819
2820
2821 Honor visibility properties for all target types.
2822
2823 The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target prop‐
2824 erties affect visibility of symbols during dynamic linking. When first
2825 introduced these properties affected compilation of sources only in
2826 shared libraries, module libraries, and executables with the
2827 ENABLE_EXPORTS property set. This was sufficient for the basic use
2828 cases of shared libraries and executables with plugins. However, some
2829 sources may be compiled as part of static libraries or object libraries
2830 and then linked into a shared library later. CMake 3.3 and above pre‐
2831 fer to honor these properties for sources compiled in all target types.
2832 This policy preserves compatibility for projects expecting the proper‐
2833 ties to work only for some target types.
2834
2835 The OLD behavior for this policy is to ignore the visibility properties
2836 for static libraries, object libraries, and executables without ex‐
2837 ports. The NEW behavior for this policy is to honor the visibility
2838 properties for all target types.
2839
2840 This policy was introduced in CMake version 3.3. CMake version 3.25.2
2841 warns when the policy is not set and uses OLD behavior. Use the
2842 cmake_policy() command to set it to OLD or NEW explicitly.
2843
2844 NOTE:
2845 The OLD behavior of a policy is deprecated by definition and may be
2846 removed in a future version of CMake.
2847
2848 CMP0062
2849 New in version 3.3.
2850
2851
2852 Disallow install() of export() result.
2853
2854 The export() command generates a file containing Imported Targets,
2855 which is suitable for use from the build directory. It is not suitable
2856 for installation because it contains absolute paths to buildsystem lo‐
2857 cations, and is particular to a single build configuration.
2858
2859 The install(EXPORT) generates and installs files which contain Imported
2860 Targets. These files are generated with relative paths (unless the
2861 user specifies absolute paths), and are designed for multi-configura‐
2862 tion use. See Creating Packages for more.
2863
2864 CMake 3.3 no longer allows the use of the install(FILES) command with
2865 the result of the export() command.
2866
2867 The OLD behavior for this policy is to allow installing the result of
2868 an export() command. The NEW behavior for this policy is not to allow
2869 installing the result of an export() command.
2870
2871 This policy was introduced in CMake version 3.3. CMake version 3.25.2
2872 warns when the policy is not set and uses OLD behavior. Use the
2873 cmake_policy() command to set it to OLD or NEW explicitly.
2874
2875 NOTE:
2876 The OLD behavior of a policy is deprecated by definition and may be
2877 removed in a future version of CMake.
2878
2879 CMP0061
2880 New in version 3.3.
2881
2882
2883 CTest does not by default tell make to ignore errors (-i).
2884
2885 The ctest_build() and build_command() commands no longer generate build
2886 commands for Makefile Generators with the -i option. Previously this
2887 was done to help build as much of tested projects as possible. How‐
2888 ever, this behavior is not consistent with other generators and also
2889 causes the return code of the make tool to be meaningless.
2890
2891 Of course users may still add this option manually by setting
2892 CTEST_BUILD_COMMAND or the MAKECOMMAND cache entry. See the CTest
2893 Build Step MakeCommand setting documentation for their effects.
2894
2895 The OLD behavior for this policy is to add -i to make calls in CTest.
2896 The NEW behavior for this policy is to not add -i.
2897
2898 This policy was introduced in CMake version 3.3. Unlike most policies,
2899 CMake version 3.25.2 does not warn when this policy is not set and sim‐
2900 ply uses OLD behavior.
2901
2902 NOTE:
2903 The OLD behavior of a policy is deprecated by definition and may be
2904 removed in a future version of CMake.
2905
2906 CMP0060
2907 New in version 3.3.
2908
2909
2910 Link libraries by full path even in implicit directories.
2911
2912 Policy CMP0003 was introduced with the intention of always linking li‐
2913 brary files by full path when a full path is given to the
2914 target_link_libraries() command. However, on some platforms (e.g.
2915 HP-UX) the compiler front-end adds alternative library search paths for
2916 the current architecture (e.g. /usr/lib/<arch> has alternatives to li‐
2917 braries in /usr/lib for the current architecture). On such platforms
2918 the find_library() may find a library such as /usr/lib/libfoo.so that
2919 does not belong to the current architecture.
2920
2921 Prior to policy CMP0003 projects would still build in such cases be‐
2922 cause the incorrect library path would be converted to -lfoo on the
2923 link line and the linker would find the proper library in the arch-spe‐
2924 cific search path provided by the compiler front-end implicitly. At
2925 the time we chose to remain compatible with such projects by always
2926 converting library files found in implicit link directories to -lfoo
2927 flags to ask the linker to search for them. This approach allowed ex‐
2928 isting projects to continue to build while still linking to libraries
2929 outside implicit link directories via full path (such as those in the
2930 build tree).
2931
2932 CMake does allow projects to override this behavior by using an
2933 IMPORTED library target with its IMPORTED_LOCATION property set to the
2934 desired full path to a library file. In fact, many Find Modules are
2935 learning to provide Imported Targets instead of just the traditional
2936 Foo_LIBRARIES variable listing library files. However, this makes the
2937 link line generated for a library found by a Find Module depend on
2938 whether it is linked through an imported target or not, which is incon‐
2939 sistent. Furthermore, this behavior has been a source of confusion be‐
2940 cause the generated link line for a library file depends on its loca‐
2941 tion. It is also problematic for projects trying to link statically
2942 because flags like -Wl,-Bstatic -lfoo -Wl,-Bdynamic may be used to help
2943 the linker select libfoo.a instead of libfoo.so but then leak dynamic
2944 linking to following libraries. (See the LINK_SEARCH_END_STATIC target
2945 property for a solution typically used for that problem.)
2946
2947 When the special case for libraries in implicit link directories was
2948 first introduced the list of implicit link directories was simply
2949 hard-coded (e.g. /lib, /usr/lib, and a few others). Since that time,
2950 CMake has learned to detect the implicit link directories used by the
2951 compiler front-end. If necessary, the find_library() command could be
2952 taught to use this information to help find libraries of the proper ar‐
2953 chitecture.
2954
2955 For these reasons, CMake 3.3 and above prefer to drop the special case
2956 and link libraries by full path even when they are in implicit link di‐
2957 rectories. Policy CMP0060 provides compatibility for existing
2958 projects.
2959
2960 The OLD behavior for this policy is to ask the linker to search for li‐
2961 braries whose full paths are known to be in implicit link directories.
2962 The NEW behavior for this policy is to link libraries by full path even
2963 if they are in implicit link directories.
2964
2965 This policy was introduced in CMake version 3.3. Unlike most policies,
2966 CMake version 3.25.2 does not warn by default when this policy is not
2967 set and simply uses OLD behavior. See documentation of the
2968 CMAKE_POLICY_WARNING_CMP0060 variable to control the warning.
2969
2970 NOTE:
2971 The OLD behavior of a policy is deprecated by definition and may be
2972 removed in a future version of CMake.
2973
2974 CMP0059
2975 New in version 3.3.
2976
2977
2978 Do not treat DEFINITIONS as a built-in directory property.
2979
2980 CMake 3.3 and above no longer make a list of definitions available
2981 through the DEFINITIONS directory property. The COMPILE_DEFINITIONS
2982 directory property may be used instead.
2983
2984 The OLD behavior for this policy is to provide the list of flags given
2985 so far to the add_definitions() command. The NEW behavior is to behave
2986 as a normal user-defined directory property.
2987
2988 This policy was introduced in CMake version 3.3. CMake version 3.25.2
2989 warns when the policy is not set and uses OLD behavior. Use the
2990 cmake_policy() command to set it to OLD or NEW explicitly.
2991
2992 NOTE:
2993 The OLD behavior of a policy is deprecated by definition and may be
2994 removed in a future version of CMake.
2995
2996 CMP0058
2997 New in version 3.3.
2998
2999
3000 Ninja requires custom command byproducts to be explicit.
3001
3002 When an intermediate file generated during the build is consumed by an
3003 expensive operation or a large tree of dependents, one may reduce the
3004 work needed for an incremental rebuild by updating the file timestamp
3005 only when its content changes. With this approach the generation rule
3006 must have a separate output file that is always updated with a new
3007 timestamp that is newer than any dependencies of the rule so that the
3008 build tool re-runs the rule only when the input changes. We refer to
3009 the separate output file as a rule's witness and the generated file as
3010 a rule's byproduct.
3011
3012 Byproducts may not be listed as outputs because their timestamps are
3013 allowed to be older than the inputs. No build tools (like make) that
3014 existed when CMake was designed have a way to express byproducts.
3015 Therefore CMake versions prior to 3.2 had no way to specify them.
3016 Projects typically left byproducts undeclared in the rules that gener‐
3017 ate them. For example:
3018
3019 add_custom_command(
3020 OUTPUT witness.txt
3021 COMMAND ${CMAKE_COMMAND} -E copy_if_different
3022 ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
3023 byproduct.txt # timestamp may not change
3024 COMMAND ${CMAKE_COMMAND} -E touch witness.txt
3025 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
3026 )
3027 add_custom_target(Provider DEPENDS witness.txt)
3028 add_custom_command(
3029 OUTPUT generated.c
3030 COMMAND expensive-task -i byproduct.txt -o generated.c
3031 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt
3032 )
3033 add_library(Consumer generated.c)
3034 add_dependencies(Consumer Provider)
3035
3036 This works well for all generators except Ninja. The Ninja build tool
3037 sees a rule listing byproduct.txt as a dependency and no rule listing
3038 it as an output. Ninja then complains that there is no way to satisfy
3039 the dependency and stops building even though there are order-only de‐
3040 pendencies that ensure byproduct.txt will exist before its consumers
3041 need it. See discussion of this problem in Ninja Issue 760 for further
3042 details on why Ninja works this way.
3043
3044 Instead of leaving byproducts undeclared in the rules that generate
3045 them, Ninja expects byproducts to be listed along with other outputs.
3046 Such rules may be marked with a restat option that tells Ninja to check
3047 the timestamps of outputs after the rules run. This prevents byprod‐
3048 ucts whose timestamps do not change from causing their dependents to
3049 re-build unnecessarily.
3050
3051 Since the above approach does not tell CMake what custom command gener‐
3052 ates byproduct.txt, the Ninja generator does not have enough informa‐
3053 tion to add the byproduct as an output of any rule. CMake 2.8.12 and
3054 above work around this problem and allow projects using the above ap‐
3055 proach to build by generating phony build rules to tell Ninja to toler‐
3056 ate such missing files. However, this workaround prevents Ninja from
3057 diagnosing a dependency that is really missing. It also works poorly
3058 in in-source builds where every custom command dependency, even on
3059 source files, needs to be treated this way because CMake does not have
3060 enough information to know which files are generated as byproducts of
3061 custom commands.
3062
3063 Introducing Byproducts
3064 CMake 3.2 introduced the BYPRODUCTS option to the add_custom_command()
3065 and add_custom_target() commands. This option allows byproducts to be
3066 specified explicitly:
3067
3068 add_custom_command(
3069 OUTPUT witness.txt
3070 BYPRODUCTS byproduct.txt # explicit byproduct specification
3071 COMMAND ${CMAKE_COMMAND} -E copy_if_different
3072 ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
3073 byproduct.txt # timestamp may not change
3074 ...
3075
3076 The BYPRODUCTS option is used by the Ninja generator to list byproducts
3077 among the outputs of the custom commands that generate them, and is ig‐
3078 nored by other generators.
3079
3080 CMake 3.3 and above prefer to require projects to specify custom com‐
3081 mand byproducts explicitly so that it can avoid using the phony rule
3082 workaround altogether. Policy CMP0058 was introduced to provide com‐
3083 patibility with existing projects that still need the workaround.
3084
3085 This policy has no effect on generators other than Ninja. The OLD be‐
3086 havior for this policy is to generate Ninja phony rules for unknown de‐
3087 pendencies in the build tree. The NEW behavior for this policy is to
3088 not generate these and instead require projects to specify custom com‐
3089 mand BYPRODUCTS explicitly.
3090
3091 This policy was introduced in CMake version 3.3. CMake version 3.25.2
3092 warns when it sees unknown dependencies in out-of-source build trees if
3093 the policy is not set and then uses OLD behavior. Use the
3094 cmake_policy() command to set the policy to OLD or NEW explicitly. The
3095 policy setting must be in scope at the end of the top-level CMake‐
3096 Lists.txt file of the project and has global effect.
3097
3098 NOTE:
3099 The OLD behavior of a policy is deprecated by definition and may be
3100 removed in a future version of CMake.
3101
3102 CMP0057
3103 New in version 3.3.
3104
3105
3106 Support new if() IN_LIST operator.
3107
3108 CMake 3.3 adds support for the new IN_LIST operator.
3109
3110 The OLD behavior for this policy is to ignore the IN_LIST operator.
3111 The NEW behavior is to interpret the IN_LIST operator.
3112
3113 This policy was introduced in CMake version 3.3. CMake version 3.25.2
3114 warns when the policy is not set and uses OLD behavior. Use the
3115 cmake_policy() command to set it to OLD or NEW explicitly.
3116
3117 NOTE:
3118 The OLD behavior of a policy is deprecated by definition and may be
3119 removed in a future version of CMake.
3120
3122 CMP0056
3123 New in version 3.2.
3124
3125
3126 Honor link flags in try_compile() source-file signature.
3127
3128 The try_compile() command source-file signature generates a CMake‐
3129 Lists.txt file to build the source file into an executable. In order
3130 to compile the source the same way as it might be compiled by the call‐
3131 ing project, the generated project sets the value of the
3132 CMAKE_<LANG>_FLAGS variable to that in the calling project. The value
3133 of the CMAKE_EXE_LINKER_FLAGS variable may be needed in some cases too,
3134 but CMake 3.1 and lower did not set it in the generated project. CMake
3135 3.2 and above prefer to set it so that linker flags are honored as well
3136 as compiler flags. This policy provides compatibility with the pre-3.2
3137 behavior.
3138
3139 The OLD behavior for this policy is to not set the value of the
3140 CMAKE_EXE_LINKER_FLAGS variable in the generated test project. The NEW
3141 behavior for this policy is to set the value of the
3142 CMAKE_EXE_LINKER_FLAGS variable in the test project to the same as it
3143 is in the calling project.
3144
3145 If the project code does not set the policy explicitly, users may set
3146 it on the command line by defining the CMAKE_POLICY_DEFAULT_CMP0056
3147 variable in the cache.
3148
3149 This policy was introduced in CMake version 3.2. Unlike most policies,
3150 CMake version 3.25.2 does not warn by default when this policy is not
3151 set and simply uses OLD behavior. See documentation of the
3152 CMAKE_POLICY_WARNING_CMP0056 variable to control the warning.
3153
3154 NOTE:
3155 The OLD behavior of a policy is deprecated by definition and may be
3156 removed in a future version of CMake.
3157
3158 CMP0055
3159 New in version 3.2.
3160
3161
3162 Strict checking for the break() command.
3163
3164 CMake 3.1 and lower allowed calls to the break() command outside of a
3165 loop context and also ignored any given arguments. This was undefined
3166 behavior.
3167
3168 The OLD behavior for this policy is to allow break() to be placed out‐
3169 side of loop contexts and ignores any arguments. The NEW behavior for
3170 this policy is to issue an error if a misplaced break or any arguments
3171 are found.
3172
3173 This policy was introduced in CMake version 3.2. CMake version 3.25.2
3174 warns when the policy is not set and uses OLD behavior. Use the
3175 cmake_policy() command to set it to OLD or NEW explicitly.
3176
3177 NOTE:
3178 The OLD behavior of a policy is deprecated by definition and may be
3179 removed in a future version of CMake.
3180
3182 CMP0054
3183 New in version 3.1.
3184
3185
3186 Only interpret if() arguments as variables or keywords when unquoted.
3187
3188 CMake 3.1 and above no longer implicitly dereference variables or in‐
3189 terpret keywords in an if() command argument when it is a Quoted Argu‐
3190 ment or a Bracket Argument.
3191
3192 The OLD behavior for this policy is to dereference variables and inter‐
3193 pret keywords even if they are quoted or bracketed. The NEW behavior
3194 is to not dereference variables or interpret keywords that have been
3195 quoted or bracketed.
3196
3197 Given the following partial example:
3198
3199 set(A E)
3200 set(E "")
3201
3202 if("${A}" STREQUAL "")
3203 message("Result is TRUE before CMake 3.1 or when CMP0054 is OLD")
3204 else()
3205 message("Result is FALSE in CMake 3.1 and above if CMP0054 is NEW")
3206 endif()
3207
3208 After explicit expansion of variables this gives:
3209
3210 if("E" STREQUAL "")
3211
3212 With the policy set to OLD implicit expansion reduces this semantically
3213 to:
3214
3215 if("" STREQUAL "")
3216
3217 With the policy set to NEW the quoted arguments will not be further
3218 dereferenced:
3219
3220 if("E" STREQUAL "")
3221
3222 This policy was introduced in CMake version 3.1. CMake version 3.25.2
3223 warns when the policy is not set and uses OLD behavior. Use the
3224 cmake_policy() command to set it to OLD or NEW explicitly.
3225
3226 NOTE:
3227 The OLD behavior of a policy is deprecated by definition and may be
3228 removed in a future version of CMake.
3229
3230 CMP0053
3231 New in version 3.1.
3232
3233
3234 Simplify variable reference and escape sequence evaluation.
3235
3236 CMake 3.1 introduced a much faster implementation of evaluation of the
3237 Variable References and Escape Sequences documented in the
3238 cmake-language(7) manual. While the behavior is identical to the
3239 legacy implementation in most cases, some corner cases were cleaned up
3240 to simplify the behavior. Specifically:
3241
3242 • Expansion of @VAR@ reference syntax defined by the configure_file()
3243 and string(CONFIGURE) commands is no longer performed in other con‐
3244 texts.
3245
3246 • Literal ${VAR} reference syntax may contain only alphanumeric charac‐
3247 ters (A-Z, a-z, 0-9) and the characters _, ., /, -, and +. Note that
3248 $ is technically allowed in the NEW behavior, but is invalid for OLD
3249 behavior. This is due to an oversight during the implementation of
3250 CMP0053 and its use as a literal variable reference is discouraged
3251 for this reason. Variables with other characters in their name may
3252 still be referenced indirectly, e.g.
3253
3254 set(varname "otherwise & disallowed $ characters")
3255 message("${${varname}}")
3256
3257 • The setting of policy CMP0010 is not considered, so improper variable
3258 reference syntax is always an error.
3259
3260 • More characters are allowed to be escaped in variable names. Previ‐
3261 ously, only ()#" \@^ were valid characters to escape. Now any non-al‐
3262 phanumeric, non-semicolon, non-NUL character may be escaped following
3263 the escape_identity production in the Escape Sequences section of the
3264 cmake-language(7) manual.
3265
3266 The OLD behavior for this policy is to honor the legacy behavior for
3267 variable references and escape sequences. The NEW behavior is to use
3268 the simpler variable expansion and escape sequence evaluation rules.
3269
3270 This policy was introduced in CMake version 3.1. CMake version 3.25.2
3271 warns when the policy is not set and uses OLD behavior. Use the
3272 cmake_policy() command to set it to OLD or NEW explicitly.
3273
3274 NOTE:
3275 The OLD behavior of a policy is deprecated by definition and may be
3276 removed in a future version of CMake.
3277
3278 CMP0052
3279 New in version 3.1.
3280
3281
3282 Reject source and build dirs in installed
3283 INTERFACE_INCLUDE_DIRECTORIES.
3284
3285 CMake 3.0 and lower allowed subdirectories of the source directory or
3286 build directory to be in the INTERFACE_INCLUDE_DIRECTORIES of installed
3287 and exported targets, if the directory was also a subdirectory of the
3288 installation prefix. This makes the installation depend on the exis‐
3289 tence of the source dir or binary dir, and the installation will be
3290 broken if either are removed after installation.
3291
3292 See Include Directories and Usage Requirements for more on specifying
3293 include directories for targets.
3294
3295 The OLD behavior for this policy is to export the content of the
3296 INTERFACE_INCLUDE_DIRECTORIES with the source or binary directory. The
3297 NEW behavior for this policy is to issue an error if such a directory
3298 is used.
3299
3300 This policy was introduced in CMake version 3.1. CMake version 3.25.2
3301 warns when the policy is not set and uses OLD behavior. Use the
3302 cmake_policy() command to set it to OLD or NEW explicitly.
3303
3304 NOTE:
3305 The OLD behavior of a policy is deprecated by definition and may be
3306 removed in a future version of CMake.
3307
3308 CMP0051
3309 New in version 3.1.
3310
3311
3312 List TARGET_OBJECTS in SOURCES target property.
3313
3314 CMake 3.0 and lower did not include the TARGET_OBJECTS generator ex‐
3315 pression when returning the SOURCES target property.
3316
3317 Configure-time CMake code is not able to handle generator expressions.
3318 If using the SOURCES target property at configure time, it may be nec‐
3319 essary to first remove generator expressions using the
3320 string(GENEX_STRIP) command. Generate-time CMake code such as
3321 file(GENERATE) can handle the content without stripping.
3322
3323 The OLD behavior for this policy is to omit TARGET_OBJECTS expressions
3324 from the SOURCES target property. The NEW behavior for this policy is
3325 to include TARGET_OBJECTS expressions in the output.
3326
3327 This policy was introduced in CMake version 3.1. CMake version 3.25.2
3328 warns when the policy is not set and uses OLD behavior. Use the
3329 cmake_policy() command to set it to OLD or NEW explicitly.
3330
3331 NOTE:
3332 The OLD behavior of a policy is deprecated by definition and may be
3333 removed in a future version of CMake.
3334
3336 CMP0050
3337 Disallow add_custom_command SOURCE signatures.
3338
3339 CMake 2.8.12 and lower allowed a signature for add_custom_command()
3340 which specified an input to a command. This was undocumented behavior.
3341 Modern use of CMake associates custom commands with their output,
3342 rather than their input.
3343
3344 The OLD behavior for this policy is to allow the use of
3345 add_custom_command() SOURCE signatures. The NEW behavior for this pol‐
3346 icy is to issue an error if such a signature is used.
3347
3348 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3349 warns when the policy is not set and uses OLD behavior. Use the
3350 cmake_policy() command to set it to OLD or NEW explicitly.
3351
3352 NOTE:
3353 The OLD behavior of a policy is deprecated by definition and may be
3354 removed in a future version of CMake.
3355
3356 CMP0049
3357 Do not expand variables in target source entries.
3358
3359 CMake 2.8.12 and lower performed an extra layer of variable expansion
3360 when evaluating source file names:
3361
3362 set(a_source foo.c)
3363 add_executable(foo \${a_source})
3364
3365 This was undocumented behavior.
3366
3367 The OLD behavior for this policy is to expand such variables when pro‐
3368 cessing the target sources. The NEW behavior for this policy is to is‐
3369 sue an error if such variables need to be expanded.
3370
3371 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3372 warns when the policy is not set and uses OLD behavior. Use the
3373 cmake_policy() command to set it to OLD or NEW explicitly.
3374
3375 NOTE:
3376 The OLD behavior of a policy is deprecated by definition and may be
3377 removed in a future version of CMake.
3378
3379 CMP0048
3380 The project() command manages VERSION variables.
3381
3382 CMake version 3.0 introduced the VERSION option of the project() com‐
3383 mand to specify a project version as well as the name. In order to
3384 keep PROJECT_VERSION and related variables consistent with variable
3385 PROJECT_NAME it is necessary to set the VERSION variables to the empty
3386 string when no VERSION is given to project(). However, this can change
3387 behavior for existing projects that set VERSION variables themselves
3388 since project() may now clear them. This policy controls the behavior
3389 for compatibility with such projects.
3390
3391 The OLD behavior for this policy is to leave VERSION variables un‐
3392 touched. The NEW behavior for this policy is to set VERSION as docu‐
3393 mented by the project() command.
3394
3395 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3396 warns when the policy is not set and uses OLD behavior. Use the
3397 cmake_policy() command to set it to OLD or NEW explicitly.
3398
3399 NOTE:
3400 The OLD behavior of a policy is deprecated by definition and may be
3401 removed in a future version of CMake.
3402
3403 CMP0047
3404 Use QCC compiler id for the qcc drivers on QNX.
3405
3406 CMake 3.0 and above recognize that the QNX qcc compiler driver is dif‐
3407 ferent from the GNU compiler. CMake now prefers to present this to
3408 projects by setting the CMAKE_<LANG>_COMPILER_ID variable to QCC in‐
3409 stead of GNU. However, existing projects may assume the compiler id
3410 for QNX qcc is just GNU as it was in CMake versions prior to 3.0.
3411 Therefore this policy determines for QNX qcc which compiler id to re‐
3412 port in the CMAKE_<LANG>_COMPILER_ID variable after language <LANG> is
3413 enabled by the project() or enable_language() command. The policy must
3414 be set prior to the invocation of either command.
3415
3416 The OLD behavior for this policy is to use the GNU compiler id for the
3417 qcc and QCC compiler drivers. The NEW behavior for this policy is to
3418 use the QCC compiler id for those drivers.
3419
3420 This policy was introduced in CMake version 3.0. Use the
3421 cmake_policy() command to set this policy to OLD or NEW explicitly.
3422 Unlike most policies, CMake version 3.25.2 does not warn by default
3423 when this policy is not set and simply uses OLD behavior. See documen‐
3424 tation of the CMAKE_POLICY_WARNING_CMP0047 variable to control the
3425 warning.
3426
3427 NOTE:
3428 The OLD behavior of a policy is deprecated by definition and may be
3429 removed in a future version of CMake.
3430
3431 CMP0046
3432 Error on non-existent dependency in add_dependencies.
3433
3434 CMake 2.8.12 and lower silently ignored non-existent dependencies
3435 listed in the add_dependencies() command.
3436
3437 The OLD behavior for this policy is to silently ignore non-existent de‐
3438 pendencies. The NEW behavior for this policy is to report an error if
3439 non-existent dependencies are listed in the add_dependencies() command.
3440
3441 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3442 warns when the policy is not set and uses OLD behavior. Use the
3443 cmake_policy() command to set it to OLD or NEW explicitly.
3444
3445 NOTE:
3446 The OLD behavior of a policy is deprecated by definition and may be
3447 removed in a future version of CMake.
3448
3449 CMP0045
3450 Error on non-existent target in get_target_property.
3451
3452 In CMake 2.8.12 and lower, the get_target_property() command accepted a
3453 non-existent target argument without issuing any error or warning. The
3454 result variable is set to a -NOTFOUND value.
3455
3456 The OLD behavior for this policy is to issue no warning and set the re‐
3457 sult variable to a -NOTFOUND value. The NEW behavior for this policy
3458 is to issue a FATAL_ERROR if the command is called with a non-existent
3459 target.
3460
3461 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3462 warns when the policy is not set and uses OLD behavior. Use the
3463 cmake_policy() command to set it to OLD or NEW explicitly.
3464
3465 NOTE:
3466 The OLD behavior of a policy is deprecated by definition and may be
3467 removed in a future version of CMake.
3468
3469 CMP0044
3470 Case sensitive <LANG>_COMPILER_ID generator expressions
3471
3472 CMake 2.8.12 introduced the <LANG>_COMPILER_ID generator expressions to
3473 allow comparison of the CMAKE_<LANG>_COMPILER_ID with a test value.
3474 The possible valid values are lowercase, but the comparison with the
3475 test value was performed case-insensitively.
3476
3477 The OLD behavior for this policy is to perform a case-insensitive com‐
3478 parison with the value in the <LANG>_COMPILER_ID expression. The NEW
3479 behavior for this policy is to perform a case-sensitive comparison with
3480 the value in the <LANG>_COMPILER_ID expression.
3481
3482 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3483 warns when the policy is not set and uses OLD behavior. Use the
3484 cmake_policy() command to set it to OLD or NEW explicitly.
3485
3486 NOTE:
3487 The OLD behavior of a policy is deprecated by definition and may be
3488 removed in a future version of CMake.
3489
3490 CMP0043
3491 Ignore COMPILE_DEFINITIONS_<Config> properties
3492
3493 CMake 2.8.12 and lower allowed setting the COMPILE_DEFINITIONS_<CONFIG>
3494 target property and COMPILE_DEFINITIONS_<CONFIG> directory property to
3495 apply configuration-specific compile definitions.
3496
3497 Since CMake 2.8.10, the COMPILE_DEFINITIONS property has supported
3498 generator expressions for setting configuration-dependent content. The
3499 continued existence of the suffixed variables is redundant, and causes
3500 a maintenance burden. Population of the COMPILE_DEFINITIONS_DEBUG
3501 property may be replaced with a population of COMPILE_DEFINITIONS di‐
3502 rectly or via target_compile_definitions():
3503
3504 # Old Interfaces:
3505 set_property(TARGET tgt APPEND PROPERTY
3506 COMPILE_DEFINITIONS_DEBUG DEBUG_MODE
3507 )
3508 set_property(DIRECTORY APPEND PROPERTY
3509 COMPILE_DEFINITIONS_DEBUG DIR_DEBUG_MODE
3510 )
3511
3512 # New Interfaces:
3513 set_property(TARGET tgt APPEND PROPERTY
3514 COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG_MODE>
3515 )
3516 target_compile_definitions(tgt PRIVATE $<$<CONFIG:Debug>:DEBUG_MODE>)
3517 set_property(DIRECTORY APPEND PROPERTY
3518 COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DIR_DEBUG_MODE>
3519 )
3520
3521 The OLD behavior for this policy is to consume the content of the suf‐
3522 fixed COMPILE_DEFINITIONS_<CONFIG> target property when generating the
3523 compilation command. The NEW behavior for this policy is to ignore the
3524 content of the COMPILE_DEFINITIONS_<CONFIG> target property .
3525
3526 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3527 warns when the policy is not set and uses OLD behavior. Use the
3528 cmake_policy() command to set it to OLD or NEW explicitly.
3529
3530 NOTE:
3531 The OLD behavior of a policy is deprecated by definition and may be
3532 removed in a future version of CMake.
3533
3534 CMP0042
3535 MACOSX_RPATH is enabled by default.
3536
3537 CMake 2.8.12 and newer has support for using @rpath in a target's in‐
3538 stall name. This was enabled by setting the target property
3539 MACOSX_RPATH. The @rpath in an install name is a more flexible and
3540 powerful mechanism than @executable_path or @loader_path for locating
3541 shared libraries.
3542
3543 CMake 3.0 and later prefer this property to be ON by default. Projects
3544 wanting @rpath in a target's install name may remove any setting of the
3545 INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables.
3546
3547 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3548 warns when the policy is not set and uses OLD behavior. Use the
3549 cmake_policy() command to set it to OLD or NEW explicitly.
3550
3551 NOTE:
3552 The OLD behavior of a policy is deprecated by definition and may be
3553 removed in a future version of CMake.
3554
3555 CMP0041
3556 Error on relative include with generator expression.
3557
3558 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the
3559 INTERFACE_INCLUDE_DIRECTORIES of a target if it contained a generator
3560 expression at any position.
3561
3562 The path entries in that target property should not be relative.
3563 High-level API should ensure that by adding either a source directory
3564 or a install directory prefix, as appropriate.
3565
3566 As an additional diagnostic, the INTERFACE_INCLUDE_DIRECTORIES gener‐
3567 ated on an IMPORTED target for the install location should not contain
3568 paths in the source directory or the build directory.
3569
3570 The OLD behavior for this policy is to ignore relative path entries if
3571 they contain a generator expression. The NEW behavior for this policy
3572 is to report an error if a generator expression appears in another lo‐
3573 cation and the path is relative.
3574
3575 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3576 warns when the policy is not set and uses OLD behavior. Use the
3577 cmake_policy() command to set it to OLD or NEW explicitly.
3578
3579 NOTE:
3580 The OLD behavior of a policy is deprecated by definition and may be
3581 removed in a future version of CMake.
3582
3583 CMP0040
3584 The target in the TARGET signature of add_custom_command() must exist
3585 and must be defined in the current directory.
3586
3587 CMake 2.8.12 and lower silently ignored a custom command created with
3588 the TARGET signature of add_custom_command() if the target is unknown
3589 or was defined outside the current directory.
3590
3591 The OLD behavior for this policy is to ignore custom commands for un‐
3592 known targets. The NEW behavior for this policy is to report an error
3593 if the target referenced in add_custom_command() is unknown or was de‐
3594 fined outside the current directory.
3595
3596 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3597 warns when the policy is not set and uses OLD behavior. Use the
3598 cmake_policy() command to set it to OLD or NEW explicitly.
3599
3600 NOTE:
3601 The OLD behavior of a policy is deprecated by definition and may be
3602 removed in a future version of CMake.
3603
3604 CMP0039
3605 Utility targets may not have link dependencies.
3606
3607 CMake 2.8.12 and lower allowed using utility targets in the left hand
3608 side position of the target_link_libraries() command. This is an indi‐
3609 cator of a bug in user code.
3610
3611 The OLD behavior for this policy is to ignore attempts to set the link
3612 libraries of utility targets. The NEW behavior for this policy is to
3613 report an error if an attempt is made to set the link libraries of a
3614 utility target.
3615
3616 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3617 warns when the policy is not set and uses OLD behavior. Use the
3618 cmake_policy() command to set it to OLD or NEW explicitly.
3619
3620 NOTE:
3621 The OLD behavior of a policy is deprecated by definition and may be
3622 removed in a future version of CMake.
3623
3624 CMP0038
3625 Targets may not link directly to themselves.
3626
3627 CMake 2.8.12 and lower allowed a build target to link to itself di‐
3628 rectly with a target_link_libraries() call. This is an indicator of a
3629 bug in user code.
3630
3631 The OLD behavior for this policy is to ignore targets which list them‐
3632 selves in their own link implementation. The NEW behavior for this
3633 policy is to report an error if a target attempts to link to itself.
3634
3635 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3636 warns when the policy is not set and uses OLD behavior. Use the
3637 cmake_policy() command to set it to OLD or NEW explicitly.
3638
3639 NOTE:
3640 The OLD behavior of a policy is deprecated by definition and may be
3641 removed in a future version of CMake.
3642
3643 CMP0037
3644 Target names should not be reserved and should match a validity pat‐
3645 tern.
3646
3647 CMake 2.8.12 and lower allowed creating targets using add_library(),
3648 add_executable() and add_custom_target() with unrestricted choice for
3649 the target name. Newer cmake features such as
3650 cmake-generator-expressions(7) and some diagnostics expect target names
3651 to match a restricted pattern.
3652
3653 Target names may contain upper and lower case letters, numbers, the un‐
3654 derscore character (_), dot(.), plus(+) and minus(-). As a special
3655 case, ALIAS and IMPORTED targets may contain two consecutive colons.
3656
3657 Target names reserved by one or more CMake generators are not allowed.
3658 Among others these include all, clean, help, and install.
3659
3660 Target names associated with optional features, such as test and pack‐
3661 age, may also be reserved. CMake 3.10 and below always reserve them.
3662 CMake 3.11 and above reserve them only when the corresponding feature
3663 is enabled (e.g. by including the CTest or CPack modules).
3664
3665 The OLD behavior for this policy is to allow creating targets with re‐
3666 served names or which do not match the validity pattern. The NEW be‐
3667 havior for this policy is to report an error if an add_* command is
3668 used with an invalid target name.
3669
3670 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3671 warns when the policy is not set and uses OLD behavior. Use the
3672 cmake_policy() command to set it to OLD or NEW explicitly.
3673
3674 NOTE:
3675 The OLD behavior of a policy is deprecated by definition and may be
3676 removed in a future version of CMake.
3677
3678 CMP0036
3679 The build_name() command should not be called.
3680
3681 This command was added in May 2001 to compute a name for the current
3682 operating system and compiler combination. The command has long been
3683 documented as discouraged and replaced by the CMAKE_SYSTEM and
3684 CMAKE_<LANG>_COMPILER variables.
3685
3686 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3687 ior for this policy is to allow the command to be called. The NEW be‐
3688 havior for this policy is to issue a FATAL_ERROR when the command is
3689 called.
3690
3691 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3692 warns when the policy is not set and uses OLD behavior. Use the
3693 cmake_policy() command to set it to OLD or NEW explicitly.
3694
3695 NOTE:
3696 The OLD behavior of a policy is deprecated by definition and may be
3697 removed in a future version of CMake.
3698
3699 CMP0035
3700 The variable_requires() command should not be called.
3701
3702 This command was introduced in November 2001 to perform some condi‐
3703 tional logic. It has long been replaced by the if() command.
3704
3705 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3706 ior for this policy is to allow the command to be called. The NEW be‐
3707 havior for this policy is to issue a FATAL_ERROR when the command is
3708 called.
3709
3710 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3711 warns when the policy is not set and uses OLD behavior. Use the
3712 cmake_policy() command to set it to OLD or NEW explicitly.
3713
3714 NOTE:
3715 The OLD behavior of a policy is deprecated by definition and may be
3716 removed in a future version of CMake.
3717
3718 CMP0034
3719 The utility_source() command should not be called.
3720
3721 This command was introduced in March 2001 to help build executables
3722 used to generate other files. This approach has long been replaced by
3723 add_executable() combined with add_custom_command().
3724
3725 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3726 ior for this policy is to allow the command to be called. The NEW be‐
3727 havior for this policy is to issue a FATAL_ERROR when the command is
3728 called.
3729
3730 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3731 warns when the policy is not set and uses OLD behavior. Use the
3732 cmake_policy() command to set it to OLD or NEW explicitly.
3733
3734 NOTE:
3735 The OLD behavior of a policy is deprecated by definition and may be
3736 removed in a future version of CMake.
3737
3738 CMP0033
3739 The export_library_dependencies() command should not be called.
3740
3741 This command was added in January 2003 to export <tgt>_LIB_DEPENDS in‐
3742 ternal CMake cache entries to a file for installation with a project.
3743 This was used at the time to allow transitive link dependencies to work
3744 for applications outside of the original build tree of a project. The
3745 functionality has been superseded by the export() and install(EXPORT)
3746 commands.
3747
3748 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3749 ior for this policy is to allow the command to be called. The NEW be‐
3750 havior for this policy is to issue a FATAL_ERROR when the command is
3751 called.
3752
3753 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3754 warns when the policy is not set and uses OLD behavior. Use the
3755 cmake_policy() command to set it to OLD or NEW explicitly.
3756
3757 NOTE:
3758 The OLD behavior of a policy is deprecated by definition and may be
3759 removed in a future version of CMake.
3760
3761 CMP0032
3762 The output_required_files() command should not be called.
3763
3764 This command was added in June 2001 to expose the then-current CMake
3765 implicit dependency scanner. CMake's real implicit dependency scanner
3766 has evolved since then but is not exposed through this command. The
3767 scanning capabilities of this command are very limited and this func‐
3768 tionality is better achieved through dedicated outside tools.
3769
3770 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3771 ior for this policy is to allow the command to be called. The NEW be‐
3772 havior for this policy is to issue a FATAL_ERROR when the command is
3773 called.
3774
3775 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3776 warns when the policy is not set and uses OLD behavior. Use the
3777 cmake_policy() command to set it to OLD or NEW explicitly.
3778
3779 NOTE:
3780 The OLD behavior of a policy is deprecated by definition and may be
3781 removed in a future version of CMake.
3782
3783 CMP0031
3784 The load_command() command should not be called.
3785
3786 This command was added in August 2002 to allow projects to add arbi‐
3787 trary commands implemented in C or C++. However, it does not work when
3788 the toolchain in use does not match the ABI of the CMake process. It
3789 has been mostly superseded by the macro() and function() commands.
3790
3791 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3792 ior for this policy is to allow the command to be called. The NEW be‐
3793 havior for this policy is to issue a FATAL_ERROR when the command is
3794 called.
3795
3796 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3797 warns when the policy is not set and uses OLD behavior. Use the
3798 cmake_policy() command to set it to OLD or NEW explicitly.
3799
3800 NOTE:
3801 The OLD behavior of a policy is deprecated by definition and may be
3802 removed in a future version of CMake.
3803
3804 CMP0030
3805 The use_mangled_mesa() command should not be called.
3806
3807 This command was created in September 2001 to support VTK before modern
3808 CMake language and custom command capabilities. VTK has not used it in
3809 years.
3810
3811 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3812 ior for this policy is to allow the command to be called. The NEW be‐
3813 havior for this policy is to issue a FATAL_ERROR when the command is
3814 called.
3815
3816 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3817 warns when the policy is not set and uses OLD behavior. Use the
3818 cmake_policy() command to set it to OLD or NEW explicitly.
3819
3820 NOTE:
3821 The OLD behavior of a policy is deprecated by definition and may be
3822 removed in a future version of CMake.
3823
3824 CMP0029
3825 The subdir_depends() command should not be called.
3826
3827 The implementation of this command has been empty since December 2001
3828 but was kept in CMake for compatibility for a long time.
3829
3830 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
3831 ior for this policy is to allow the command to be called. The NEW be‐
3832 havior for this policy is to issue a FATAL_ERROR when the command is
3833 called.
3834
3835 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3836 warns when the policy is not set and uses OLD behavior. Use the
3837 cmake_policy() command to set it to OLD or NEW explicitly.
3838
3839 NOTE:
3840 The OLD behavior of a policy is deprecated by definition and may be
3841 removed in a future version of CMake.
3842
3843 CMP0028
3844 Double colon in target name means ALIAS or IMPORTED target.
3845
3846 CMake 2.8.12 and lower allowed the use of targets and files with double
3847 colons in target_link_libraries(), with some buildsystem generators.
3848
3849 The use of double-colons is a common pattern used to namespace IMPORTED
3850 targets and ALIAS targets. When computing the link dependencies of a
3851 target, the name of each dependency could either be a target, or a file
3852 on disk. Previously, if a target was not found with a matching name,
3853 the name was considered to refer to a file on disk. This can lead to
3854 confusing error messages if there is a typo in what should be a target
3855 name.
3856
3857 See also the LINK_LIBRARIES_ONLY_TARGETS target property.
3858
3859 The OLD behavior for this policy is to search for targets, then files
3860 on disk, even if the search term contains double-colons. The NEW be‐
3861 havior for this policy is to issue a FATAL_ERROR if a link dependency
3862 contains double-colons but is not an IMPORTED target or an ALIAS tar‐
3863 get.
3864
3865 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3866 warns when the policy is not set and uses OLD behavior. Use the
3867 cmake_policy() command to set it to OLD or NEW explicitly.
3868
3869 NOTE:
3870 The OLD behavior of a policy is deprecated by definition and may be
3871 removed in a future version of CMake.
3872
3873 CMP0027
3874 Conditionally linked imported targets with missing include directories.
3875
3876 CMake 2.8.11 introduced introduced the concept of
3877 INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the en‐
3878 tries in the INTERFACE_INCLUDE_DIRECTORIES of an IMPORTED target actu‐
3879 ally exist. CMake 2.8.11 also introduced generator expression support
3880 in the target_link_libraries() command. However, if an imported target
3881 is linked as a result of a generator expression evaluation, the entries
3882 in the INTERFACE_INCLUDE_DIRECTORIES of that target were not checked
3883 for existence as they should be.
3884
3885 The OLD behavior of this policy is to report a warning if an entry in
3886 the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression condition‐
3887 ally linked IMPORTED target does not exist.
3888
3889 The NEW behavior of this policy is to report an error if an entry in
3890 the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression condition‐
3891 ally linked IMPORTED target does not exist.
3892
3893 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3894 warns when the policy is not set and uses OLD behavior. Use the
3895 cmake_policy() command to set it to OLD or NEW explicitly.
3896
3897 NOTE:
3898 The OLD behavior of a policy is deprecated by definition and may be
3899 removed in a future version of CMake.
3900
3901 CMP0026
3902 Disallow use of the LOCATION property for build targets.
3903
3904 CMake 2.8.12 and lower allowed reading the LOCATION target property
3905 (and configuration-specific variants) to determine the eventual loca‐
3906 tion of build targets. This relies on the assumption that all neces‐
3907 sary information is available at configure-time to determine the final
3908 location and filename of the target. However, this property is not
3909 fully determined until later at generate-time. At generate time, the
3910 $<TARGET_FILE> generator expression can be used to determine the even‐
3911 tual LOCATION of a target output.
3912
3913 Code which reads the LOCATION target property can be ported to use the
3914 $<TARGET_FILE> generator expression together with the file(GENERATE)
3915 subcommand to generate a file containing the target location.
3916
3917 The OLD behavior for this policy is to allow reading the LOCATION prop‐
3918 erties from build-targets. The NEW behavior for this policy is to not
3919 to allow reading the LOCATION properties from build-targets.
3920
3921 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3922 warns when the policy is not set and uses OLD behavior. Use the
3923 cmake_policy() command to set it to OLD or NEW explicitly.
3924
3925 NOTE:
3926 The OLD behavior of a policy is deprecated by definition and may be
3927 removed in a future version of CMake.
3928
3929 CMP0025
3930 Compiler id for Apple Clang is now AppleClang.
3931
3932 CMake 3.0 and above recognize that Apple Clang is a different compiler
3933 than upstream Clang and that they have different version numbers.
3934 CMake now prefers to present this to projects by setting the
3935 CMAKE_<LANG>_COMPILER_ID variable to AppleClang instead of Clang. How‐
3936 ever, existing projects may assume the compiler id for Apple Clang is
3937 just Clang as it was in CMake versions prior to 3.0. Therefore this
3938 policy determines for Apple Clang which compiler id to report in the
3939 CMAKE_<LANG>_COMPILER_ID variable after language <LANG> is enabled by
3940 the project() or enable_language() command. The policy must be set
3941 prior to the invocation of either command.
3942
3943 The OLD behavior for this policy is to use compiler id Clang. The NEW
3944 behavior for this policy is to use compiler id AppleClang.
3945
3946 This policy was introduced in CMake version 3.0. Use the
3947 cmake_policy() command to set this policy to OLD or NEW explicitly.
3948 Unlike most policies, CMake version 3.25.2 does not warn by default
3949 when this policy is not set and simply uses OLD behavior. See documen‐
3950 tation of the CMAKE_POLICY_WARNING_CMP0025 variable to control the
3951 warning.
3952
3953 NOTE:
3954 The OLD behavior of a policy is deprecated by definition and may be
3955 removed in a future version of CMake.
3956
3957 CMP0024
3958 Disallow include export result.
3959
3960 CMake 2.8.12 and lower allowed use of the include() command with the
3961 result of the export() command. This relies on the assumption that the
3962 export() command has an immediate effect at configure-time during a
3963 cmake run. Certain properties of targets are not fully determined un‐
3964 til later at generate-time, such as the link language and complete list
3965 of link libraries. Future refactoring will change the effect of the
3966 export() command to be executed at generate-time. Use ALIAS targets
3967 instead in cases where the goal is to refer to targets by another name.
3968
3969 The OLD behavior for this policy is to allow including the result of an
3970 export() command. The NEW behavior for this policy is not to allow in‐
3971 cluding the result of an export() command.
3972
3973 This policy was introduced in CMake version 3.0. CMake version 3.25.2
3974 warns when the policy is not set and uses OLD behavior. Use the
3975 cmake_policy() command to set it to OLD or NEW explicitly.
3976
3977 NOTE:
3978 The OLD behavior of a policy is deprecated by definition and may be
3979 removed in a future version of CMake.
3980
3982 CMP0023
3983 Plain and keyword target_link_libraries() signatures cannot be mixed.
3984
3985 CMake 2.8.12 introduced the target_link_libraries() signature using the
3986 PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC
3987 and LINK_PRIVATE keywords introduced in CMake 2.8.7. Use of signatures
3988 with any of these keywords sets the link interface of a target explic‐
3989 itly, even if empty. This produces confusing behavior when used in
3990 combination with the historical behavior of the plain
3991 target_link_libraries() signature. For example, consider the code:
3992
3993 target_link_libraries(mylib A)
3994 target_link_libraries(mylib PRIVATE B)
3995
3996 After the first line the link interface has not been set explicitly so
3997 CMake would use the link implementation, A, as the link interface.
3998 However, the second line sets the link interface to empty. In order to
3999 avoid this subtle behavior CMake now prefers to disallow mixing the
4000 plain and keyword signatures of target_link_libraries() for a single
4001 target.
4002
4003 The OLD behavior for this policy is to allow keyword and plain
4004 target_link_libraries() signatures to be mixed. The NEW behavior for
4005 this policy is to not to allow mixing of the keyword and plain signa‐
4006 tures.
4007
4008 This policy was introduced in CMake version 2.8.12. CMake version
4009 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4010 cmake_policy() command to set it to OLD or NEW explicitly.
4011
4012 NOTE:
4013 The OLD behavior of a policy is deprecated by definition and may be
4014 removed in a future version of CMake.
4015
4016 CMP0022
4017 INTERFACE_LINK_LIBRARIES defines the link interface.
4018
4019 CMake 2.8.11 constructed the 'link interface' of a target from proper‐
4020 ties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?. The
4021 modern way to specify config-sensitive content is to use generator ex‐
4022 pressions and the IMPORTED_ prefix makes uniform processing of the link
4023 interface with generator expressions impossible. The
4024 INTERFACE_LINK_LIBRARIES target property was introduced as a replace‐
4025 ment in CMake 2.8.12. This new property is named consistently with the
4026 INTERFACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES and INTER‐
4027 FACE_COMPILE_OPTIONS properties. For in-build targets, CMake will use
4028 the INTERFACE_LINK_LIBRARIES property as the source of the link inter‐
4029 face only if policy CMP0022 is NEW. When exporting a target which has
4030 this policy set to NEW, only the INTERFACE_LINK_LIBRARIES property will
4031 be processed and generated for the IMPORTED target by default. A new
4032 option to the install(EXPORT) and export commands allows export of the
4033 old-style properties for compatibility with downstream users of CMake
4034 versions older than 2.8.12. The target_link_libraries() command will
4035 no longer populate the properties matching LINK_INTERFACE_LI‐
4036 BRARIES(_<CONFIG>)? if this policy is NEW.
4037
4038 Warning-free future-compatible code which works with CMake 2.8.7 on‐
4039 wards can be written by using the LINK_PRIVATE and LINK_PUBLIC keywords
4040 of target_link_libraries().
4041
4042 The OLD behavior for this policy is to ignore the
4043 INTERFACE_LINK_LIBRARIES property for in-build targets. The NEW behav‐
4044 ior for this policy is to use the INTERFACE_LINK_LIBRARIES property for
4045 in-build targets, and ignore the old properties matching (IM‐
4046 PORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.
4047
4048 This policy was introduced in CMake version 2.8.12. CMake version
4049 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4050 cmake_policy() command to set it to OLD or NEW explicitly.
4051
4052 NOTE:
4053 The OLD behavior of a policy is deprecated by definition and may be
4054 removed in a future version of CMake.
4055
4056 CMP0021
4057 Fatal error on relative paths in INCLUDE_DIRECTORIES target property.
4058
4059 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target prop‐
4060 erty to contain relative paths. The base path for such relative en‐
4061 tries is not well defined. CMake 2.8.12 issues a FATAL_ERROR if the
4062 INCLUDE_DIRECTORIES property contains a relative path.
4063
4064 The OLD behavior for this policy is not to warn about relative paths in
4065 the INCLUDE_DIRECTORIES target property. The NEW behavior for this
4066 policy is to issue a FATAL_ERROR if INCLUDE_DIRECTORIES contains a rel‐
4067 ative path.
4068
4069 This policy was introduced in CMake version 2.8.12. CMake version
4070 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4071 cmake_policy() command to set it to OLD or NEW explicitly.
4072
4073 NOTE:
4074 The OLD behavior of a policy is deprecated by definition and may be
4075 removed in a future version of CMake.
4076
4077 CMP0020
4078 Automatically link Qt executables to qtmain target on Windows.
4079
4080 CMake 2.8.10 and lower required users of Qt to always specify a link
4081 dependency to the qtmain.lib static library manually on Windows. CMake
4082 2.8.11 gained the ability to evaluate generator expressions while de‐
4083 termining the link dependencies from IMPORTED targets. This allows
4084 CMake itself to automatically link executables which link to Qt to the
4085 qtmain.lib library when using IMPORTED Qt targets. For applications
4086 already linking to qtmain.lib, this should have little impact. For ap‐
4087 plications which supply their own alternative WinMain implementation
4088 and for applications which use the QAxServer library, this automatic
4089 linking will need to be disabled as per the documentation.
4090
4091 The OLD behavior for this policy is not to link executables to qt‐
4092 main.lib automatically when they link to the QtCore IMPORTED target.
4093 The NEW behavior for this policy is to link executables to qtmain.lib
4094 automatically when they link to QtCore IMPORTED target.
4095
4096 This policy was introduced in CMake version 2.8.11. CMake version
4097 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4098 cmake_policy() command to set it to OLD or NEW explicitly.
4099
4100 NOTE:
4101 The OLD behavior of a policy is deprecated by definition and may be
4102 removed in a future version of CMake.
4103
4104 CMP0019
4105 Do not re-expand variables in include and link information.
4106
4107 CMake 2.8.10 and lower re-evaluated values given to the include_direc‐
4108 tories, link_directories, and link_libraries commands to expand any
4109 leftover variable references at the end of the configuration step.
4110 This was for strict compatibility with VERY early CMake versions be‐
4111 cause all variable references are now normally evaluated during CMake
4112 language processing. CMake 2.8.11 and higher prefer to skip the extra
4113 evaluation.
4114
4115 The OLD behavior for this policy is to re-evaluate the values for
4116 strict compatibility. The NEW behavior for this policy is to leave the
4117 values untouched.
4118
4119 This policy was introduced in CMake version 2.8.11. CMake version
4120 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4121 cmake_policy() command to set it to OLD or NEW explicitly.
4122
4123 NOTE:
4124 The OLD behavior of a policy is deprecated by definition and may be
4125 removed in a future version of CMake.
4126
4127 CMP0018
4128 Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
4129
4130 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries
4131 using the value of the undocumented CMAKE_SHARED_LIBRARY_<Lang>_FLAGS
4132 platform variable. The variable contained platform-specific flags
4133 needed to compile objects for shared libraries. Typically it included
4134 a flag such as -fPIC for position independent code but also included
4135 other flags needed on certain platforms. CMake 2.8.9 and higher prefer
4136 instead to use the POSITION_INDEPENDENT_CODE target property to deter‐
4137 mine what targets should be position independent, and new undocumented
4138 platform variables to select flags while ignoring CMAKE_SHARED_LI‐
4139 BRARY_<Lang>_FLAGS completely.
4140
4141 The default for either approach produces identical compilation flags,
4142 but if a project modifies CMAKE_SHARED_LIBRARY_<Lang>_FLAGS from its
4143 original value this policy determines which approach to use.
4144
4145 The OLD behavior for this policy is to ignore the
4146 POSITION_INDEPENDENT_CODE property for all targets and use the modified
4147 value of CMAKE_SHARED_LIBRARY_<Lang>_FLAGS for SHARED and MODULE li‐
4148 braries.
4149
4150 The NEW behavior for this policy is to ignore CMAKE_SHARED_LI‐
4151 BRARY_<Lang>_FLAGS whether it is modified or not and honor the
4152 POSITION_INDEPENDENT_CODE target property.
4153
4154 This policy was introduced in CMake version 2.8.9. CMake version
4155 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4156 cmake_policy() command to set it to OLD or NEW explicitly.
4157
4158 NOTE:
4159 The OLD behavior of a policy is deprecated by definition and may be
4160 removed in a future version of CMake.
4161
4162 CMP0017
4163 Prefer files from the CMake module directory when including from there.
4164
4165 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e.
4166 located in the CMake module directory) calls include() or
4167 find_package(), the files located in the CMake module directory are
4168 preferred over the files in CMAKE_MODULE_PATH. This makes sure that
4169 the modules belonging to CMake always get those files included which
4170 they expect, and against which they were developed and tested. In all
4171 other cases, the files found in CMAKE_MODULE_PATH still take precedence
4172 over the ones in the CMake module directory. The OLD behavior is to
4173 always prefer files from CMAKE_MODULE_PATH over files from the CMake
4174 modules directory.
4175
4176 This policy was introduced in CMake version 2.8.4. CMake version
4177 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4178 cmake_policy() command to set it to OLD or NEW explicitly.
4179
4180 NOTE:
4181 The OLD behavior of a policy is deprecated by definition and may be
4182 removed in a future version of CMake.
4183
4184 CMP0016
4185 target_link_libraries() reports error if its only argument is not a
4186 target.
4187
4188 In CMake 2.8.2 and lower the target_link_libraries() command silently
4189 ignored if it was called with only one argument, and this argument
4190 wasn't a valid target. In CMake 2.8.3 and above it reports an error in
4191 this case.
4192
4193 This policy was introduced in CMake version 2.8.3. CMake version
4194 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4195 cmake_policy() command to set it to OLD or NEW explicitly.
4196
4197 NOTE:
4198 The OLD behavior of a policy is deprecated by definition and may be
4199 removed in a future version of CMake.
4200
4201 CMP0015
4202 link_directories() treats paths relative to the source dir.
4203
4204 In CMake 2.8.0 and lower the link_directories() command passed relative
4205 paths unchanged to the linker. In CMake 2.8.1 and above the
4206 link_directories() command prefers to interpret relative paths with re‐
4207 spect to CMAKE_CURRENT_SOURCE_DIR, which is consistent with
4208 include_directories() and other commands. The OLD behavior for this
4209 policy is to use relative paths verbatim in the linker command. The
4210 NEW behavior for this policy is to convert relative paths to absolute
4211 paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR.
4212
4213 This policy was introduced in CMake version 2.8.1. CMake version
4214 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4215 cmake_policy() command to set it to OLD or NEW explicitly.
4216
4217 NOTE:
4218 The OLD behavior of a policy is deprecated by definition and may be
4219 removed in a future version of CMake.
4220
4221 CMP0014
4222 Input directories must have CMakeLists.txt.
4223
4224 CMake versions before 2.8 silently ignored missing CMakeLists.txt files
4225 in directories referenced by add_subdirectory() or subdirs(), treating
4226 them as if present but empty. In CMake 2.8.0 and above this
4227 cmake_policy() determines whether or not the case is an error. The OLD
4228 behavior for this policy is to silently ignore the problem. The NEW
4229 behavior for this policy is to report an error.
4230
4231 This policy was introduced in CMake version 2.8.0. CMake version
4232 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4233 cmake_policy() command to set it to OLD or NEW explicitly.
4234
4235 NOTE:
4236 The OLD behavior of a policy is deprecated by definition and may be
4237 removed in a future version of CMake.
4238
4239 CMP0013
4240 Duplicate binary directories are not allowed.
4241
4242 CMake 2.6.3 and below silently permitted add_subdirectory() calls to
4243 create the same binary directory multiple times. During build system
4244 generation files would be written and then overwritten in the build
4245 tree and could lead to strange behavior. CMake 2.6.4 and above explic‐
4246 itly detect duplicate binary directories. CMake 2.6.4 always considers
4247 this case an error. In CMake 2.8.0 and above this policy determines
4248 whether or not the case is an error. The OLD behavior for this policy
4249 is to allow duplicate binary directories. The NEW behavior for this
4250 policy is to disallow duplicate binary directories with an error.
4251
4252 This policy was introduced in CMake version 2.8.0. CMake version
4253 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4254 cmake_policy() command to set it to OLD or NEW explicitly.
4255
4256 NOTE:
4257 The OLD behavior of a policy is deprecated by definition and may be
4258 removed in a future version of CMake.
4259
4260 CMP0012
4261 if() recognizes numbers and boolean constants.
4262
4263 In CMake versions 2.6.4 and lower the if() command implicitly derefer‐
4264 enced arguments corresponding to variables, even those named like num‐
4265 bers or boolean constants, except for 0 and 1. Numbers and boolean
4266 constants such as true, false, yes, no, on, off, y, n, notfound, ignore
4267 (all case insensitive) were recognized in some cases but not all. For
4268 example, the code if(TRUE) might have evaluated as false. Numbers such
4269 as 2 were recognized only in boolean expressions like if(NOT 2) (lead‐
4270 ing to false) but not as a single-argument like if(2) (also leading to
4271 false). Later versions of CMake prefer to treat numbers and boolean
4272 constants literally, so they should not be used as variable names.
4273
4274 The OLD behavior for this policy is to implicitly dereference variables
4275 named like numbers and boolean constants. The NEW behavior for this
4276 policy is to recognize numbers and boolean constants without derefer‐
4277 encing variables with such names.
4278
4279 This policy was introduced in CMake version 2.8.0. CMake version
4280 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4281 cmake_policy() command to set it to OLD or NEW explicitly.
4282
4283 NOTE:
4284 The OLD behavior of a policy is deprecated by definition and may be
4285 removed in a future version of CMake.
4286
4288 CMP0011
4289 Included scripts do automatic cmake_policy() PUSH and POP.
4290
4291 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by
4292 the include() and find_package() commands would affect the includer.
4293 Explicit invocations of cmake_policy(PUSH) and cmake_policy(POP) were
4294 required to isolate policy changes and protect the includer. While
4295 some scripts intend to affect the policies of their includer, most do
4296 not. In CMake 2.6.3 and above, include() and find_package() by default
4297 PUSH and POP an entry on the policy stack around an included script,
4298 but provide a NO_POLICY_SCOPE option to disable it. This policy deter‐
4299 mines whether or not to imply NO_POLICY_SCOPE for compatibility. The
4300 OLD behavior for this policy is to imply NO_POLICY_SCOPE for include()
4301 and find_package() commands. The NEW behavior for this policy is to
4302 allow the commands to do their default cmake_policy PUSH and POP.
4303
4304 This policy was introduced in CMake version 2.6.3. CMake version
4305 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4306 cmake_policy() command to set it to OLD or NEW explicitly.
4307
4308 NOTE:
4309 The OLD behavior of a policy is deprecated by definition and may be
4310 removed in a future version of CMake.
4311
4312 CMP0010
4313 Bad variable reference syntax is an error.
4314
4315 In CMake 2.6.2 and below, incorrect variable reference syntax such as a
4316 missing close-brace (${FOO) was reported but did not stop processing of
4317 CMake code. This policy determines whether a bad variable reference is
4318 an error. The OLD behavior for this policy is to warn about the error,
4319 leave the string untouched, and continue. The NEW behavior for this
4320 policy is to report an error.
4321
4322 If CMP0053 is set to NEW, this policy has no effect and is treated as
4323 always being NEW.
4324
4325 This policy was introduced in CMake version 2.6.3. CMake version
4326 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4327 cmake_policy() command to set it to OLD or NEW explicitly.
4328
4329 NOTE:
4330 The OLD behavior of a policy is deprecated by definition and may be
4331 removed in a future version of CMake.
4332
4333 CMP0009
4334 FILE GLOB_RECURSE calls should not follow symlinks by default.
4335
4336 In CMake 2.6.1 and below, file(GLOB_RECURSE) calls would follow through
4337 symlinks, sometimes coming up with unexpectedly large result sets be‐
4338 cause of symlinks to top level directories that contain hundreds of
4339 thousands of files.
4340
4341 This policy determines whether or not to follow symlinks encountered
4342 during a file(GLOB_RECURSE) call. The OLD behavior for this policy is
4343 to follow the symlinks. The NEW behavior for this policy is not to
4344 follow the symlinks by default, but only if FOLLOW_SYMLINKS is given as
4345 an additional argument to the FILE command.
4346
4347 This policy was introduced in CMake version 2.6.2. CMake version
4348 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4349 cmake_policy() command to set it to OLD or NEW explicitly.
4350
4351 NOTE:
4352 The OLD behavior of a policy is deprecated by definition and may be
4353 removed in a future version of CMake.
4354
4355 CMP0008
4356 Libraries linked by full-path must have a valid library file name.
4357
4358 In CMake 2.4 and below it is possible to write code like
4359
4360 target_link_libraries(myexe /full/path/to/somelib)
4361
4362 where somelib is supposed to be a valid library file name such as lib‐
4363 somelib.a or somelib.lib. For Makefile generators this produces an er‐
4364 ror at build time because the dependency on the full path cannot be
4365 found. For Visual Studio Generators IDE and Xcode generators this used
4366 to work by accident because CMake would always split off the library
4367 directory and ask the linker to search for the library by name
4368 (-lsomelib or somelib.lib). Despite the failure with Makefiles, some
4369 projects have code like this and build only with Visual Studio and/or
4370 Xcode. This version of CMake prefers to pass the full path directly to
4371 the native build tool, which will fail in this case because it does not
4372 name a valid library file.
4373
4374 This policy determines what to do with full paths that do not appear to
4375 name a valid library file. The OLD behavior for this policy is to
4376 split the library name from the path and ask the linker to search for
4377 it. The NEW behavior for this policy is to trust the given path and
4378 pass it directly to the native build tool unchanged.
4379
4380 This policy was introduced in CMake version 2.6.1. CMake version
4381 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4382 cmake_policy() command to set it to OLD or NEW explicitly.
4383
4384 NOTE:
4385 The OLD behavior of a policy is deprecated by definition and may be
4386 removed in a future version of CMake.
4387
4388 CMP0007
4389 list command no longer ignores empty elements.
4390
4391 This policy determines whether the list command will ignore empty ele‐
4392 ments in the list. CMake 2.4 and below list commands ignored all empty
4393 elements in the list. For example, a;b;;c would have length 3 and not
4394 4. The OLD behavior for this policy is to ignore empty list elements.
4395 The NEW behavior for this policy is to correctly count empty elements
4396 in a list.
4397
4398 This policy was introduced in CMake version 2.6.0. CMake version
4399 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4400 cmake_policy() command to set it to OLD or NEW explicitly.
4401
4402 NOTE:
4403 The OLD behavior of a policy is deprecated by definition and may be
4404 removed in a future version of CMake.
4405
4406 CMP0006
4407 Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
4408
4409 This policy determines whether the install(TARGETS) command must be
4410 given a BUNDLE DESTINATION when asked to install a target with the
4411 MACOSX_BUNDLE property set. CMake 2.4 and below did not distinguish
4412 application bundles from normal executables when installing targets.
4413 CMake 2.6 provides a BUNDLE option to the install(TARGETS) command that
4414 specifies rules specific to application bundles on the Mac. Projects
4415 should use this option when installing a target with the MACOSX_BUNDLE
4416 property set.
4417
4418 The OLD behavior for this policy is to fall back to the RUNTIME DESTI‐
4419 NATION if a BUNDLE DESTINATION is not given. The NEW behavior for this
4420 policy is to produce an error if a bundle target is installed without a
4421 BUNDLE DESTINATION.
4422
4423 This policy was introduced in CMake version 2.6.0. CMake version
4424 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4425 cmake_policy() command to set it to OLD or NEW explicitly.
4426
4427 NOTE:
4428 The OLD behavior of a policy is deprecated by definition and may be
4429 removed in a future version of CMake.
4430
4431 CMP0005
4432 Preprocessor definition values are now escaped automatically.
4433
4434 This policy determines whether or not CMake should generate escaped
4435 preprocessor definition values added via add_definitions. CMake ver‐
4436 sions 2.4 and below assumed that only trivial values would be given for
4437 macros in add_definitions calls. It did not attempt to escape
4438 non-trivial values such as string literals in generated build rules.
4439 CMake versions 2.6 and above support escaping of most values, but can‐
4440 not assume the user has not added escapes already in an attempt to work
4441 around limitations in earlier versions.
4442
4443 The OLD behavior for this policy is to place definition values given to
4444 add_definitions directly in the generated build rules without attempt‐
4445 ing to escape anything. The NEW behavior for this policy is to gener‐
4446 ate correct escapes for all native build tools automatically. See doc‐
4447 umentation of the COMPILE_DEFINITIONS target property for limitations
4448 of the escaping implementation.
4449
4450 This policy was introduced in CMake version 2.6.0. CMake version
4451 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4452 cmake_policy() command to set it to OLD or NEW explicitly.
4453
4454 NOTE:
4455 The OLD behavior of a policy is deprecated by definition and may be
4456 removed in a future version of CMake.
4457
4458 CMP0004
4459 Libraries linked may not have leading or trailing whitespace.
4460
4461 CMake versions 2.4 and below silently removed leading and trailing
4462 whitespace from libraries linked with code like
4463
4464 target_link_libraries(myexe " A ")
4465
4466 This could lead to subtle errors in user projects.
4467
4468 The OLD behavior for this policy is to silently remove leading and
4469 trailing whitespace. The NEW behavior for this policy is to diagnose
4470 the existence of such whitespace as an error. The setting for this
4471 policy used when checking the library names is that in effect when the
4472 target is created by an add_executable() or add_library() command.
4473
4474 This policy was introduced in CMake version 2.6.0. CMake version
4475 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4476 cmake_policy() command to set it to OLD or NEW explicitly.
4477
4478 NOTE:
4479 The OLD behavior of a policy is deprecated by definition and may be
4480 removed in a future version of CMake.
4481
4482 CMP0003
4483 Libraries linked via full path no longer produce linker search paths.
4484
4485 This policy affects how libraries whose full paths are NOT known are
4486 found at link time, but was created due to a change in how CMake deals
4487 with libraries whose full paths are known. Consider the code
4488
4489 target_link_libraries(myexe /path/to/libA.so)
4490
4491 CMake 2.4 and below implemented linking to libraries whose full paths
4492 are known by splitting them on the link line into separate components
4493 consisting of the linker search path and the library name. The example
4494 code might have produced something like
4495
4496 ... -L/path/to -lA ...
4497
4498 in order to link to library A. An analysis was performed to order mul‐
4499 tiple link directories such that the linker would find library A in the
4500 desired location, but there are cases in which this does not work.
4501 CMake versions 2.6 and above use the more reliable approach of passing
4502 the full path to libraries directly to the linker in most cases. The
4503 example code now produces something like
4504
4505 ... /path/to/libA.so ....
4506
4507 Unfortunately this change can break code like
4508
4509 target_link_libraries(myexe /path/to/libA.so B)
4510
4511 where B is meant to find /path/to/libB.so. This code is wrong because
4512 the user is asking the linker to find library B but has not provided a
4513 linker search path (which may be added with the link_directories com‐
4514 mand). However, with the old linking implementation the code would
4515 work accidentally because the linker search path added for library A
4516 allowed library B to be found.
4517
4518 In order to support projects depending on linker search paths added by
4519 linking to libraries with known full paths, the OLD behavior for this
4520 policy will add the linker search paths even though they are not needed
4521 for their own libraries. When this policy is set to OLD, CMake will
4522 produce a link line such as
4523
4524 ... -L/path/to /path/to/libA.so -lB ...
4525
4526 which will allow library B to be found as it was previously. When this
4527 policy is set to NEW, CMake will produce a link line such as
4528
4529 ... /path/to/libA.so -lB ...
4530
4531 which more accurately matches what the project specified.
4532
4533 The setting for this policy used when generating the link line is that
4534 in effect when the target is created by an add_executable or add_li‐
4535 brary command. For the example described above, the code
4536
4537 cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4)
4538 add_executable(myexe myexe.c)
4539 target_link_libraries(myexe /path/to/libA.so B)
4540
4541 will work and suppress the warning for this policy. It may also be up‐
4542 dated to work with the corrected linking approach:
4543
4544 cmake_policy(SET CMP0003 NEW) # or cmake_policy(VERSION 2.6)
4545 link_directories(/path/to) # needed to find library B
4546 add_executable(myexe myexe.c)
4547 target_link_libraries(myexe /path/to/libA.so B)
4548
4549 Even better, library B may be specified with a full path:
4550
4551 add_executable(myexe myexe.c)
4552 target_link_libraries(myexe /path/to/libA.so /path/to/libB.so)
4553
4554 When all items on the link line have known paths CMake does not check
4555 this policy so it has no effect.
4556
4557 Note that the warning for this policy will be issued for at most one
4558 target. This avoids flooding users with messages for every target when
4559 setting the policy once will probably fix all targets.
4560
4561 This policy was introduced in CMake version 2.6.0. CMake version
4562 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4563 cmake_policy() command to set it to OLD or NEW explicitly.
4564
4565 NOTE:
4566 The OLD behavior of a policy is deprecated by definition and may be
4567 removed in a future version of CMake.
4568
4569 CMP0002
4570 Logical target names must be globally unique.
4571
4572 Targets names created with add_executable(), add_library(), or
4573 add_custom_target() are logical build target names. Logical target
4574 names must be globally unique because:
4575
4576 - Unique names may be referenced unambiguously both in CMake
4577 code and on make tool command lines.
4578 - Logical names are used by Xcode and VS IDE generators
4579 to produce meaningful project names for the targets.
4580
4581 The logical name of executable and library targets does not have to
4582 correspond to the physical file names built. Consider using the
4583 OUTPUT_NAME target property to create two targets with the same physi‐
4584 cal name while keeping logical names distinct. Custom targets must
4585 simply have globally unique names (unless one uses the global property
4586 ALLOW_DUPLICATE_CUSTOM_TARGETS with a Makefiles generator).
4587
4588 This policy was introduced in CMake version 2.6.0. CMake version
4589 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4590 cmake_policy() command to set it to OLD or NEW explicitly.
4591
4592 NOTE:
4593 The OLD behavior of a policy is deprecated by definition and may be
4594 removed in a future version of CMake.
4595
4596 CMP0001
4597 CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
4598
4599 The behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present it
4600 to the user. The NEW behavior is to ignore CMAKE_BACKWARDS_COMPATIBIL‐
4601 ITY completely.
4602
4603 In CMake 2.4 and below the variable CMAKE_BACKWARDS_COMPATIBILITY was
4604 used to request compatibility with earlier versions of CMake. In CMake
4605 2.6 and above all compatibility issues are handled by policies and the
4606 cmake_policy() command. However, CMake must still check CMAKE_BACK‐
4607 WARDS_COMPATIBILITY for projects written for CMake 2.4 and below.
4608
4609 This policy was introduced in CMake version 2.6.0. CMake version
4610 3.25.2 warns when the policy is not set and uses OLD behavior. Use the
4611 cmake_policy() command to set it to OLD or NEW explicitly.
4612
4613 NOTE:
4614 The OLD behavior of a policy is deprecated by definition and may be
4615 removed in a future version of CMake.
4616
4617 CMP0000
4618 A minimum required CMake version must be specified.
4619
4620 CMake requires that projects specify the version of CMake to which they
4621 have been written. This policy has been put in place so users trying
4622 to build the project may be told when they need to update their CMake.
4623 Specifying a version also helps the project build with CMake versions
4624 newer than that specified. Use the cmake_minimum_required() command at
4625 the top of your main CMakeLists.txt file:
4626
4627 cmake_minimum_required(VERSION <major>.<minor>)
4628
4629 where <major>.<minor> is the version of CMake you want to support (such
4630 as 3.14). The command will ensure that at least the given version of
4631 CMake is running and help newer versions be compatible with the
4632 project. See documentation of cmake_minimum_required() for details.
4633
4634 Note that the command invocation must appear in the CMakeLists.txt file
4635 itself; a call in an included file is not sufficient. However, the
4636 cmake_policy() command may be called to set policy CMP0000 to OLD or
4637 NEW behavior explicitly. The OLD behavior is to silently ignore the
4638 missing invocation. The NEW behavior is to issue an error instead of a
4639 warning. An included file may set CMP0000 explicitly to affect how
4640 this policy is enforced for the main CMakeLists.txt file.
4641
4642 This policy was introduced in CMake version 2.6.0.
4643
4644 NOTE:
4645 The OLD behavior of a policy is deprecated by definition and may be
4646 removed in a future version of CMake.
4647
4649 2000-2023 Kitware, Inc. and Contributors
4650
4651
4652
4653
46543.25.2 Jan 19, 2023 CMAKE-POLICIES(7)