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