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
16 either 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 CMP0072
51 FindOpenGL prefers GLVND by default when available.
52
53 The FindOpenGL module provides an OpenGL::GL target and an
54 OPENGL_LIBRARIES variable for projects to use for legacy GL interfaces.
55 When both a legacy GL library (e.g. libGL.so) and GLVND libraries for
56 OpenGL and GLX (e.g. libOpenGL.so and libGLX.so) are available, the
57 module must choose between them. It documents an OpenGL_GL_PREFERENCE
58 variable that can be used to specify an explicit preference. When no
59 such preference is set, the module must choose a default preference.
60
61 CMake 3.11 and above prefer to choose GLVND libraries. This policy
62 provides compatibility with projects that expect the legacy GL library
63 to be used.
64
65 The OLD behavior for this policy is to set OpenGL_GL_PREFERENCE to
66 LEGACY. The NEW behavior for this policy is to set OpenGL_GL_PREFER‐
67 ENCE to GLVND.
68
69 This policy was introduced in CMake version 3.11. CMake version 3.11.4
70 warns when the policy is not set and uses OLD behavior. Use the
71 cmake_policy() command to set it to OLD or NEW explicitly.
72
73 NOTE:
74 The OLD behavior of a policy is deprecated by definition and may be
75 removed in a future version of CMake.
76
78 CMP0071
79 Let AUTOMOC and AUTOUIC process GENERATED files.
80
81 Since version 3.10, CMake processes regular and GENERATED source files
82 in AUTOMOC and AUTOUIC. In earlier CMake versions, only regular source
83 files were processed. GENERATED source files were ignored silently.
84
85 This policy affects how source files that are GENERATED get treated in
86 AUTOMOC and AUTOUIC.
87
88 The OLD behavior for this policy is to ignore GENERATED source files in
89 AUTOMOC and AUTOUIC.
90
91 The NEW behavior for this policy is to process GENERATED source files
92 in AUTOMOC and AUTOUIC just like regular source files.
93
94 NOTE:
95 To silence the CMP0071 warning source files can be excluded from
96 AUTOMOC and AUTOUIC processing by setting the source file properties
97 SKIP_AUTOMOC, SKIP_AUTOUIC or SKIP_AUTOGEN.
98
99 Source skip example:
100
101 # ...
102 set_property(SOURCE /path/to/file1.h PROPERTY SKIP_AUTOMOC ON)
103 set_property(SOURCE /path/to/file2.h PROPERTY SKIP_AUTOUIC ON)
104 set_property(SOURCE /path/to/file3.h PROPERTY SKIP_AUTOGEN ON)
105 # ...
106
107 This policy was introduced in CMake version 3.10. CMake version 3.11.4
108 warns when the policy is not set and uses OLD behavior. Use the
109 cmake_policy() command to set it to OLD or NEW explicitly.
110
111 NOTE:
112 The OLD behavior of a policy is deprecated by definition and may be
113 removed in a future version of CMake.
114
115 CMP0070
116 Define file(GENERATE) behavior for relative paths.
117
118 CMake 3.10 and newer define that relative paths given to INPUT and OUT‐
119 PUT arguments of file(GENERATE) are interpreted relative to the current
120 source and binary directories, respectively. CMake 3.9 and lower did
121 not define any behavior for relative paths but did not diagnose them
122 either and accidentally treated them relative to the process working
123 directory. Policy CMP0070 provides compatibility with projects that
124 used the old undefined behavior.
125
126 This policy affects behavior of relative paths given to file(GENERATE).
127 The OLD behavior for this policy is to treat the paths relative to the
128 working directory of CMake. The NEW behavior for this policy is to
129 interpret relative paths with respect to the current source or binary
130 directory of the caller.
131
132 This policy was introduced in CMake version 3.10. CMake version 3.11.4
133 warns when the policy is not set and uses OLD behavior. Use the
134 cmake_policy() command to set it to OLD or NEW explicitly.
135
136 NOTE:
137 The OLD behavior of a policy is deprecated by definition and may be
138 removed in a future version of CMake.
139
141 CMP0069
142 INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
143
144 CMake 3.9 and newer prefer to add IPO flags whenever the INTERPROCEDU‐
145 RAL_OPTIMIZATION target property is enabled and produce an error if
146 flags are not known to CMake for the current compiler. Since a given
147 compiler may not support IPO flags in all environments in which it is
148 used, it is now the project’s responsibility to use the CheckIPOSup‐
149 ported module to check for support before enabling the INTERPROCEDU‐
150 RAL_OPTIMIZATION target property. This approach allows a project to
151 conditionally activate IPO when supported. It also allows an end user
152 to set the CMAKE_INTERPROCEDURAL_OPTIMIZATION variable in an environ‐
153 ment known to support IPO even if the project does not enable the prop‐
154 erty.
155
156 Since CMake 3.8 and lower only honored INTERPROCEDURAL_OPTIMIZATION for
157 the Intel compiler on Linux, some projects may unconditionally enable
158 the target property. Policy CMP0069 provides compatibility with such
159 projects.
160
161 This policy takes effect whenever the IPO property is enabled. The OLD
162 behavior for this policy is to add IPO flags only for Intel compiler on
163 Linux. The NEW behavior for this policy is to add IPO flags for the
164 current compiler or produce an error if CMake does not know the flags.
165
166 This policy was introduced in CMake version 3.9. CMake version 3.11.4
167 warns when the policy is not set and uses OLD behavior. Use the
168 cmake_policy() command to set it to OLD or NEW explicitly.
169
170 NOTE:
171 The OLD behavior of a policy is deprecated by definition and may be
172 removed in a future version of CMake.
173
174 Examples
175 Behave like CMake 3.8 and do not apply any IPO flags except for Intel
176 compiler on Linux:
177
178 cmake_minimum_required(VERSION 3.8)
179 project(foo)
180
181 # ...
182
183 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
184
185 Use the CheckIPOSupported module to detect whether IPO is supported by
186 the current compiler, environment, and CMake version. Produce a fatal
187 error if support is not available:
188
189 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
190 project(foo)
191
192 include(CheckIPOSupported)
193 check_ipo_supported()
194
195 # ...
196
197 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
198
199 Apply IPO flags only if compiler supports it:
200
201 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
202 project(foo)
203
204 include(CheckIPOSupported)
205
206 # ...
207
208 check_ipo_supported(RESULT result)
209 if(result)
210 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
211 endif()
212
213 Apply IPO flags without any checks. This may lead to build errors if
214 IPO is not supported by the compiler in the current environment. Pro‐
215 duce an error if CMake does not know IPO flags for the current com‐
216 piler:
217
218 cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
219 project(foo)
220
221 # ...
222
223 set_property(TARGET ... PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
224
225 CMP0068
226 RPATH settings on macOS do not affect install_name.
227
228 CMake 3.9 and newer remove any effect the following settings may have
229 on the install_name of a target on macOS:
230
231 · BUILD_WITH_INSTALL_RPATH target property
232
233 · SKIP_BUILD_RPATH target property
234
235 · CMAKE_SKIP_RPATH variable
236
237 · CMAKE_SKIP_INSTALL_RPATH variable
238
239 Previously, setting BUILD_WITH_INSTALL_RPATH had the effect of setting
240 both the install_name of a target to INSTALL_NAME_DIR and the RPATH to
241 INSTALL_RPATH. In CMake 3.9, it only affects setting of RPATH. How‐
242 ever, if one wants INSTALL_NAME_DIR to apply to the target in the build
243 tree, one may set BUILD_WITH_INSTALL_NAME_DIR.
244
245 If SKIP_BUILD_RPATH, CMAKE_SKIP_RPATH or CMAKE_SKIP_INSTALL_RPATH were
246 used to strip the directory portion of the install_name of a target,
247 one may set INSTALL_NAME_DIR="" instead.
248
249 The OLD behavior of this policy is to use the RPATH settings for
250 install_name on macOS. The NEW behavior of this policy is to ignore
251 the RPATH settings for install_name on macOS.
252
253 This policy was introduced in CMake version 3.9. CMake version 3.11.4
254 warns when the policy is not set and uses OLD behavior. Use the
255 cmake_policy() command to set it to OLD or NEW explicitly.
256
257 NOTE:
258 The OLD behavior of a policy is deprecated by definition and may be
259 removed in a future version of CMake.
260
262 CMP0067
263 Honor language standard in try_compile() source-file signature.
264
265 The try_compile() source file signature is intended to allow callers to
266 check whether they will be able to compile a given source file with the
267 current toolchain. In order to match compiler behavior, any language
268 standard mode should match. However, CMake 3.7 and below did not do
269 this. CMake 3.8 and above prefer to honor the language standard set‐
270 tings for C, CXX (C++), and CUDA using the values of the variables:
271
272 · CMAKE_C_STANDARD
273
274 · CMAKE_C_STANDARD_REQUIRED
275
276 · CMAKE_C_EXTENSIONS
277
278 · CMAKE_CXX_STANDARD
279
280 · CMAKE_CXX_STANDARD_REQUIRED
281
282 · CMAKE_CXX_EXTENSIONS
283
284 · CMAKE_CUDA_STANDARD
285
286 · CMAKE_CUDA_STANDARD_REQUIRED
287
288 · CMAKE_CUDA_EXTENSIONS
289
290 This policy provides compatibility for projects that do not expect the
291 language standard settings to be used automatically.
292
293 The OLD behavior of this policy is to ignore language standard setting
294 variables when generating the try_compile test project. The NEW behav‐
295 ior of this policy is to honor language standard setting variables.
296
297 This policy was introduced in CMake version 3.8. Unlike most policies,
298 CMake version 3.11.4 does not warn by default when this policy is not
299 set and simply uses OLD behavior. See documentation of the CMAKE_POL‐
300 ICY_WARNING_CMP0067 variable to control the warning.
301
302 NOTE:
303 The OLD behavior of a policy is deprecated by definition and may be
304 removed in a future version of CMake.
305
307 CMP0066
308 Honor per-config flags in try_compile() source-file signature.
309
310 The source file signature of the try_compile() command uses the value
311 of the CMAKE_<LANG>_FLAGS variable in the test project so that the test
312 compilation works as it would in the main project. However, CMake 3.6
313 and below do not also honor config-specific compiler flags such as
314 those in the CMAKE_<LANG>_FLAGS_DEBUG variable. CMake 3.7 and above
315 prefer to honor config-specific compiler flags too. This policy pro‐
316 vides compatibility for projects that do not expect config-specific
317 compiler flags to be used.
318
319 The OLD behavior of this policy is to ignore config-specific flag vari‐
320 ables like CMAKE_<LANG>_FLAGS_DEBUG and only use CMake’s built-in
321 defaults for the current compiler and platform.
322
323 The NEW behavior of this policy is to honor config-specific flag vari‐
324 abldes like CMAKE_<LANG>_FLAGS_DEBUG.
325
326 This policy was introduced in CMake version 3.7. Unlike most policies,
327 CMake version 3.11.4 does not warn by default when this policy is not
328 set and simply uses OLD behavior. See documentation of the CMAKE_POL‐
329 ICY_WARNING_CMP0066 variable to control the warning.
330
331 NOTE:
332 The OLD behavior of a policy is deprecated by definition and may be
333 removed in a future version of CMake.
334
336 CMP0065
337 Do not add flags to export symbols from executables without the
338 ENABLE_EXPORTS target property.
339
340 CMake 3.3 and below, for historical reasons, always linked executables
341 on some platforms with flags like -rdynamic to export symbols from the
342 executables for use by any plugins they may load via dlopen. CMake 3.4
343 and above prefer to do this only for executables that are explicitly
344 marked with the ENABLE_EXPORTS target property.
345
346 The OLD behavior of this policy is to always use the additional link
347 flags when linking executables regardless of the value of the
348 ENABLE_EXPORTS target property.
349
350 The NEW behavior of this policy is to only use the additional link
351 flags when linking executables if the ENABLE_EXPORTS target property is
352 set to True.
353
354 This policy was introduced in CMake version 3.4. Unlike most policies,
355 CMake version 3.11.4 does not warn by default when this policy is not
356 set and simply uses OLD behavior. See documentation of the CMAKE_POL‐
357 ICY_WARNING_CMP0065 variable to control the warning.
358
359 NOTE:
360 The OLD behavior of a policy is deprecated by definition and may be
361 removed in a future version of CMake.
362
363 CMP0064
364 Recognize TEST as a operator for the if() command.
365
366 The TEST operator was added to the if() command to determine if a given
367 test name was created by the add_test() command.
368
369 The OLD behavior for this policy is to ignore the TEST operator. The
370 NEW behavior is to interpret the TEST operator.
371
372 This policy was introduced in CMake version 3.4. CMake version 3.11.4
373 warns when the policy is not set and uses OLD behavior. Use the
374 cmake_policy() command to set it to OLD or NEW explicitly.
375
376 NOTE:
377 The OLD behavior of a policy is deprecated by definition and may be
378 removed in a future version of CMake.
379
381 CMP0063
382 Honor visibility properties for all target types.
383
384 The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target prop‐
385 erties affect visibility of symbols during dynamic linking. When first
386 introduced these properties affected compilation of sources only in
387 shared libraries, module libraries, and executables with the
388 ENABLE_EXPORTS property set. This was sufficient for the basic use
389 cases of shared libraries and executables with plugins. However, some
390 sources may be compiled as part of static libraries or object libraries
391 and then linked into a shared library later. CMake 3.3 and above pre‐
392 fer to honor these properties for sources compiled in all target types.
393 This policy preserves compatibility for projects expecting the proper‐
394 ties to work only for some target types.
395
396 The OLD behavior for this policy is to ignore the visibility properties
397 for static libraries, object libraries, and executables without
398 exports. The NEW behavior for this policy is to honor the visibility
399 properties for all target types.
400
401 This policy was introduced in CMake version 3.3. CMake version 3.11.4
402 warns when the policy is not set and uses OLD behavior. Use the
403 cmake_policy() command to set it to OLD or NEW explicitly.
404
405 NOTE:
406 The OLD behavior of a policy is deprecated by definition and may be
407 removed in a future version of CMake.
408
409 CMP0062
410 Disallow install() of export() result.
411
412 The export() command generates a file containing Imported Targets,
413 which is suitable for use from the build directory. It is not suitable
414 for installation because it contains absolute paths to buildsystem
415 locations, and is particular to a single build configuration.
416
417 The install(EXPORT) generates and installs files which contain Imported
418 Targets. These files are generated with relative paths (unless the
419 user specifies absolute paths), and are designed for multi-configura‐
420 tion use. See Creating Packages for more.
421
422 CMake 3.3 no longer allows the use of the install(FILES) command with
423 the result of the export() command.
424
425 The OLD behavior for this policy is to allow installing the result of
426 an export() command. The NEW behavior for this policy is not to allow
427 installing the result of an export() command.
428
429 This policy was introduced in CMake version 3.3. CMake version 3.11.4
430 warns when the policy is not set and uses OLD behavior. Use the
431 cmake_policy() command to set it to OLD or NEW explicitly.
432
433 NOTE:
434 The OLD behavior of a policy is deprecated by definition and may be
435 removed in a future version of CMake.
436
437 CMP0061
438 CTest does not by default tell make to ignore errors (-i).
439
440 The ctest_build() and build_command() commands no longer generate build
441 commands for Makefile Generators with the -i option. Previously this
442 was done to help build as much of tested projects as possible. How‐
443 ever, this behavior is not consistent with other generators and also
444 causes the return code of the make tool to be meaningless.
445
446 Of course users may still add this option manually by setting
447 CTEST_BUILD_COMMAND or the MAKECOMMAND cache entry. See the CTest
448 Build Step MakeCommand setting documentation for their effects.
449
450 The OLD behavior for this policy is to add -i to make calls in CTest.
451 The NEW behavior for this policy is to not add -i.
452
453 This policy was introduced in CMake version 3.3. Unlike most policies,
454 CMake version 3.11.4 does not warn when this policy is not set and sim‐
455 ply uses OLD behavior.
456
457 NOTE:
458 The OLD behavior of a policy is deprecated by definition and may be
459 removed in a future version of CMake.
460
461 CMP0060
462 Link libraries by full path even in implicit directories.
463
464 Policy CMP0003 was introduced with the intention of always linking
465 library files by full path when a full path is given to the tar‐
466 get_link_libraries() command. However, on some platforms (e.g. HP-UX)
467 the compiler front-end adds alternative library search paths for the
468 current architecture (e.g. /usr/lib/<arch> has alternatives to
469 libraries in /usr/lib for the current architecture). On such platforms
470 the find_library() may find a library such as /usr/lib/libfoo.so that
471 does not belong to the current architecture.
472
473 Prior to policy CMP0003 projects would still build in such cases
474 because the incorrect library path would be converted to -lfoo on the
475 link line and the linker would find the proper library in the arch-spe‐
476 cific search path provided by the compiler front-end implicitly. At
477 the time we chose to remain compatible with such projects by always
478 converting library files found in implicit link directories to -lfoo
479 flags to ask the linker to search for them. This approach allowed
480 existing projects to continue to build while still linking to libraries
481 outside implicit link directories via full path (such as those in the
482 build tree).
483
484 CMake does allow projects to override this behavior by using an
485 IMPORTED library target with its IMPORTED_LOCATION property set to the
486 desired full path to a library file. In fact, many Find Modules are
487 learning to provide Imported Targets instead of just the traditional
488 Foo_LIBRARIES variable listing library files. However, this makes the
489 link line generated for a library found by a Find Module depend on
490 whether it is linked through an imported target or not, which is incon‐
491 sistent. Furthermore, this behavior has been a source of confusion
492 because the generated link line for a library file depends on its loca‐
493 tion. It is also problematic for projects trying to link statically
494 because flags like -Wl,-Bstatic -lfoo -Wl,-Bdynamic may be used to help
495 the linker select libfoo.a instead of libfoo.so but then leak dynamic
496 linking to following libraries. (See the LINK_SEARCH_END_STATIC target
497 property for a solution typically used for that problem.)
498
499 When the special case for libraries in implicit link directories was
500 first introduced the list of implicit link directories was simply
501 hard-coded (e.g. /lib, /usr/lib, and a few others). Since that time,
502 CMake has learned to detect the implicit link directories used by the
503 compiler front-end. If necessary, the find_library() command could be
504 taught to use this information to help find libraries of the proper
505 architecture.
506
507 For these reasons, CMake 3.3 and above prefer to drop the special case
508 and link libraries by full path even when they are in implicit link
509 directories. Policy CMP0060 provides compatibility for existing
510 projects.
511
512 The OLD behavior for this policy is to ask the linker to search for
513 libraries whose full paths are known to be in implicit link directo‐
514 ries. The NEW behavior for this policy is to link libraries by full
515 path even if they are in implicit link directories.
516
517 This policy was introduced in CMake version 3.3. Unlike most policies,
518 CMake version 3.11.4 does not warn by default when this policy is not
519 set and simply uses OLD behavior. See documentation of the CMAKE_POL‐
520 ICY_WARNING_CMP0060 variable to control the warning.
521
522 NOTE:
523 The OLD behavior of a policy is deprecated by definition and may be
524 removed in a future version of CMake.
525
526 CMP0059
527 Do not treat DEFINITIONS as a built-in directory property.
528
529 CMake 3.3 and above no longer make a list of definitions available
530 through the DEFINITIONS directory property. The COMPILE_DEFINITIONS
531 directory property may be used instead.
532
533 The OLD behavior for this policy is to provide the list of flags given
534 so far to the add_definitions() command. The NEW behavior is to behave
535 as a normal user-defined directory property.
536
537 This policy was introduced in CMake version 3.3. CMake version 3.11.4
538 warns when the policy is not set and uses OLD behavior. Use the
539 cmake_policy() command to set it to OLD or NEW explicitly.
540
541 NOTE:
542 The OLD behavior of a policy is deprecated by definition and may be
543 removed in a future version of CMake.
544
545 CMP0058
546 Ninja requires custom command byproducts to be explicit.
547
548 When an intermediate file generated during the build is consumed by an
549 expensive operation or a large tree of dependents, one may reduce the
550 work needed for an incremental rebuild by updating the file timestamp
551 only when its content changes. With this approach the generation rule
552 must have a separate output file that is always updated with a new
553 timestamp that is newer than any dependencies of the rule so that the
554 build tool re-runs the rule only when the input changes. We refer to
555 the separate output file as a rule’s witness and the generated file as
556 a rule’s byproduct.
557
558 Byproducts may not be listed as outputs because their timestamps are
559 allowed to be older than the inputs. No build tools (like make) that
560 existed when CMake was designed have a way to express byproducts.
561 Therefore CMake versions prior to 3.2 had no way to specify them.
562 Projects typically left byproducts undeclared in the rules that gener‐
563 ate them. For example:
564
565 add_custom_command(
566 OUTPUT witness.txt
567 COMMAND ${CMAKE_COMMAND} -E copy_if_different
568 ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
569 byproduct.txt # timestamp may not change
570 COMMAND ${CMAKE_COMMAND} -E touch witness.txt
571 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
572 )
573 add_custom_target(Provider DEPENDS witness.txt)
574 add_custom_command(
575 OUTPUT generated.c
576 COMMAND expensive-task -i byproduct.txt -o generated.c
577 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt
578 )
579 add_library(Consumer generated.c)
580 add_dependencies(Consumer Provider)
581
582 This works well for all generators except Ninja. The Ninja build tool
583 sees a rule listing byproduct.txt as a dependency and no rule listing
584 it as an output. Ninja then complains that there is no way to satisfy
585 the dependency and stops building even though there are order-only
586 dependencies that ensure byproduct.txt will exist before its consumers
587 need it. See discussion of this problem in Ninja Issue 760 for further
588 details on why Ninja works this way.
589
590 Instead of leaving byproducts undeclared in the rules that generate
591 them, Ninja expects byproducts to be listed along with other outputs.
592 Such rules may be marked with a restat option that tells Ninja to check
593 the timestamps of outputs after the rules run. This prevents byprod‐
594 ucts whose timestamps do not change from causing their dependents to
595 re-build unnecessarily.
596
597 Since the above approach does not tell CMake what custom command gener‐
598 ates byproduct.txt, the Ninja generator does not have enough informa‐
599 tion to add the byproduct as an output of any rule. CMake 2.8.12 and
600 above work around this problem and allow projects using the above
601 approach to build by generating phony build rules to tell Ninja to tol‐
602 erate such missing files. However, this workaround prevents Ninja from
603 diagnosing a dependency that is really missing. It also works poorly
604 in in-source builds where every custom command dependency, even on
605 source files, needs to be treated this way because CMake does not have
606 enough information to know which files are generated as byproducts of
607 custom commands.
608
609 CMake 3.2 introduced the BYPRODUCTS option to the add_custom_command()
610 and add_custom_target() commands. This option allows byproducts to be
611 specified explicitly:
612
613 add_custom_command(
614 OUTPUT witness.txt
615 BYPRODUCTS byproduct.txt # explicit byproduct specification
616 COMMAND ${CMAKE_COMMAND} -E copy_if_different
617 ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
618 byproduct.txt # timestamp may not change
619 ...
620
621 The BYPRODUCTS option is used by the Ninja generator to list byproducts
622 among the outputs of the custom commands that generate them, and is
623 ignored by other generators.
624
625 CMake 3.3 and above prefer to require projects to specify custom com‐
626 mand byproducts explicitly so that it can avoid using the phony rule
627 workaround altogether. Policy CMP0058 was introduced to provide com‐
628 patibility with existing projects that still need the workaround.
629
630 This policy has no effect on generators other than Ninja. The OLD
631 behavior for this policy is to generate Ninja phony rules for unknown
632 dependencies in the build tree. The NEW behavior for this policy is to
633 not generate these and instead require projects to specify custom com‐
634 mand BYPRODUCTS explicitly.
635
636 This policy was introduced in CMake version 3.3. CMake version 3.11.4
637 warns when it sees unknown dependencies in out-of-source build trees if
638 the policy is not set and then uses OLD behavior. Use the cmake_pol‐
639 icy() command to set the policy to OLD or NEW explicitly. The policy
640 setting must be in scope at the end of the top-level CMakeLists.txt
641 file of the project and has global effect.
642
643 NOTE:
644 The OLD behavior of a policy is deprecated by definition and may be
645 removed in a future version of CMake.
646
647 CMP0057
648 Support new if() IN_LIST operator.
649
650 CMake 3.3 adds support for the new IN_LIST operator.
651
652 The OLD behavior for this policy is to ignore the IN_LIST operator.
653 The NEW behavior is to interpret the IN_LIST operator.
654
655 This policy was introduced in CMake version 3.3. CMake version 3.11.4
656 warns when the policy is not set and uses OLD behavior. Use the
657 cmake_policy() command to set it to OLD or NEW explicitly.
658
659 NOTE:
660 The OLD behavior of a policy is deprecated by definition and may be
661 removed in a future version of CMake.
662
664 CMP0056
665 Honor link flags in try_compile() source-file signature.
666
667 The try_compile() command source-file signature generates a CMake‐
668 Lists.txt file to build the source file into an executable. In order
669 to compile the source the same way as it might be compiled by the call‐
670 ing project, the generated project sets the value of the
671 CMAKE_<LANG>_FLAGS variable to that in the calling project. The value
672 of the CMAKE_EXE_LINKER_FLAGS variable may be needed in some cases too,
673 but CMake 3.1 and lower did not set it in the generated project. CMake
674 3.2 and above prefer to set it so that linker flags are honored as well
675 as compiler flags. This policy provides compatibility with the pre-3.2
676 behavior.
677
678 The OLD behavior for this policy is to not set the value of the
679 CMAKE_EXE_LINKER_FLAGS variable in the generated test project. The NEW
680 behavior for this policy is to set the value of the
681 CMAKE_EXE_LINKER_FLAGS variable in the test project to the same as it
682 is in the calling project.
683
684 If the project code does not set the policy explicitly, users may set
685 it on the command line by defining the CMAKE_POLICY_DEFAULT_CMP0056
686 variable in the cache.
687
688 This policy was introduced in CMake version 3.2. Unlike most policies,
689 CMake version 3.11.4 does not warn by default when this policy is not
690 set and simply uses OLD behavior. See documentation of the CMAKE_POL‐
691 ICY_WARNING_CMP0056 variable to control the warning.
692
693 NOTE:
694 The OLD behavior of a policy is deprecated by definition and may be
695 removed in a future version of CMake.
696
697 CMP0055
698 Strict checking for the break() command.
699
700 CMake 3.1 and lower allowed calls to the break() command outside of a
701 loop context and also ignored any given arguments. This was undefined
702 behavior.
703
704 The OLD behavior for this policy is to allow break() to be placed out‐
705 side of loop contexts and ignores any arguments. The NEW behavior for
706 this policy is to issue an error if a misplaced break or any arguments
707 are found.
708
709 This policy was introduced in CMake version 3.2. CMake version 3.11.4
710 warns when the policy is not set and uses OLD behavior. Use the
711 cmake_policy command to set it to OLD or NEW explicitly.
712
713 NOTE:
714 The OLD behavior of a policy is deprecated by definition and may be
715 removed in a future version of CMake.
716
718 CMP0054
719 Only interpret if() arguments as variables or keywords when unquoted.
720
721 CMake 3.1 and above no longer implicitly dereference variables or
722 interpret keywords in an if() command argument when it is a Quoted
723 Argument or a Bracket Argument.
724
725 The OLD behavior for this policy is to dereference variables and inter‐
726 pret keywords even if they are quoted or bracketed. The NEW behavior
727 is to not dereference variables or interpret keywords that have been
728 quoted or bracketed.
729
730 Given the following partial example:
731
732 set(A E)
733 set(E "")
734
735 if("${A}" STREQUAL "")
736 message("Result is TRUE before CMake 3.1 or when CMP0054 is OLD")
737 else()
738 message("Result is FALSE in CMake 3.1 and above if CMP0054 is NEW")
739 endif()
740
741 After explicit expansion of variables this gives:
742
743 if("E" STREQUAL "")
744
745 With the policy set to OLD implicit expansion reduces this semantically
746 to:
747
748 if("" STREQUAL "")
749
750 With the policy set to NEW the quoted arguments will not be further
751 dereferenced:
752
753 if("E" STREQUAL "")
754
755 This policy was introduced in CMake version 3.1. CMake version 3.11.4
756 warns when the policy is not set and uses OLD behavior. Use the
757 cmake_policy() command to set it to OLD or NEW explicitly.
758
759 NOTE:
760 The OLD behavior of a policy is deprecated by definition and may be
761 removed in a future version of CMake.
762
763 CMP0053
764 Simplify variable reference and escape sequence evaluation.
765
766 CMake 3.1 introduced a much faster implementation of evaluation of the
767 Variable References and Escape Sequences documented in the cmake-lan‐
768 guage(7) manual. While the behavior is identical to the legacy imple‐
769 mentation in most cases, some corner cases were cleaned up to simplify
770 the behavior. Specifically:
771
772 · Expansion of @VAR@ reference syntax defined by the configure_file()
773 and string(CONFIGURE) commands is no longer performed in other con‐
774 texts.
775
776 · Literal ${VAR} reference syntax may contain only alphanumeric charac‐
777 ters (A-Z, a-z, 0-9) and the characters _, ., /, -, and +. Variables
778 with other characters in their name may still be referenced indi‐
779 rectly, e.g.
780
781 set(varname "otherwise & disallowed $ characters")
782 message("${${varname}}")
783
784 · The setting of policy CMP0010 is not considered, so improper variable
785 reference syntax is always an error.
786
787 · More characters are allowed to be escaped in variable names. Previ‐
788 ously, only ()#" \@^ were valid characters to escape. Now any
789 non-alphanumeric, non-semicolon, non-NUL character may be escaped
790 following the escape_identity production in the Escape Sequences sec‐
791 tion of the cmake-language(7) manual.
792
793 The OLD behavior for this policy is to honor the legacy behavior for
794 variable references and escape sequences. The NEW behavior is to use
795 the simpler variable expansion and escape sequence evaluation rules.
796
797 This policy was introduced in CMake version 3.1. CMake version 3.11.4
798 warns when the policy is not set and uses OLD behavior. Use the
799 cmake_policy() command to set it to OLD or NEW explicitly.
800
801 NOTE:
802 The OLD behavior of a policy is deprecated by definition and may be
803 removed in a future version of CMake.
804
805 CMP0052
806 Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTO‐
807 RIES.
808
809 CMake 3.0 and lower allowed subdirectories of the source directory or
810 build directory to be in the INTERFACE_INCLUDE_DIRECTORIES of installed
811 and exported targets, if the directory was also a subdirectory of the
812 installation prefix. This makes the installation depend on the exis‐
813 tence of the source dir or binary dir, and the installation will be
814 broken if either are removed after installation.
815
816 See Include Directories and Usage Requirements for more on specifying
817 include directories for targets.
818
819 The OLD behavior for this policy is to export the content of the INTER‐
820 FACE_INCLUDE_DIRECTORIES with the source or binary directory. The NEW
821 behavior for this policy is to issue an error if such a directory is
822 used.
823
824 This policy was introduced in CMake version 3.1. CMake version 3.11.4
825 warns when the policy is not set and uses OLD behavior. Use the
826 cmake_policy() command to set it to OLD or NEW explicitly.
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 CMP0051
833 List TARGET_OBJECTS in SOURCES target property.
834
835 CMake 3.0 and lower did not include the TARGET_OBJECTS generator
836 expression when returning the SOURCES target property.
837
838 Configure-time CMake code is not able to handle generator expressions.
839 If using the SOURCES target property at configure time, it may be nec‐
840 essary to first remove generator expressions using the
841 string(GENEX_STRIP) command. Generate-time CMake code such as
842 file(GENERATE) can handle the content without stripping.
843
844 The OLD behavior for this policy is to omit TARGET_OBJECTS expressions
845 from the SOURCES target property. The NEW behavior for this policy is
846 to include TARGET_OBJECTS expressions in the output.
847
848 This policy was introduced in CMake version 3.1. CMake version 3.11.4
849 warns when the policy is not set and uses OLD behavior. Use the
850 cmake_policy() command to set it to OLD or NEW explicitly.
851
852 NOTE:
853 The OLD behavior of a policy is deprecated by definition and may be
854 removed in a future version of CMake.
855
857 CMP0050
858 Disallow add_custom_command SOURCE signatures.
859
860 CMake 2.8.12 and lower allowed a signature for add_custom_command()
861 which specified an input to a command. This was undocumented behavior.
862 Modern use of CMake associates custom commands with their output,
863 rather than their input.
864
865 The OLD behavior for this policy is to allow the use of add_custom_com‐
866 mand() SOURCE signatures. The NEW behavior for this policy is to issue
867 an error if such a signature is used.
868
869 This policy was introduced in CMake version 3.0. CMake version 3.11.4
870 warns when the policy is not set and uses OLD behavior. Use the
871 cmake_policy command to set it to OLD or NEW explicitly.
872
873 NOTE:
874 The OLD behavior of a policy is deprecated by definition and may be
875 removed in a future version of CMake.
876
877 CMP0049
878 Do not expand variables in target source entries.
879
880 CMake 2.8.12 and lower performed and extra layer of variable expansion
881 when evaluating source file names:
882
883 set(a_source foo.c)
884 add_executable(foo \${a_source})
885
886 This was undocumented behavior.
887
888 The OLD behavior for this policy is to expand such variables when pro‐
889 cessing the target sources. The NEW behavior for this policy is to
890 issue an error if such variables need to be expanded.
891
892 This policy was introduced in CMake version 3.0. CMake version 3.11.4
893 warns when the policy is not set and uses OLD behavior. Use the
894 cmake_policy command to set it to OLD or NEW explicitly.
895
896 NOTE:
897 The OLD behavior of a policy is deprecated by definition and may be
898 removed in a future version of CMake.
899
900 CMP0048
901 The project() command manages VERSION variables.
902
903 CMake version 3.0 introduced the VERSION option of the project() com‐
904 mand to specify a project version as well as the name. In order to
905 keep PROJECT_VERSION and related variables consistent with variable
906 PROJECT_NAME it is necessary to set the VERSION variables to the empty
907 string when no VERSION is given to project(). However, this can change
908 behavior for existing projects that set VERSION variables themselves
909 since project() may now clear them. This policy controls the behavior
910 for compatibility with such projects.
911
912 The OLD behavior for this policy is to leave VERSION variables
913 untouched. The NEW behavior for this policy is to set VERSION as docu‐
914 mented by the project() command.
915
916 This policy was introduced in CMake version 3.0. CMake version 3.11.4
917 warns when the policy is not set and uses OLD behavior. Use the
918 cmake_policy command to set it to OLD or NEW explicitly.
919
920 NOTE:
921 The OLD behavior of a policy is deprecated by definition and may be
922 removed in a future version of CMake.
923
924 CMP0047
925 Use QCC compiler id for the qcc drivers on QNX.
926
927 CMake 3.0 and above recognize that the QNX qcc compiler driver is dif‐
928 ferent from the GNU compiler. CMake now prefers to present this to
929 projects by setting the CMAKE_<LANG>_COMPILER_ID variable to QCC
930 instead of GNU. However, existing projects may assume the compiler id
931 for QNX qcc is just GNU as it was in CMake versions prior to 3.0.
932 Therefore this policy determines for QNX qcc which compiler id to
933 report in the CMAKE_<LANG>_COMPILER_ID variable after language <LANG>
934 is enabled by the project() or enable_language() command. The policy
935 must be set prior to the invocation of either command.
936
937 The OLD behavior for this policy is to use the GNU compiler id for the
938 qcc and QCC compiler drivers. The NEW behavior for this policy is to
939 use the QCC compiler id for those drivers.
940
941 This policy was introduced in CMake version 3.0. Use the cmake_pol‐
942 icy() command to set this policy to OLD or NEW explicitly. Unlike most
943 policies, CMake version 3.11.4 does not warn by default when this pol‐
944 icy is not set and simply uses OLD behavior. See documentation of the
945 CMAKE_POLICY_WARNING_CMP0047 variable to control the warning.
946
947 NOTE:
948 The OLD behavior of a policy is deprecated by definition and may be
949 removed in a future version of CMake.
950
951 CMP0046
952 Error on non-existent dependency in add_dependencies.
953
954 CMake 2.8.12 and lower silently ignored non-existent dependencies
955 listed in the add_dependencies() command.
956
957 The OLD behavior for this policy is to silently ignore non-existent
958 dependencies. The NEW behavior for this policy is to report an error if
959 non-existent dependencies are listed in the add_dependencies() command.
960
961 This policy was introduced in CMake version 3.0. CMake version 3.11.4
962 warns when the policy is not set and uses OLD behavior. Use the
963 cmake_policy command to set it to OLD or NEW explicitly.
964
965 NOTE:
966 The OLD behavior of a policy is deprecated by definition and may be
967 removed in a future version of CMake.
968
969 CMP0045
970 Error on non-existent target in get_target_property.
971
972 In CMake 2.8.12 and lower, the get_target_property() command accepted a
973 non-existent target argument without issuing any error or warning. The
974 result variable is set to a -NOTFOUND value.
975
976 The OLD behavior for this policy is to issue no warning and set the
977 result variable to a -NOTFOUND value. The NEW behavior for this policy
978 is to issue a FATAL_ERROR if the command is called with a non-existent
979 target.
980
981 This policy was introduced in CMake version 3.0. CMake version 3.11.4
982 warns when the policy is not set and uses OLD behavior. Use the
983 cmake_policy command to set it to OLD or NEW explicitly.
984
985 NOTE:
986 The OLD behavior of a policy is deprecated by definition and may be
987 removed in a future version of CMake.
988
989 CMP0044
990 Case sensitive <LANG>_COMPILER_ID generator expressions
991
992 CMake 2.8.12 introduced the <LANG>_COMPILER_ID generator expressions to
993 allow comparison of the CMAKE_<LANG>_COMPILER_ID with a test value.
994 The possible valid values are lowercase, but the comparison with the
995 test value was performed case-insensitively.
996
997 The OLD behavior for this policy is to perform a case-insensitive com‐
998 parison with the value in the <LANG>_COMPILER_ID expression. The NEW
999 behavior for this policy is to perform a case-sensitive comparison with
1000 the value in the <LANG>_COMPILER_ID expression.
1001
1002 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1003 warns when the policy is not set and uses OLD behavior. Use the
1004 cmake_policy command to set it to OLD or NEW explicitly.
1005
1006 NOTE:
1007 The OLD behavior of a policy is deprecated by definition and may be
1008 removed in a future version of CMake.
1009
1010 CMP0043
1011 Ignore COMPILE_DEFINITIONS_<Config> properties
1012
1013 CMake 2.8.12 and lower allowed setting the COMPILE_DEFINITIONS_<CONFIG>
1014 target property and COMPILE_DEFINITIONS_<CONFIG> directory property to
1015 apply configuration-specific compile definitions.
1016
1017 Since CMake 2.8.10, the COMPILE_DEFINITIONS property has supported gen‐
1018 erator expressions for setting configuration-dependent content. The
1019 continued existence of the suffixed variables is redundant, and causes
1020 a maintenance burden. Population of the COMPILE_DEFINITIONS_DEBUG
1021 property may be replaced with a population of COMPILE_DEFINITIONS
1022 directly or via target_compile_definitions():
1023
1024 # Old Interfaces:
1025 set_property(TARGET tgt APPEND PROPERTY
1026 COMPILE_DEFINITIONS_DEBUG DEBUG_MODE
1027 )
1028 set_property(DIRECTORY APPEND PROPERTY
1029 COMPILE_DEFINITIONS_DEBUG DIR_DEBUG_MODE
1030 )
1031
1032 # New Interfaces:
1033 set_property(TARGET tgt APPEND PROPERTY
1034 COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG_MODE>
1035 )
1036 target_compile_definitions(tgt PRIVATE $<$<CONFIG:Debug>:DEBUG_MODE>)
1037 set_property(DIRECTORY APPEND PROPERTY
1038 COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DIR_DEBUG_MODE>
1039 )
1040
1041 The OLD behavior for this policy is to consume the content of the suf‐
1042 fixed COMPILE_DEFINITIONS_<CONFIG> target property when generating the
1043 compilation command. The NEW behavior for this policy is to ignore the
1044 content of the COMPILE_DEFINITIONS_<CONFIG> target property .
1045
1046 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1047 warns when the policy is not set and uses OLD behavior. Use the
1048 cmake_policy command to set it to OLD or NEW explicitly.
1049
1050 NOTE:
1051 The OLD behavior of a policy is deprecated by definition and may be
1052 removed in a future version of CMake.
1053
1054 CMP0042
1055 MACOSX_RPATH is enabled by default.
1056
1057 CMake 2.8.12 and newer has support for using @rpath in a target’s
1058 install name. This was enabled by setting the target property
1059 MACOSX_RPATH. The @rpath in an install name is a more flexible and
1060 powerful mechanism than @executable_path or @loader_path for locating
1061 shared libraries.
1062
1063 CMake 3.0 and later prefer this property to be ON by default. Projects
1064 wanting @rpath in a target’s install name may remove any setting of the
1065 INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables.
1066
1067 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1068 warns when the policy is not set and uses OLD behavior. Use the
1069 cmake_policy command to set it to OLD or NEW explicitly.
1070
1071 NOTE:
1072 The OLD behavior of a policy is deprecated by definition and may be
1073 removed in a future version of CMake.
1074
1075 CMP0041
1076 Error on relative include with generator expression.
1077
1078 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the
1079 INTERFACE_INCLUDE_DIRECTORIES of a target if it contained a generator
1080 expression at any position.
1081
1082 The path entries in that target property should not be relative.
1083 High-level API should ensure that by adding either a source directory
1084 or a install directory prefix, as appropriate.
1085
1086 As an additional diagnostic, the INTERFACE_INCLUDE_DIRECTORIES gener‐
1087 ated on an IMPORTED target for the install location should not contain
1088 paths in the source directory or the build directory.
1089
1090 The OLD behavior for this policy is to ignore relative path entries if
1091 they contain a generator expression. The NEW behavior for this policy
1092 is to report an error if a generator expression appears in another
1093 location and the path is relative.
1094
1095 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1096 warns when the policy is not set and uses OLD behavior. Use the
1097 cmake_policy command to set it to OLD or NEW explicitly.
1098
1099 NOTE:
1100 The OLD behavior of a policy is deprecated by definition and may be
1101 removed in a future version of CMake.
1102
1103 CMP0040
1104 The target in the TARGET signature of add_custom_command() must exist
1105 and must be defined in the current directory.
1106
1107 CMake 2.8.12 and lower silently ignored a custom command created with
1108 the TARGET signature of add_custom_command() if the target is unknown
1109 or was defined outside the current directory.
1110
1111 The OLD behavior for this policy is to ignore custom commands for
1112 unknown targets. The NEW behavior for this policy is to report an
1113 error if the target referenced in add_custom_command() is unknown or
1114 was defined outside the current directory.
1115
1116 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1117 warns when the policy is not set and uses OLD behavior. Use the
1118 cmake_policy() command to set it to OLD or NEW explicitly.
1119
1120 NOTE:
1121 The OLD behavior of a policy is deprecated by definition and may be
1122 removed in a future version of CMake.
1123
1124 CMP0039
1125 Utility targets may not have link dependencies.
1126
1127 CMake 2.8.12 and lower allowed using utility targets in the left hand
1128 side position of the target_link_libraries() command. This is an indi‐
1129 cator of a bug in user code.
1130
1131 The OLD behavior for this policy is to ignore attempts to set the link
1132 libraries of utility targets. The NEW behavior for this policy is to
1133 report an error if an attempt is made to set the link libraries of a
1134 utility target.
1135
1136 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1137 warns when the policy is not set and uses OLD behavior. Use the
1138 cmake_policy command to set it to OLD or NEW explicitly.
1139
1140 NOTE:
1141 The OLD behavior of a policy is deprecated by definition and may be
1142 removed in a future version of CMake.
1143
1144 CMP0038
1145 Targets may not link directly to themselves.
1146
1147 CMake 2.8.12 and lower allowed a build target to link to itself
1148 directly with a target_link_libraries() call. This is an indicator of a
1149 bug in user code.
1150
1151 The OLD behavior for this policy is to ignore targets which list them‐
1152 selves in their own link implementation. The NEW behavior for this
1153 policy is to report an error if a target attempts to link to itself.
1154
1155 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1156 warns when the policy is not set and uses OLD behavior. Use the
1157 cmake_policy command to set it to OLD or NEW explicitly.
1158
1159 NOTE:
1160 The OLD behavior of a policy is deprecated by definition and may be
1161 removed in a future version of CMake.
1162
1163 CMP0037
1164 Target names should not be reserved and should match a validity pat‐
1165 tern.
1166
1167 CMake 2.8.12 and lower allowed creating targets using add_library(),
1168 add_executable() and add_custom_target() with unrestricted choice for
1169 the target name. Newer cmake features such as cmake-generator-expres‐
1170 sions(7) and some diagnostics expect target names to match a restricted
1171 pattern.
1172
1173 Target names may contain upper and lower case letters, numbers, the
1174 underscore character (_), dot(.), plus(+) and minus(-). As a special
1175 case, ALIAS targets and IMPORTED targets may contain two consecutive
1176 colons.
1177
1178 Target names reserved by one or more CMake generators are not allowed.
1179 Among others these include “all”, “clean”, “help”, and “install”.
1180
1181 Target names associated with optional features, such as “test” and
1182 “package”, may also be reserved. CMake 3.10 and below always reserve
1183 them. CMake 3.11 and above reserve them only when the corresponding
1184 feature is enabled (e.g. by including the CTest or CPack modules).
1185
1186 The OLD behavior for this policy is to allow creating targets with
1187 reserved names or which do not match the validity pattern. The NEW
1188 behavior for this policy is to report an error if an add_* command is
1189 used with an invalid target name.
1190
1191 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1192 warns when the policy is not set and uses OLD behavior. Use the
1193 cmake_policy command to set it to OLD or NEW explicitly.
1194
1195 NOTE:
1196 The OLD behavior of a policy is deprecated by definition and may be
1197 removed in a future version of CMake.
1198
1199 CMP0036
1200 The build_name() command should not be called.
1201
1202 This command was added in May 2001 to compute a name for the current
1203 operating system and compiler combination. The command has long been
1204 documented as discouraged and replaced by the CMAKE_SYSTEM and
1205 CMAKE_<LANG>_COMPILER variables.
1206
1207 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1208 ior for this policy is to allow the command to be called. The NEW
1209 behavior for this policy is to issue a FATAL_ERROR when the command is
1210 called.
1211
1212 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1213 warns when the policy is not set and uses OLD behavior. Use the
1214 cmake_policy command to set it to OLD or NEW explicitly.
1215
1216 NOTE:
1217 The OLD behavior of a policy is deprecated by definition and may be
1218 removed in a future version of CMake.
1219
1220 CMP0035
1221 The variable_requires() command should not be called.
1222
1223 This command was introduced in November 2001 to perform some condi‐
1224 tional logic. It has long been replaced by the if() command.
1225
1226 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1227 ior for this policy is to allow the command to be called. The NEW
1228 behavior for this policy is to issue a FATAL_ERROR when the command is
1229 called.
1230
1231 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1232 warns when the policy is not set and uses OLD behavior. Use the
1233 cmake_policy command to set it to OLD or NEW explicitly.
1234
1235 NOTE:
1236 The OLD behavior of a policy is deprecated by definition and may be
1237 removed in a future version of CMake.
1238
1239 CMP0034
1240 The utility_source() command should not be called.
1241
1242 This command was introduced in March 2001 to help build executables
1243 used to generate other files. This approach has long been replaced by
1244 add_executable() combined with add_custom_command().
1245
1246 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1247 ior for this policy is to allow the command to be called. The NEW
1248 behavior for this policy is to issue a FATAL_ERROR when the command is
1249 called.
1250
1251 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1252 warns when the policy is not set and uses OLD behavior. Use the
1253 cmake_policy command to set it to OLD or NEW explicitly.
1254
1255 NOTE:
1256 The OLD behavior of a policy is deprecated by definition and may be
1257 removed in a future version of CMake.
1258
1259 CMP0033
1260 The export_library_dependencies() command should not be called.
1261
1262 This command was added in January 2003 to export <tgt>_LIB_DEPENDS
1263 internal CMake cache entries to a file for installation with a project.
1264 This was used at the time to allow transitive link dependencies to work
1265 for applications outside of the original build tree of a project. The
1266 functionality has been superseded by the export() and install(EXPORT)
1267 commands.
1268
1269 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1270 ior for this policy is to allow the command to be called. The NEW
1271 behavior for this policy is to issue a FATAL_ERROR when the command is
1272 called.
1273
1274 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1275 warns when the policy is not set and uses OLD behavior. Use the
1276 cmake_policy command to set it to OLD or NEW explicitly.
1277
1278 NOTE:
1279 The OLD behavior of a policy is deprecated by definition and may be
1280 removed in a future version of CMake.
1281
1282 CMP0032
1283 The output_required_files() command should not be called.
1284
1285 This command was added in June 2001 to expose the then-current CMake
1286 implicit dependency scanner. CMake’s real implicit dependency scanner
1287 has evolved since then but is not exposed through this command. The
1288 scanning capabilities of this command are very limited and this func‐
1289 tionality is better achieved through dedicated outside tools.
1290
1291 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1292 ior for this policy is to allow the command to be called. The NEW
1293 behavior for this policy is to issue a FATAL_ERROR when the command is
1294 called.
1295
1296 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1297 warns when the policy is not set and uses OLD behavior. Use the
1298 cmake_policy command to set it to OLD or NEW explicitly.
1299
1300 NOTE:
1301 The OLD behavior of a policy is deprecated by definition and may be
1302 removed in a future version of CMake.
1303
1304 CMP0031
1305 The load_command() command should not be called.
1306
1307 This command was added in August 2002 to allow projects to add arbi‐
1308 trary commands implemented in C or C++. However, it does not work when
1309 the toolchain in use does not match the ABI of the CMake process. It
1310 has been mostly superseded by the macro() and function() commands.
1311
1312 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1313 ior for this policy is to allow the command to be called. The NEW
1314 behavior for this policy is to issue a FATAL_ERROR when the command is
1315 called.
1316
1317 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1318 warns when the policy is not set and uses OLD behavior. Use the
1319 cmake_policy command to set it to OLD or NEW explicitly.
1320
1321 NOTE:
1322 The OLD behavior of a policy is deprecated by definition and may be
1323 removed in a future version of CMake.
1324
1325 CMP0030
1326 The use_mangled_mesa() command should not be called.
1327
1328 This command was created in September 2001 to support VTK before modern
1329 CMake language and custom command capabilities. VTK has not used it in
1330 years.
1331
1332 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1333 ior for this policy is to allow the command to be called. The NEW
1334 behavior for this policy is to issue a FATAL_ERROR when the command is
1335 called.
1336
1337 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1338 warns when the policy is not set and uses OLD behavior. Use the
1339 cmake_policy command to set it to OLD or NEW explicitly.
1340
1341 NOTE:
1342 The OLD behavior of a policy is deprecated by definition and may be
1343 removed in a future version of CMake.
1344
1345 CMP0029
1346 The subdir_depends() command should not be called.
1347
1348 The implementation of this command has been empty since December 2001
1349 but was kept in CMake for compatibility for a long time.
1350
1351 CMake >= 3.0 prefer that this command never be called. The OLD behav‐
1352 ior for this policy is to allow the command to be called. The NEW
1353 behavior for this policy is to issue a FATAL_ERROR when the command is
1354 called.
1355
1356 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1357 warns when the policy is not set and uses OLD behavior. Use the
1358 cmake_policy command to set it to OLD or NEW explicitly.
1359
1360 NOTE:
1361 The OLD behavior of a policy is deprecated by definition and may be
1362 removed in a future version of CMake.
1363
1364 CMP0028
1365 Double colon in target name means ALIAS or IMPORTED target.
1366
1367 CMake 2.8.12 and lower allowed the use of targets and files with double
1368 colons in target_link_libraries, with some buildsystem generators.
1369
1370 The use of double-colons is a common pattern used to namespace IMPORTED
1371 targets and ALIAS targets. When computing the link dependencies of a
1372 target, the name of each dependency could either be a target, or a file
1373 on disk. Previously, if a target was not found with a matching name,
1374 the name was considered to refer to a file on disk. This can lead to
1375 confusing error messages if there is a typo in what should be a target
1376 name.
1377
1378 The OLD behavior for this policy is to search for targets, then files
1379 on disk, even if the search term contains double-colons. The NEW
1380 behavior for this policy is to issue a FATAL_ERROR if a link dependency
1381 contains double-colons but is not an IMPORTED target or an ALIAS tar‐
1382 get.
1383
1384 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1385 warns when the policy is not set and uses OLD behavior. Use the
1386 cmake_policy command to set it to OLD or NEW explicitly.
1387
1388 NOTE:
1389 The OLD behavior of a policy is deprecated by definition and may be
1390 removed in a future version of CMake.
1391
1392 CMP0027
1393 Conditionally linked imported targets with missing include directories.
1394
1395 CMake 2.8.11 introduced introduced the concept of INTER‐
1396 FACE_INCLUDE_DIRECTORIES, and a check at cmake time that the entries in
1397 the INTERFACE_INCLUDE_DIRECTORIES of an IMPORTED target actually exist.
1398 CMake 2.8.11 also introduced generator expression support in the tar‐
1399 get_link_libraries command. However, if an imported target is linked
1400 as a result of a generator expression evaluation, the entries in the
1401 INTERFACE_INCLUDE_DIRECTORIES of that target were not checked for exis‐
1402 tence as they should be.
1403
1404 The OLD behavior of this policy is to report a warning if an entry in
1405 the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression condition‐
1406 ally linked IMPORTED target does not exist.
1407
1408 The NEW behavior of this policy is to report an error if an entry in
1409 the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression condition‐
1410 ally linked IMPORTED target does not exist.
1411
1412 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1413 warns when the policy is not set and uses OLD behavior. Use the
1414 cmake_policy command to set it to OLD or NEW explicitly.
1415
1416 NOTE:
1417 The OLD behavior of a policy is deprecated by definition and may be
1418 removed in a future version of CMake.
1419
1420 CMP0026
1421 Disallow use of the LOCATION property for build targets.
1422
1423 CMake 2.8.12 and lower allowed reading the LOCATION target property
1424 (and configuration-specific variants) to determine the eventual loca‐
1425 tion of build targets. This relies on the assumption that all neces‐
1426 sary information is available at configure-time to determine the final
1427 location and filename of the target. However, this property is not
1428 fully determined until later at generate-time. At generate time, the
1429 $<TARGET_FILE> generator expression can be used to determine the even‐
1430 tual LOCATION of a target output.
1431
1432 Code which reads the LOCATION target property can be ported to use the
1433 $<TARGET_FILE> generator expression together with the file(GENERATE)
1434 subcommand to generate a file containing the target location.
1435
1436 The OLD behavior for this policy is to allow reading the LOCATION prop‐
1437 erties from build-targets. The NEW behavior for this policy is to not
1438 to allow reading the LOCATION properties from build-targets.
1439
1440 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1441 warns when the policy is not set and uses OLD behavior. Use the
1442 cmake_policy command to set it to OLD or NEW explicitly.
1443
1444 NOTE:
1445 The OLD behavior of a policy is deprecated by definition and may be
1446 removed in a future version of CMake.
1447
1448 CMP0025
1449 Compiler id for Apple Clang is now AppleClang.
1450
1451 CMake 3.0 and above recognize that Apple Clang is a different compiler
1452 than upstream Clang and that they have different version numbers.
1453 CMake now prefers to present this to projects by setting the
1454 CMAKE_<LANG>_COMPILER_ID variable to AppleClang instead of Clang. How‐
1455 ever, existing projects may assume the compiler id for Apple Clang is
1456 just Clang as it was in CMake versions prior to 3.0. Therefore this
1457 policy determines for Apple Clang which compiler id to report in the
1458 CMAKE_<LANG>_COMPILER_ID variable after language <LANG> is enabled by
1459 the project() or enable_language() command. The policy must be set
1460 prior to the invocation of either command.
1461
1462 The OLD behavior for this policy is to use compiler id Clang. The NEW
1463 behavior for this policy is to use compiler id AppleClang.
1464
1465 This policy was introduced in CMake version 3.0. Use the cmake_pol‐
1466 icy() command to set this policy to OLD or NEW explicitly. Unlike most
1467 policies, CMake version 3.11.4 does not warn by default when this pol‐
1468 icy is not set and simply uses OLD behavior. See documentation of the
1469 CMAKE_POLICY_WARNING_CMP0025 variable to control the warning.
1470
1471 NOTE:
1472 The OLD behavior of a policy is deprecated by definition and may be
1473 removed in a future version of CMake.
1474
1475 CMP0024
1476 Disallow include export result.
1477
1478 CMake 2.8.12 and lower allowed use of the include() command with the
1479 result of the export() command. This relies on the assumption that the
1480 export() command has an immediate effect at configure-time during a
1481 cmake run. Certain properties of targets are not fully determined
1482 until later at generate-time, such as the link language and complete
1483 list of link libraries. Future refactoring will change the effect of
1484 the export() command to be executed at generate-time. Use ALIAS tar‐
1485 gets instead in cases where the goal is to refer to targets by another
1486 name.
1487
1488 The OLD behavior for this policy is to allow including the result of an
1489 export() command. The NEW behavior for this policy is not to allow
1490 including the result of an export() command.
1491
1492 This policy was introduced in CMake version 3.0. CMake version 3.11.4
1493 warns when the policy is not set and uses OLD behavior. Use the
1494 cmake_policy command to set it to OLD or NEW explicitly.
1495
1496 NOTE:
1497 The OLD behavior of a policy is deprecated by definition and may be
1498 removed in a future version of CMake.
1499
1501 CMP0023
1502 Plain and keyword target_link_libraries signatures cannot be mixed.
1503
1504 CMake 2.8.12 introduced the target_link_libraries signature using the
1505 PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC
1506 and LINK_PRIVATE keywords introduced in CMake 2.8.7. Use of signatures
1507 with any of these keywords sets the link interface of a target explic‐
1508 itly, even if empty. This produces confusing behavior when used in
1509 combination with the historical behavior of the plain tar‐
1510 get_link_libraries signature. For example, consider the code:
1511
1512 target_link_libraries(mylib A)
1513 target_link_libraries(mylib PRIVATE B)
1514
1515 After the first line the link interface has not been set explicitly so
1516 CMake would use the link implementation, A, as the link interface.
1517 However, the second line sets the link interface to empty. In order to
1518 avoid this subtle behavior CMake now prefers to disallow mixing the
1519 plain and keyword signatures of target_link_libraries for a single tar‐
1520 get.
1521
1522 The OLD behavior for this policy is to allow keyword and plain tar‐
1523 get_link_libraries signatures to be mixed. The NEW behavior for this
1524 policy is to not to allow mixing of the keyword and plain signatures.
1525
1526 This policy was introduced in CMake version 2.8.12. CMake version
1527 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1528 cmake_policy command to set it to OLD or NEW explicitly.
1529
1530 NOTE:
1531 The OLD behavior of a policy is deprecated by definition and may be
1532 removed in a future version of CMake.
1533
1534 CMP0022
1535 INTERFACE_LINK_LIBRARIES defines the link interface.
1536
1537 CMake 2.8.11 constructed the ‘link interface’ of a target from proper‐
1538 ties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?. The
1539 modern way to specify config-sensitive content is to use generator
1540 expressions and the IMPORTED_ prefix makes uniform processing of the
1541 link interface with generator expressions impossible. The INTER‐
1542 FACE_LINK_LIBRARIES target property was introduced as a replacement in
1543 CMake 2.8.12. This new property is named consistently with the INTER‐
1544 FACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES and INTER‐
1545 FACE_COMPILE_OPTIONS properties. For in-build targets, CMake will use
1546 the INTERFACE_LINK_LIBRARIES property as the source of the link inter‐
1547 face only if policy CMP0022 is NEW. When exporting a target which has
1548 this policy set to NEW, only the INTERFACE_LINK_LIBRARIES property will
1549 be processed and generated for the IMPORTED target by default. A new
1550 option to the install(EXPORT) and export commands allows export of the
1551 old-style properties for compatibility with downstream users of CMake
1552 versions older than 2.8.12. The target_link_libraries command will no
1553 longer populate the properties matching LINK_INTERFACE_LIBRARIES(_<CON‐
1554 FIG>)? if this policy is NEW.
1555
1556 Warning-free future-compatible code which works with CMake 2.8.7
1557 onwards can be written by using the LINK_PRIVATE and LINK_PUBLIC key‐
1558 words of target_link_libraries().
1559
1560 The OLD behavior for this policy is to ignore the INTER‐
1561 FACE_LINK_LIBRARIES property for in-build targets. The NEW behavior
1562 for this policy is to use the INTERFACE_LINK_LIBRARIES property for
1563 in-build targets, and ignore the old properties matching
1564 (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.
1565
1566 This policy was introduced in CMake version 2.8.12. CMake version
1567 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1568 cmake_policy command to set it to OLD or NEW explicitly.
1569
1570 NOTE:
1571 The OLD behavior of a policy is deprecated by definition and may be
1572 removed in a future version of CMake.
1573
1574 CMP0021
1575 Fatal error on relative paths in INCLUDE_DIRECTORIES target property.
1576
1577 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target prop‐
1578 erty to contain relative paths. The base path for such relative
1579 entries is not well defined. CMake 2.8.12 issues a FATAL_ERROR if the
1580 INCLUDE_DIRECTORIES property contains a relative path.
1581
1582 The OLD behavior for this policy is not to warn about relative paths in
1583 the INCLUDE_DIRECTORIES target property. The NEW behavior for this
1584 policy is to issue a FATAL_ERROR if INCLUDE_DIRECTORIES contains a rel‐
1585 ative path.
1586
1587 This policy was introduced in CMake version 2.8.12. CMake version
1588 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1589 cmake_policy command to set it to OLD or NEW explicitly.
1590
1591 NOTE:
1592 The OLD behavior of a policy is deprecated by definition and may be
1593 removed in a future version of CMake.
1594
1595 CMP0020
1596 Automatically link Qt executables to qtmain target on Windows.
1597
1598 CMake 2.8.10 and lower required users of Qt to always specify a link
1599 dependency to the qtmain.lib static library manually on Windows. CMake
1600 2.8.11 gained the ability to evaluate generator expressions while
1601 determining the link dependencies from IMPORTED targets. This allows
1602 CMake itself to automatically link executables which link to Qt to the
1603 qtmain.lib library when using IMPORTED Qt targets. For applications
1604 already linking to qtmain.lib, this should have little impact. For
1605 applications which supply their own alternative WinMain implementation
1606 and for applications which use the QAxServer library, this automatic
1607 linking will need to be disabled as per the documentation.
1608
1609 The OLD behavior for this policy is not to link executables to
1610 qtmain.lib automatically when they link to the QtCore IMPORTED target.
1611 The NEW behavior for this policy is to link executables to qtmain.lib
1612 automatically when they link to QtCore IMPORTED target.
1613
1614 This policy was introduced in CMake version 2.8.11. CMake version
1615 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1616 cmake_policy command to set it to OLD or NEW explicitly.
1617
1618 NOTE:
1619 The OLD behavior of a policy is deprecated by definition and may be
1620 removed in a future version of CMake.
1621
1622 CMP0019
1623 Do not re-expand variables in include and link information.
1624
1625 CMake 2.8.10 and lower re-evaluated values given to the include_direc‐
1626 tories, link_directories, and link_libraries commands to expand any
1627 leftover variable references at the end of the configuration step.
1628 This was for strict compatibility with VERY early CMake versions
1629 because all variable references are now normally evaluated during CMake
1630 language processing. CMake 2.8.11 and higher prefer to skip the extra
1631 evaluation.
1632
1633 The OLD behavior for this policy is to re-evaluate the values for
1634 strict compatibility. The NEW behavior for this policy is to leave the
1635 values untouched.
1636
1637 This policy was introduced in CMake version 2.8.11. CMake version
1638 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1639 cmake_policy command to set it to OLD or NEW explicitly.
1640
1641 NOTE:
1642 The OLD behavior of a policy is deprecated by definition and may be
1643 removed in a future version of CMake.
1644
1645 CMP0018
1646 Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
1647
1648 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries
1649 using the value of the undocumented CMAKE_SHARED_LIBRARY_<Lang>_FLAGS
1650 platform variable. The variable contained platform-specific flags
1651 needed to compile objects for shared libraries. Typically it included
1652 a flag such as -fPIC for position independent code but also included
1653 other flags needed on certain platforms. CMake 2.8.9 and higher prefer
1654 instead to use the POSITION_INDEPENDENT_CODE target property to deter‐
1655 mine what targets should be position independent, and new undocumented
1656 platform variables to select flags while ignoring
1657 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS completely.
1658
1659 The default for either approach produces identical compilation flags,
1660 but if a project modifies CMAKE_SHARED_LIBRARY_<Lang>_FLAGS from its
1661 original value this policy determines which approach to use.
1662
1663 The OLD behavior for this policy is to ignore the POSITION_INDEPEN‐
1664 DENT_CODE property for all targets and use the modified value of
1665 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS for SHARED and MODULE libraries.
1666
1667 The NEW behavior for this policy is to ignore
1668 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS whether it is modified or not and
1669 honor the POSITION_INDEPENDENT_CODE target property.
1670
1671 This policy was introduced in CMake version 2.8.9. CMake version
1672 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1673 cmake_policy command to set it to OLD or NEW explicitly.
1674
1675 NOTE:
1676 The OLD behavior of a policy is deprecated by definition and may be
1677 removed in a future version of CMake.
1678
1679 CMP0017
1680 Prefer files from the CMake module directory when including from there.
1681
1682 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e.
1683 located in the CMake module directory) calls include() or find_pack‐
1684 age(), the files located in the CMake module directory are preferred
1685 over the files in CMAKE_MODULE_PATH. This makes sure that the modules
1686 belonging to CMake always get those files included which they expect,
1687 and against which they were developed and tested. In all other cases,
1688 the files found in CMAKE_MODULE_PATH still take precedence over the
1689 ones in the CMake module directory. The OLD behavior is to always pre‐
1690 fer files from CMAKE_MODULE_PATH over files from the CMake modules
1691 directory.
1692
1693 This policy was introduced in CMake version 2.8.4. CMake version
1694 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1695 cmake_policy command to set it to OLD or NEW explicitly.
1696
1697 NOTE:
1698 The OLD behavior of a policy is deprecated by definition and may be
1699 removed in a future version of CMake.
1700
1701 CMP0016
1702 target_link_libraries() reports error if its only argument is not a
1703 target.
1704
1705 In CMake 2.8.2 and lower the target_link_libraries() command silently
1706 ignored if it was called with only one argument, and this argument
1707 wasn’t a valid target. In CMake 2.8.3 and above it reports an error in
1708 this case.
1709
1710 This policy was introduced in CMake version 2.8.3. CMake version
1711 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1712 cmake_policy command to set it to OLD or NEW explicitly.
1713
1714 NOTE:
1715 The OLD behavior of a policy is deprecated by definition and may be
1716 removed in a future version of CMake.
1717
1718 CMP0015
1719 link_directories() treats paths relative to the source dir.
1720
1721 In CMake 2.8.0 and lower the link_directories() command passed relative
1722 paths unchanged to the linker. In CMake 2.8.1 and above the
1723 link_directories() command prefers to interpret relative paths with
1724 respect to CMAKE_CURRENT_SOURCE_DIR, which is consistent with
1725 include_directories() and other commands. The OLD behavior for this
1726 policy is to use relative paths verbatim in the linker command. The
1727 NEW behavior for this policy is to convert relative paths to absolute
1728 paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR.
1729
1730 This policy was introduced in CMake version 2.8.1. CMake version
1731 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1732 cmake_policy command to set it to OLD or NEW explicitly.
1733
1734 NOTE:
1735 The OLD behavior of a policy is deprecated by definition and may be
1736 removed in a future version of CMake.
1737
1738 CMP0014
1739 Input directories must have CMakeLists.txt.
1740
1741 CMake versions before 2.8 silently ignored missing CMakeLists.txt files
1742 in directories referenced by add_subdirectory() or subdirs(), treating
1743 them as if present but empty. In CMake 2.8.0 and above this policy
1744 determines whether or not the case is an error. The OLD behavior for
1745 this policy is to silently ignore the problem. The NEW behavior for
1746 this policy is to report an error.
1747
1748 This policy was introduced in CMake version 2.8.0. CMake version
1749 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1750 cmake_policy command to set it to OLD or NEW explicitly.
1751
1752 NOTE:
1753 The OLD behavior of a policy is deprecated by definition and may be
1754 removed in a future version of CMake.
1755
1756 CMP0013
1757 Duplicate binary directories are not allowed.
1758
1759 CMake 2.6.3 and below silently permitted add_subdirectory() calls to
1760 create the same binary directory multiple times. During build system
1761 generation files would be written and then overwritten in the build
1762 tree and could lead to strange behavior. CMake 2.6.4 and above explic‐
1763 itly detect duplicate binary directories. CMake 2.6.4 always considers
1764 this case an error. In CMake 2.8.0 and above this policy determines
1765 whether or not the case is an error. The OLD behavior for this policy
1766 is to allow duplicate binary directories. The NEW behavior for this
1767 policy is to disallow duplicate binary directories with an error.
1768
1769 This policy was introduced in CMake version 2.8.0. CMake version
1770 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1771 cmake_policy command to set it to OLD or NEW explicitly.
1772
1773 NOTE:
1774 The OLD behavior of a policy is deprecated by definition and may be
1775 removed in a future version of CMake.
1776
1777 CMP0012
1778 if() recognizes numbers and boolean constants.
1779
1780 In CMake versions 2.6.4 and lower the if() command implicitly derefer‐
1781 enced arguments corresponding to variables, even those named like num‐
1782 bers or boolean constants, except for 0 and 1. Numbers and boolean
1783 constants such as true, false, yes, no, on, off, y, n, notfound, ignore
1784 (all case insensitive) were recognized in some cases but not all. For
1785 example, the code “if(TRUE)” might have evaluated as false. Numbers
1786 such as 2 were recognized only in boolean expressions like “if(NOT 2)”
1787 (leading to false) but not as a single-argument like “if(2)” (also
1788 leading to false). Later versions of CMake prefer to treat numbers and
1789 boolean constants literally, so they should not be used as variable
1790 names.
1791
1792 The OLD behavior for this policy is to implicitly dereference variables
1793 named like numbers and boolean constants. The NEW behavior for this
1794 policy is to recognize numbers and boolean constants without derefer‐
1795 encing variables with such names.
1796
1797 This policy was introduced in CMake version 2.8.0. CMake version
1798 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1799 cmake_policy command to set it to OLD or NEW explicitly.
1800
1801 NOTE:
1802 The OLD behavior of a policy is deprecated by definition and may be
1803 removed in a future version of CMake.
1804
1806 CMP0011
1807 Included scripts do automatic cmake_policy PUSH and POP.
1808
1809 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by
1810 the include() and find_package() commands would affect the includer.
1811 Explicit invocations of cmake_policy(PUSH) and cmake_policy(POP) were
1812 required to isolate policy changes and protect the includer. While
1813 some scripts intend to affect the policies of their includer, most do
1814 not. In CMake 2.6.3 and above, include() and find_package() by default
1815 PUSH and POP an entry on the policy stack around an included script,
1816 but provide a NO_POLICY_SCOPE option to disable it. This policy deter‐
1817 mines whether or not to imply NO_POLICY_SCOPE for compatibility. The
1818 OLD behavior for this policy is to imply NO_POLICY_SCOPE for include()
1819 and find_package() commands. The NEW behavior for this policy is to
1820 allow the commands to do their default cmake_policy PUSH and POP.
1821
1822 This policy was introduced in CMake version 2.6.3. CMake version
1823 3.11.4 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 CMP0010
1831 Bad variable reference syntax is an error.
1832
1833 In CMake 2.6.2 and below, incorrect variable reference syntax such as a
1834 missing close-brace (“${FOO”) was reported but did not stop processing
1835 of CMake code. This policy determines whether a bad variable reference
1836 is an error. The OLD behavior for this policy is to warn about the
1837 error, leave the string untouched, and continue. The NEW behavior for
1838 this policy is to report an error.
1839
1840 If CMP0053 is set to NEW, this policy has no effect and is treated as
1841 always being NEW.
1842
1843 This policy was introduced in CMake version 2.6.3. CMake version
1844 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1845 cmake_policy command to set it to OLD or NEW explicitly.
1846
1847 NOTE:
1848 The OLD behavior of a policy is deprecated by definition and may be
1849 removed in a future version of CMake.
1850
1851 CMP0009
1852 FILE GLOB_RECURSE calls should not follow symlinks by default.
1853
1854 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow through
1855 symlinks, sometimes coming up with unexpectedly large result sets
1856 because of symlinks to top level directories that contain hundreds of
1857 thousands of files.
1858
1859 This policy determines whether or not to follow symlinks encountered
1860 during a FILE GLOB_RECURSE call. The OLD behavior for this policy is
1861 to follow the symlinks. The NEW behavior for this policy is not to
1862 follow the symlinks by default, but only if FOLLOW_SYMLINKS is given as
1863 an additional argument to the FILE command.
1864
1865 This policy was introduced in CMake version 2.6.2. CMake version
1866 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1867 cmake_policy command to set it to OLD or NEW explicitly.
1868
1869 NOTE:
1870 The OLD behavior of a policy is deprecated by definition and may be
1871 removed in a future version of CMake.
1872
1873 CMP0008
1874 Libraries linked by full-path must have a valid library file name.
1875
1876 In CMake 2.4 and below it is possible to write code like
1877
1878 target_link_libraries(myexe /full/path/to/somelib)
1879
1880 where “somelib” is supposed to be a valid library file name such as
1881 “libsomelib.a” or “somelib.lib”. For Makefile generators this produces
1882 an error at build time because the dependency on the full path cannot
1883 be found. For VS IDE and Xcode generators this used to work by acci‐
1884 dent because CMake would always split off the library directory and ask
1885 the linker to search for the library by name (-lsomelib or
1886 somelib.lib). Despite the failure with Makefiles, some projects have
1887 code like this and build only with VS and/or Xcode. This version of
1888 CMake prefers to pass the full path directly to the native build tool,
1889 which will fail in this case because it does not name a valid library
1890 file.
1891
1892 This policy determines what to do with full paths that do not appear to
1893 name a valid library file. The OLD behavior for this policy is to
1894 split the library name from the path and ask the linker to search for
1895 it. The NEW behavior for this policy is to trust the given path and
1896 pass it directly to the native build tool unchanged.
1897
1898 This policy was introduced in CMake version 2.6.1. CMake version
1899 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1900 cmake_policy command to set it to OLD or NEW explicitly.
1901
1902 NOTE:
1903 The OLD behavior of a policy is deprecated by definition and may be
1904 removed in a future version of CMake.
1905
1906 CMP0007
1907 list command no longer ignores empty elements.
1908
1909 This policy determines whether the list command will ignore empty ele‐
1910 ments in the list. CMake 2.4 and below list commands ignored all empty
1911 elements in the list. For example, a;b;;c would have length 3 and not
1912 4. The OLD behavior for this policy is to ignore empty list elements.
1913 The NEW behavior for this policy is to correctly count empty elements
1914 in a list.
1915
1916 This policy was introduced in CMake version 2.6.0. CMake version
1917 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1918 cmake_policy command to set it to OLD or NEW explicitly.
1919
1920 NOTE:
1921 The OLD behavior of a policy is deprecated by definition and may be
1922 removed in a future version of CMake.
1923
1924 CMP0006
1925 Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
1926
1927 This policy determines whether the install(TARGETS) command must be
1928 given a BUNDLE DESTINATION when asked to install a target with the
1929 MACOSX_BUNDLE property set. CMake 2.4 and below did not distinguish
1930 application bundles from normal executables when installing targets.
1931 CMake 2.6 provides a BUNDLE option to the install(TARGETS) command that
1932 specifies rules specific to application bundles on the Mac. Projects
1933 should use this option when installing a target with the MACOSX_BUNDLE
1934 property set.
1935
1936 The OLD behavior for this policy is to fall back to the RUNTIME DESTI‐
1937 NATION if a BUNDLE DESTINATION is not given. The NEW behavior for this
1938 policy is to produce an error if a bundle target is installed without a
1939 BUNDLE DESTINATION.
1940
1941 This policy was introduced in CMake version 2.6.0. CMake version
1942 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1943 cmake_policy command to set it to OLD or NEW explicitly.
1944
1945 NOTE:
1946 The OLD behavior of a policy is deprecated by definition and may be
1947 removed in a future version of CMake.
1948
1949 CMP0005
1950 Preprocessor definition values are now escaped automatically.
1951
1952 This policy determines whether or not CMake should generate escaped
1953 preprocessor definition values added via add_definitions. CMake ver‐
1954 sions 2.4 and below assumed that only trivial values would be given for
1955 macros in add_definitions calls. It did not attempt to escape
1956 non-trivial values such as string literals in generated build rules.
1957 CMake versions 2.6 and above support escaping of most values, but can‐
1958 not assume the user has not added escapes already in an attempt to work
1959 around limitations in earlier versions.
1960
1961 The OLD behavior for this policy is to place definition values given to
1962 add_definitions directly in the generated build rules without attempt‐
1963 ing to escape anything. The NEW behavior for this policy is to gener‐
1964 ate correct escapes for all native build tools automatically. See doc‐
1965 umentation of the COMPILE_DEFINITIONS target property for limitations
1966 of the escaping implementation.
1967
1968 This policy was introduced in CMake version 2.6.0. CMake version
1969 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1970 cmake_policy command to set it to OLD or NEW explicitly.
1971
1972 NOTE:
1973 The OLD behavior of a policy is deprecated by definition and may be
1974 removed in a future version of CMake.
1975
1976 CMP0004
1977 Libraries linked may not have leading or trailing whitespace.
1978
1979 CMake versions 2.4 and below silently removed leading and trailing
1980 whitespace from libraries linked with code like
1981
1982 target_link_libraries(myexe " A ")
1983
1984 This could lead to subtle errors in user projects.
1985
1986 The OLD behavior for this policy is to silently remove leading and
1987 trailing whitespace. The NEW behavior for this policy is to diagnose
1988 the existence of such whitespace as an error. The setting for this
1989 policy used when checking the library names is that in effect when the
1990 target is created by an add_executable or add_library command.
1991
1992 This policy was introduced in CMake version 2.6.0. CMake version
1993 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
1994 cmake_policy command to set it to OLD or NEW explicitly.
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
2000 CMP0003
2001 Libraries linked via full path no longer produce linker search paths.
2002
2003 This policy affects how libraries whose full paths are NOT known are
2004 found at link time, but was created due to a change in how CMake deals
2005 with libraries whose full paths are known. Consider the code
2006
2007 target_link_libraries(myexe /path/to/libA.so)
2008
2009 CMake 2.4 and below implemented linking to libraries whose full paths
2010 are known by splitting them on the link line into separate components
2011 consisting of the linker search path and the library name. The example
2012 code might have produced something like
2013
2014 ... -L/path/to -lA ...
2015
2016 in order to link to library A. An analysis was performed to order mul‐
2017 tiple link directories such that the linker would find library A in the
2018 desired location, but there are cases in which this does not work.
2019 CMake versions 2.6 and above use the more reliable approach of passing
2020 the full path to libraries directly to the linker in most cases. The
2021 example code now produces something like
2022
2023 ... /path/to/libA.so ....
2024
2025 Unfortunately this change can break code like
2026
2027 target_link_libraries(myexe /path/to/libA.so B)
2028
2029 where “B” is meant to find “/path/to/libB.so”. This code is wrong
2030 because the user is asking the linker to find library B but has not
2031 provided a linker search path (which may be added with the link_direc‐
2032 tories command). However, with the old linking implementation the code
2033 would work accidentally because the linker search path added for
2034 library A allowed library B to be found.
2035
2036 In order to support projects depending on linker search paths added by
2037 linking to libraries with known full paths, the OLD behavior for this
2038 policy will add the linker search paths even though they are not needed
2039 for their own libraries. When this policy is set to OLD, CMake will
2040 produce a link line such as
2041
2042 ... -L/path/to /path/to/libA.so -lB ...
2043
2044 which will allow library B to be found as it was previously. When this
2045 policy is set to NEW, CMake will produce a link line such as
2046
2047 ... /path/to/libA.so -lB ...
2048
2049 which more accurately matches what the project specified.
2050
2051 The setting for this policy used when generating the link line is that
2052 in effect when the target is created by an add_executable or
2053 add_library command. For the example described above, the code
2054
2055 cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4)
2056 add_executable(myexe myexe.c)
2057 target_link_libraries(myexe /path/to/libA.so B)
2058
2059 will work and suppress the warning for this policy. It may also be
2060 updated to work with the corrected linking approach:
2061
2062 cmake_policy(SET CMP0003 NEW) # or cmake_policy(VERSION 2.6)
2063 link_directories(/path/to) # needed to find library B
2064 add_executable(myexe myexe.c)
2065 target_link_libraries(myexe /path/to/libA.so B)
2066
2067 Even better, library B may be specified with a full path:
2068
2069 add_executable(myexe myexe.c)
2070 target_link_libraries(myexe /path/to/libA.so /path/to/libB.so)
2071
2072 When all items on the link line have known paths CMake does not check
2073 this policy so it has no effect.
2074
2075 Note that the warning for this policy will be issued for at most one
2076 target. This avoids flooding users with messages for every target when
2077 setting the policy once will probably fix all targets.
2078
2079 This policy was introduced in CMake version 2.6.0. CMake version
2080 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
2081 cmake_policy command to set it to OLD or NEW explicitly.
2082
2083 NOTE:
2084 The OLD behavior of a policy is deprecated by definition and may be
2085 removed in a future version of CMake.
2086
2087 CMP0002
2088 Logical target names must be globally unique.
2089
2090 Targets names created with add_executable, add_library, or add_cus‐
2091 tom_target are logical build target names. Logical target names must
2092 be globally unique because:
2093
2094 - Unique names may be referenced unambiguously both in CMake
2095 code and on make tool command lines.
2096 - Logical names are used by Xcode and VS IDE generators
2097 to produce meaningful project names for the targets.
2098
2099 The logical name of executable and library targets does not have to
2100 correspond to the physical file names built. Consider using the OUT‐
2101 PUT_NAME target property to create two targets with the same physical
2102 name while keeping logical names distinct. Custom targets must simply
2103 have globally unique names (unless one uses the global property
2104 ALLOW_DUPLICATE_CUSTOM_TARGETS with a Makefiles generator).
2105
2106 This policy was introduced in CMake version 2.6.0. CMake version
2107 3.11.4 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 CMP0001
2115 CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
2116
2117 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present
2118 it to the user. The NEW behavior is to ignore CMAKE_BACKWARDS_COMPATI‐
2119 BILITY completely.
2120
2121 In CMake 2.4 and below the variable CMAKE_BACKWARDS_COMPATIBILITY was
2122 used to request compatibility with earlier versions of CMake. In CMake
2123 2.6 and above all compatibility issues are handled by policies and the
2124 cmake_policy command. However, CMake must still check CMAKE_BACK‐
2125 WARDS_COMPATIBILITY for projects written for CMake 2.4 and below.
2126
2127 This policy was introduced in CMake version 2.6.0. CMake version
2128 3.11.4 warns when the policy is not set and uses OLD behavior. Use the
2129 cmake_policy command to set it to OLD or NEW explicitly.
2130
2131 NOTE:
2132 The OLD behavior of a policy is deprecated by definition and may be
2133 removed in a future version of CMake.
2134
2135 CMP0000
2136 A minimum required CMake version must be specified.
2137
2138 CMake requires that projects specify the version of CMake to which they
2139 have been written. This policy has been put in place so users trying
2140 to build the project may be told when they need to update their CMake.
2141 Specifying a version also helps the project build with CMake versions
2142 newer than that specified. Use the cmake_minimum_required command at
2143 the top of your main CMakeLists.txt file:
2144
2145 cmake_minimum_required(VERSION <major>.<minor>)
2146
2147 where “<major>.<minor>” is the version of CMake you want to support
2148 (such as “2.6”). The command will ensure that at least the given ver‐
2149 sion of CMake is running and help newer versions be compatible with the
2150 project. See documentation of cmake_minimum_required for details.
2151
2152 Note that the command invocation must appear in the CMakeLists.txt file
2153 itself; a call in an included file is not sufficient. However, the
2154 cmake_policy command may be called to set policy CMP0000 to OLD or NEW
2155 behavior explicitly. The OLD behavior is to silently ignore the miss‐
2156 ing invocation. The NEW behavior is to issue an error instead of a
2157 warning. An included file may set CMP0000 explicitly to affect how
2158 this policy is enforced for the main CMakeLists.txt file.
2159
2160 This policy was introduced in CMake version 2.6.0.
2161
2162 NOTE:
2163 The OLD behavior of a policy is deprecated by definition and may be
2164 removed in a future version of CMake.
2165
2167 2000-2018 Kitware, Inc. and Contributors
2168
2169
2170
2171
21723.11.4 May 13, 2019 CMAKE-POLICIES(7)