1cmakepolicies(1) General Commands Manual cmakepolicies(1)
2
3
4
6 cmakepolicies - Reference of CMake policies.
7
8
10 The "cmake" executable is the CMake command-line interface. It may be
11 used to configure projects in scripts. Project configuration settings
12 may be specified on the command line with the -D option. The -i option
13 will cause cmake to interactively prompt for such settings.
14
15
16 CMake is a cross-platform build system generator. Projects specify
17 their build process with platform-independent CMake listfiles included
18 in each directory of a source tree with the name CMakeLists.txt. Users
19 build a project by using CMake to generate a build system for a native
20 tool on their platform.
21
22
24 CMP0000
25 A minimum required CMake version must be specified.
26
27 CMake requires that projects specify the version of CMake to
28 which they have been written. This policy has been put in place
29 so users trying to build the project may be told when they need
30 to update their CMake. Specifying a version also helps the
31 project build with CMake versions newer than that specified.
32 Use the cmake_minimum_required command at the top of your main
33 CMakeLists.txt file:
34
35
36 cmake_minimum_required(VERSION <major>.<minor>)
37
38 where "<major>.<minor>" is the version of CMake you want to sup‐
39 port (such as "2.6"). The command will ensure that at least the
40 given version of CMake is running and help newer versions be
41 compatible with the project. See documentation of cmake_mini‐
42 mum_required for details.
43
44
45 Note that the command invocation must appear in the CMake‐
46 Lists.txt file itself; a call in an included file is not suffi‐
47 cient. However, the cmake_policy command may be called to set
48 policy CMP0000 to OLD or NEW behavior explicitly. The OLD
49 behavior is to silently ignore the missing invocation. The NEW
50 behavior is to issue an error instead of a warning. An included
51 file may set CMP0000 explicitly to affect how this policy is
52 enforced for the main CMakeLists.txt file.
53
54
55 This policy was introduced in CMake version 2.6.0.
56
57
58 CMP0001
59 CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
60
61 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and
62 present it to the user. The NEW behavior is to ignore
63 CMAKE_BACKWARDS_COMPATIBILITY completely.
64
65
66 In CMake 2.4 and below the variable CMAKE_BACKWARDS_COMPATIBIL‐
67 ITY was used to request compatibility with earlier versions of
68 CMake. In CMake 2.6 and above all compatibility issues are han‐
69 dled by policies and the cmake_policy command. However, CMake
70 must still check CMAKE_BACKWARDS_COMPATIBILITY for projects
71 written for CMake 2.4 and below.
72
73
74 This policy was introduced in CMake version 2.6.0. CMake ver‐
75 sion 2.8.12.2 warns when the policy is not set and uses OLD
76 behavior. Use the cmake_policy command to set it to OLD or NEW
77 explicitly.
78
79
80 CMP0002
81 Logical target names must be globally unique.
82
83 Targets names created with add_executable, add_library, or
84 add_custom_target are logical build target names. Logical tar‐
85 get names must be globally unique because:
86
87
88 - Unique names may be referenced unambiguously both in CMake
89 code and on make tool command lines.
90 - Logical names are used by Xcode and VS IDE generators
91 to produce meaningful project names for the targets.
92
93 The logical name of executable and library targets does not have
94 to correspond to the physical file names built. Consider using
95 the OUTPUT_NAME target property to create two targets with the
96 same physical name while keeping logical names distinct. Custom
97 targets must simply have globally unique names (unless one uses
98 the global property ALLOW_DUPLICATE_CUSTOM_TARGETS with a Make‐
99 files generator).
100
101
102 This policy was introduced in CMake version 2.6.0. CMake ver‐
103 sion 2.8.12.2 warns when the policy is not set and uses OLD
104 behavior. Use the cmake_policy command to set it to OLD or NEW
105 explicitly.
106
107
108 CMP0003
109 Libraries linked via full path no longer produce linker search
110 paths.
111
112 This policy affects how libraries whose full paths are NOT known
113 are found at link time, but was created due to a change in how
114 CMake deals with libraries whose full paths are known. Consider
115 the code
116
117
118 target_link_libraries(myexe /path/to/libA.so)
119
120 CMake 2.4 and below implemented linking to libraries whose full
121 paths are known by splitting them on the link line into separate
122 components consisting of the linker search path and the library
123 name. The example code might have produced something like
124
125
126 ... -L/path/to -lA ...
127
128 in order to link to library A. An analysis was performed to
129 order multiple link directories such that the linker would find
130 library A in the desired location, but there are cases in which
131 this does not work. CMake versions 2.6 and above use the more
132 reliable approach of passing the full path to libraries directly
133 to the linker in most cases. The example code now produces
134 something like
135
136
137 ... /path/to/libA.so ....
138
139 Unfortunately this change can break code like
140
141
142 target_link_libraries(myexe /path/to/libA.so B)
143
144 where "B" is meant to find "/path/to/libB.so". This code is
145 wrong because the user is asking the linker to find library B
146 but has not provided a linker search path (which may be added
147 with the link_directories command). However, with the old link‐
148 ing implementation the code would work accidentally because the
149 linker search path added for library A allowed library B to be
150 found.
151
152
153 In order to support projects depending on linker search paths
154 added by linking to libraries with known full paths, the OLD
155 behavior for this policy will add the linker search paths even
156 though they are not needed for their own libraries. When this
157 policy is set to OLD, CMake will produce a link line such as
158
159
160 ... -L/path/to /path/to/libA.so -lB ...
161
162 which will allow library B to be found as it was previously.
163 When this policy is set to NEW, CMake will produce a link line
164 such as
165
166
167 ... /path/to/libA.so -lB ...
168
169 which more accurately matches what the project specified.
170
171
172 The setting for this policy used when generating the link line
173 is that in effect when the target is created by an add_exe‐
174 cutable or add_library command. For the example described
175 above, the code
176
177
178 cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4)
179 add_executable(myexe myexe.c)
180 target_link_libraries(myexe /path/to/libA.so B)
181
182 will work and suppress the warning for this policy. It may also
183 be updated to work with the corrected linking approach:
184
185
186 cmake_policy(SET CMP0003 NEW) # or cmake_policy(VERSION 2.6)
187 link_directories(/path/to) # needed to find library B
188 add_executable(myexe myexe.c)
189 target_link_libraries(myexe /path/to/libA.so B)
190
191 Even better, library B may be specified with a full path:
192
193
194 add_executable(myexe myexe.c)
195 target_link_libraries(myexe /path/to/libA.so /path/to/libB.so)
196
197 When all items on the link line have known paths CMake does not
198 check this policy so it has no effect.
199
200
201 Note that the warning for this policy will be issued for at most
202 one target. This avoids flooding users with messages for every
203 target when setting the policy once will probably fix all tar‐
204 gets.
205
206
207 This policy was introduced in CMake version 2.6.0. CMake ver‐
208 sion 2.8.12.2 warns when the policy is not set and uses OLD
209 behavior. Use the cmake_policy command to set it to OLD or NEW
210 explicitly.
211
212
213 CMP0004
214 Libraries linked may not have leading or trailing whitespace.
215
216 CMake versions 2.4 and below silently removed leading and trail‐
217 ing whitespace from libraries linked with code like
218
219
220 target_link_libraries(myexe " A ")
221
222 This could lead to subtle errors in user projects.
223
224
225 The OLD behavior for this policy is to silently remove leading
226 and trailing whitespace. The NEW behavior for this policy is to
227 diagnose the existence of such whitespace as an error. The set‐
228 ting for this policy used when checking the library names is
229 that in effect when the target is created by an add_executable
230 or add_library command.
231
232
233 This policy was introduced in CMake version 2.6.0. CMake ver‐
234 sion 2.8.12.2 warns when the policy is not set and uses OLD
235 behavior. Use the cmake_policy command to set it to OLD or NEW
236 explicitly.
237
238
239 CMP0005
240 Preprocessor definition values are now escaped automatically.
241
242 This policy determines whether or not CMake should generate
243 escaped preprocessor definition values added via add_defini‐
244 tions. CMake versions 2.4 and below assumed that only trivial
245 values would be given for macros in add_definitions calls. It
246 did not attempt to escape non-trivial values such as string lit‐
247 erals in generated build rules. CMake versions 2.6 and above
248 support escaping of most values, but cannot assume the user has
249 not added escapes already in an attempt to work around limita‐
250 tions in earlier versions.
251
252
253 The OLD behavior for this policy is to place definition values
254 given to add_definitions directly in the generated build rules
255 without attempting to escape anything. The NEW behavior for
256 this policy is to generate correct escapes for all native build
257 tools automatically. See documentation of the COMPILE_DEFINI‐
258 TIONS target property for limitations of the escaping implemen‐
259 tation.
260
261
262 This policy was introduced in CMake version 2.6.0. CMake ver‐
263 sion 2.8.12.2 warns when the policy is not set and uses OLD
264 behavior. Use the cmake_policy command to set it to OLD or NEW
265 explicitly.
266
267
268 CMP0006
269 Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
270
271 This policy determines whether the install(TARGETS) command must
272 be given a BUNDLE DESTINATION when asked to install a target
273 with the MACOSX_BUNDLE property set. CMake 2.4 and below did
274 not distinguish application bundles from normal executables when
275 installing targets. CMake 2.6 provides a BUNDLE option to the
276 install(TARGETS) command that specifies rules specific to appli‐
277 cation bundles on the Mac. Projects should use this option when
278 installing a target with the MACOSX_BUNDLE property set.
279
280
281 The OLD behavior for this policy is to fall back to the RUNTIME
282 DESTINATION if a BUNDLE DESTINATION is not given. The NEW
283 behavior for this policy is to produce an error if a bundle tar‐
284 get is installed without a BUNDLE DESTINATION.
285
286
287 This policy was introduced in CMake version 2.6.0. CMake ver‐
288 sion 2.8.12.2 warns when the policy is not set and uses OLD
289 behavior. Use the cmake_policy command to set it to OLD or NEW
290 explicitly.
291
292
293 CMP0007
294 list command no longer ignores empty elements.
295
296 This policy determines whether the list command will ignore
297 empty elements in the list. CMake 2.4 and below list commands
298 ignored all empty elements in the list. For example, a;b;;c
299 would have length 3 and not 4. The OLD behavior for this policy
300 is to ignore empty list elements. The NEW behavior for this pol‐
301 icy is to correctly count empty elements in a list.
302
303
304 This policy was introduced in CMake version 2.6.0. CMake ver‐
305 sion 2.8.12.2 warns when the policy is not set and uses OLD
306 behavior. Use the cmake_policy command to set it to OLD or NEW
307 explicitly.
308
309
310 CMP0008
311 Libraries linked by full-path must have a valid library file
312 name.
313
314 In CMake 2.4 and below it is possible to write code like
315
316
317 target_link_libraries(myexe /full/path/to/somelib)
318
319 where "somelib" is supposed to be a valid library file name such
320 as "libsomelib.a" or "somelib.lib". For Makefile generators
321 this produces an error at build time because the dependency on
322 the full path cannot be found. For VS IDE and Xcode generators
323 this used to work by accident because CMake would always split
324 off the library directory and ask the linker to search for the
325 library by name (-lsomelib or somelib.lib). Despite the failure
326 with Makefiles, some projects have code like this and build only
327 with VS and/or Xcode. This version of CMake prefers to pass the
328 full path directly to the native build tool, which will fail in
329 this case because it does not name a valid library file.
330
331
332 This policy determines what to do with full paths that do not
333 appear to name a valid library file. The OLD behavior for this
334 policy is to split the library name from the path and ask the
335 linker to search for it. The NEW behavior for this policy is to
336 trust the given path and pass it directly to the native build
337 tool unchanged.
338
339
340 This policy was introduced in CMake version 2.6.1. CMake ver‐
341 sion 2.8.12.2 warns when the policy is not set and uses OLD
342 behavior. Use the cmake_policy command to set it to OLD or NEW
343 explicitly.
344
345
346 CMP0009
347 FILE GLOB_RECURSE calls should not follow symlinks by default.
348
349 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow
350 through symlinks, sometimes coming up with unexpectedly large
351 result sets because of symlinks to top level directories that
352 contain hundreds of thousands of files.
353
354
355 This policy determines whether or not to follow symlinks encoun‐
356 tered during a FILE GLOB_RECURSE call. The OLD behavior for this
357 policy is to follow the symlinks. The NEW behavior for this pol‐
358 icy is not to follow the symlinks by default, but only if FOL‐
359 LOW_SYMLINKS is given as an additional argument to the FILE com‐
360 mand.
361
362
363 This policy was introduced in CMake version 2.6.2. CMake ver‐
364 sion 2.8.12.2 warns when the policy is not set and uses OLD
365 behavior. Use the cmake_policy command to set it to OLD or NEW
366 explicitly.
367
368
369 CMP0010
370 Bad variable reference syntax is an error.
371
372 In CMake 2.6.2 and below, incorrect variable reference syntax
373 such as a missing close-brace ("${FOO") was reported but did not
374 stop processing of CMake code. This policy determines whether a
375 bad variable reference is an error. The OLD behavior for this
376 policy is to warn about the error, leave the string untouched,
377 and continue. The NEW behavior for this policy is to report an
378 error.
379
380
381 This policy was introduced in CMake version 2.6.3. CMake ver‐
382 sion 2.8.12.2 warns when the policy is not set and uses OLD
383 behavior. Use the cmake_policy command to set it to OLD or NEW
384 explicitly.
385
386
387 CMP0011
388 Included scripts do automatic cmake_policy PUSH and POP.
389
390 In CMake 2.6.2 and below, CMake Policy settings in scripts
391 loaded by the include() and find_package() commands would affect
392 the includer. Explicit invocations of cmake_policy(PUSH) and
393 cmake_policy(POP) were required to isolate policy changes and
394 protect the includer. While some scripts intend to affect the
395 policies of their includer, most do not. In CMake 2.6.3 and
396 above, include() and find_package() by default PUSH and POP an
397 entry on the policy stack around an included script, but provide
398 a NO_POLICY_SCOPE option to disable it. This policy determines
399 whether or not to imply NO_POLICY_SCOPE for compatibility. The
400 OLD behavior for this policy is to imply NO_POLICY_SCOPE for
401 include() and find_package() commands. The NEW behavior for
402 this policy is to allow the commands to do their default
403 cmake_policy PUSH and POP.
404
405
406 This policy was introduced in CMake version 2.6.3. CMake ver‐
407 sion 2.8.12.2 warns when the policy is not set and uses OLD
408 behavior. Use the cmake_policy command to set it to OLD or NEW
409 explicitly.
410
411
412 CMP0012
413 if() recognizes numbers and boolean constants.
414
415 In CMake versions 2.6.4 and lower the if() command implicitly
416 dereferenced arguments corresponding to variables, even those
417 named like numbers or boolean constants, except for 0 and 1.
418 Numbers and boolean constants such as true, false, yes, no, on,
419 off, y, n, notfound, ignore (all case insensitive) were recog‐
420 nized in some cases but not all. For example, the code
421 "if(TRUE)" might have evaluated as false. Numbers such as 2
422 were recognized only in boolean expressions like "if(NOT 2)"
423 (leading to false) but not as a single-argument like "if(2)"
424 (also leading to false). Later versions of CMake prefer to treat
425 numbers and boolean constants literally, so they should not be
426 used as variable names.
427
428
429 The OLD behavior for this policy is to implicitly dereference
430 variables named like numbers and boolean constants. The NEW
431 behavior for this policy is to recognize numbers and boolean
432 constants without dereferencing variables with such names.
433
434
435 This policy was introduced in CMake version 2.8.0. CMake ver‐
436 sion 2.8.12.2 warns when the policy is not set and uses OLD
437 behavior. Use the cmake_policy command to set it to OLD or NEW
438 explicitly.
439
440
441 CMP0013
442 Duplicate binary directories are not allowed.
443
444 CMake 2.6.3 and below silently permitted add_subdirectory()
445 calls to create the same binary directory multiple times. Dur‐
446 ing build system generation files would be written and then
447 overwritten in the build tree and could lead to strange behav‐
448 ior. CMake 2.6.4 and above explicitly detect duplicate binary
449 directories. CMake 2.6.4 always considers this case an error.
450 In CMake 2.8.0 and above this policy determines whether or not
451 the case is an error. The OLD behavior for this policy is to
452 allow duplicate binary directories. The NEW behavior for this
453 policy is to disallow duplicate binary directories with an
454 error.
455
456
457 This policy was introduced in CMake version 2.8.0. CMake ver‐
458 sion 2.8.12.2 warns when the policy is not set and uses OLD
459 behavior. Use the cmake_policy command to set it to OLD or NEW
460 explicitly.
461
462
463 CMP0014
464 Input directories must have CMakeLists.txt.
465
466 CMake versions before 2.8 silently ignored missing CMake‐
467 Lists.txt files in directories referenced by add_subdirectory()
468 or subdirs(), treating them as if present but empty. In CMake
469 2.8.0 and above this policy determines whether or not the case
470 is an error. The OLD behavior for this policy is to silently
471 ignore the problem. The NEW behavior for this policy is to
472 report an error.
473
474
475 This policy was introduced in CMake version 2.8.0. CMake ver‐
476 sion 2.8.12.2 warns when the policy is not set and uses OLD
477 behavior. Use the cmake_policy command to set it to OLD or NEW
478 explicitly.
479
480
481 CMP0015
482 link_directories() treats paths relative to the source dir.
483
484 In CMake 2.8.0 and lower the link_directories() command passed
485 relative paths unchanged to the linker. In CMake 2.8.1 and
486 above the link_directories() command prefers to interpret rela‐
487 tive paths with respect to CMAKE_CURRENT_SOURCE_DIR, which is
488 consistent with include_directories() and other commands. The
489 OLD behavior for this policy is to use relative paths verbatim
490 in the linker command. The NEW behavior for this policy is to
491 convert relative paths to absolute paths by appending the rela‐
492 tive path to CMAKE_CURRENT_SOURCE_DIR.
493
494
495 This policy was introduced in CMake version 2.8.1. CMake ver‐
496 sion 2.8.12.2 warns when the policy is not set and uses OLD
497 behavior. Use the cmake_policy command to set it to OLD or NEW
498 explicitly.
499
500
501 CMP0016
502 target_link_libraries() reports error if its only argument is
503 not a target.
504
505 In CMake 2.8.2 and lower the target_link_libraries() command
506 silently ignored if it was called with only one argument, and
507 this argument wasn't a valid target. In CMake 2.8.3 and above it
508 reports an error in this case.
509
510
511 This policy was introduced in CMake version 2.8.3. CMake ver‐
512 sion 2.8.12.2 warns when the policy is not set and uses OLD
513 behavior. Use the cmake_policy command to set it to OLD or NEW
514 explicitly.
515
516
517 CMP0017
518 Prefer files from the CMake module directory when including from
519 there.
520
521 Starting with CMake 2.8.4, if a cmake-module shipped with CMake
522 (i.e. located in the CMake module directory) calls include() or
523 find_package(), the files located in the CMake module directory
524 are preferred over the files in CMAKE_MODULE_PATH. This makes
525 sure that the modules belonging to CMake always get those files
526 included which they expect, and against which they were devel‐
527 oped and tested. In all other cases, the files found in
528 CMAKE_MODULE_PATH still take precedence over the ones in the
529 CMake module directory. The OLD behaviour is to always prefer
530 files from CMAKE_MODULE_PATH over files from the CMake modules
531 directory.
532
533
534 This policy was introduced in CMake version 2.8.4. CMake ver‐
535 sion 2.8.12.2 warns when the policy is not set and uses OLD
536 behavior. Use the cmake_policy command to set it to OLD or NEW
537 explicitly.
538
539
540 CMP0018
541 Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
542
543 CMake 2.8.8 and lower compiled sources in SHARED and MODULE
544 libraries using the value of the undocumented
545 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS platform variable. The vari‐
546 able contained platform-specific flags needed to compile objects
547 for shared libraries. Typically it included a flag such as
548 -fPIC for position independent code but also included other
549 flags needed on certain platforms. CMake 2.8.9 and higher pre‐
550 fer instead to use the POSITION_INDEPENDENT_CODE target property
551 to determine what targets should be position independent, and
552 new undocumented platform variables to select flags while ignor‐
553 ing CMAKE_SHARED_LIBRARY_<Lang>_FLAGS completely.
554
555
556 The default for either approach produces identical compilation
557 flags, but if a project modifies
558 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS from its original value this
559 policy determines which approach to use.
560
561
562 The OLD behavior for this policy is to ignore the POSITION_INDE‐
563 PENDENT_CODE property for all targets and use the modified value
564 of CMAKE_SHARED_LIBRARY_<Lang>_FLAGS for SHARED and MODULE
565 libraries.
566
567
568 The NEW behavior for this policy is to ignore
569 CMAKE_SHARED_LIBRARY_<Lang>_FLAGS whether it is modified or not
570 and honor the POSITION_INDEPENDENT_CODE target property.
571
572
573 This policy was introduced in CMake version 2.8.9. CMake ver‐
574 sion 2.8.12.2 warns when the policy is not set and uses OLD
575 behavior. Use the cmake_policy command to set it to OLD or NEW
576 explicitly.
577
578
579 CMP0019
580 Do not re-expand variables in include and link information.
581
582 CMake 2.8.10 and lower re-evaluated values given to the
583 include_directories, link_directories, and link_libraries com‐
584 mands to expand any leftover variable references at the end of
585 the configuration step. This was for strict compatibility with
586 VERY early CMake versions because all variable references are
587 now normally evaluated during CMake language processing. CMake
588 2.8.11 and higher prefer to skip the extra evaluation.
589
590
591 The OLD behavior for this policy is to re-evaluate the values
592 for strict compatibility. The NEW behavior for this policy is
593 to leave the values untouched.
594
595
596 This policy was introduced in CMake version 2.8.11. CMake ver‐
597 sion 2.8.12.2 warns when the policy is not set and uses OLD
598 behavior. Use the cmake_policy command to set it to OLD or NEW
599 explicitly.
600
601
602 CMP0020
603 Automatically link Qt executables to qtmain target on Windows.
604
605 CMake 2.8.10 and lower required users of Qt to always specify a
606 link dependency to the qtmain.lib static library manually on
607 Windows. CMake 2.8.11 gained the ability to evaluate generator
608 expressions while determining the link dependencies from
609 IMPORTED targets. This allows CMake itself to automatically
610 link executables which link to Qt to the qtmain.lib library when
611 using IMPORTED Qt targets. For applications already linking to
612 qtmain.lib, this should have little impact. For applications
613 which supply their own alternative WinMain implementation and
614 for applications which use the QAxServer library, this automatic
615 linking will need to be disabled as per the documentation.
616
617
618 The OLD behavior for this policy is not to link executables to
619 qtmain.lib automatically when they link to the QtCore IMPORTED‐
620 target. The NEW behavior for this policy is to link executables
621 to qtmain.lib automatically when they link to QtCore IMPORTED
622 target.
623
624
625 This policy was introduced in CMake version 2.8.11. CMake ver‐
626 sion 2.8.12.2 warns when the policy is not set and uses OLD
627 behavior. Use the cmake_policy command to set it to OLD or NEW
628 explicitly.
629
630
631 CMP0021
632 Fatal error on relative paths in INCLUDE_DIRECTORIES target
633 property.
634
635 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target
636 property to contain relative paths. The base path for such rel‐
637 ative entries is not well defined. CMake 2.8.12 issues a
638 FATAL_ERROR if the INCLUDE_DIRECTORIES property contains a rela‐
639 tive path.
640
641
642 The OLD behavior for this policy is not to warn about relative
643 paths in the INCLUDE_DIRECTORIES target property. The NEW
644 behavior for this policy is to issue a FATAL_ERROR if
645 INCLUDE_DIRECTORIES contains a relative path.
646
647
648 This policy was introduced in CMake version 2.8.12. CMake ver‐
649 sion 2.8.12.2 warns when the policy is not set and uses OLD
650 behavior. Use the cmake_policy command to set it to OLD or NEW
651 explicitly.
652
653
654 CMP0022
655 INTERFACE_LINK_LIBRARIES defines the link interface.
656
657 CMake 2.8.11 constructed the 'link interface' of a target from
658 properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CON‐
659 FIG>)?. The modern way to specify config-sensitive content is
660 to use generator expressions and the IMPORTED_ prefix makes uni‐
661 form processing of the link interface with generator expressions
662 impossible. The INTERFACE_LINK_LIBRARIES target property was
663 introduced as a replacement in CMake 2.8.12. This new property
664 is named consistently with the INTERFACE_COMPILE_DEFINITIONS,
665 INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_OPTIONS
666 properties. For in-build targets, CMake will use the INTER‐
667 FACE_LINK_LIBRARIES property as the source of the link interface
668 only if policy CMP0022 is NEW. When exporting a target which
669 has this policy set to NEW, only the INTERFACE_LINK_LIBRARIES
670 property will be processed and generated for the IMPORTED target
671 by default. A new option to the install(EXPORT) and export com‐
672 mands allows export of the old-style properties for compatibil‐
673 ity with downstream users of CMake versions older than 2.8.12.
674 The target_link_libraries command will no longer populate the
675 properties matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this
676 policy is NEW.
677
678
679 The OLD behavior for this policy is to ignore the INTER‐
680 FACE_LINK_LIBRARIES property for in-build targets. The NEW
681 behavior for this policy is to use the INTERFACE_LINK_LIBRARIES
682 property for in-build targets, and ignore the old properties
683 matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.
684
685
686 This policy was introduced in CMake version 2.8.12. CMake ver‐
687 sion 2.8.12.2 warns when the policy is not set and uses OLD
688 behavior. Use the cmake_policy command to set it to OLD or NEW
689 explicitly.
690
691
692 CMP0023
693 Plain and keyword target_link_libraries signatures cannot be
694 mixed.
695
696 CMake 2.8.12 introduced the target_link_libraries signature
697 using the PUBLIC, PRIVATE, and INTERFACE keywords to generalize
698 the LINK_PUBLIC and LINK_PRIVATE keywords introduced in CMake
699 2.8.7. Use of signatures with any of these keywords sets the
700 link interface of a target explicitly, even if empty. This pro‐
701 duces confusing behavior when used in combination with the his‐
702 torical behavior of the plain target_link_libraries signature.
703 For example, consider the code:
704
705
706 target_link_libraries(mylib A)
707 target_link_libraries(mylib PRIVATE B)
708
709 After the first line the link interface has not been set explic‐
710 itly so CMake would use the link implementation, A, as the link
711 interface. However, the second line sets the link interface to
712 empty. In order to avoid this subtle behavior CMake now prefers
713 to disallow mixing the plain and keyword signatures of tar‐
714 get_link_libraries for a single target.
715
716
717 The OLD behavior for this policy is to allow keyword and plain
718 target_link_libraries signatures to be mixed. The NEW behavior
719 for this policy is to not to allow mixing of the keyword and
720 plain signatures.
721
722
723 This policy was introduced in CMake version 2.8.12. CMake ver‐
724 sion 2.8.12.2 warns when the policy is not set and uses OLD
725 behavior. Use the cmake_policy command to set it to OLD or NEW
726 explicitly.
727
728
730 Copyright 2000-2012 Kitware, Inc., Insight Software Consortium. All
731 rights reserved.
732
733
734 Redistribution and use in source and binary forms, with or without mod‐
735 ification, are permitted provided that the following conditions are
736 met:
737
738
739 Redistributions of source code must retain the above copyright notice,
740 this list of conditions and the following disclaimer.
741
742
743 Redistributions in binary form must reproduce the above copyright
744 notice, this list of conditions and the following disclaimer in the
745 documentation and/or other materials provided with the distribution.
746
747
748 Neither the names of Kitware, Inc., the Insight Software Consortium,
749 nor the names of their contributors may be used to endorse or promote
750 products derived from this software without specific prior written per‐
751 mission.
752
753
754 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
755 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
756 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC‐
757 ULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
758 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
759 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
760 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
761 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
762 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
763 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
764 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
765
766
768 ccmake(1), cpack(1), ctest(1), cmakecommands(1), cmakecompat(1), cmake‐
769 modules(1), cmakeprops(1), cmakevars(1)
770
771
772 The following resources are available to get help using CMake:
773
774
775 Home Page
776 http://www.cmake.org
777
778 The primary starting point for learning about CMake.
779
780
781 Frequently Asked Questions
782 http://www.cmake.org/Wiki/CMake_FAQ
783
784 A Wiki is provided containing answers to frequently asked ques‐
785 tions.
786
787
788 Online Documentation
789 http://www.cmake.org/HTML/Documentation.html
790
791 Links to available documentation may be found on this web page.
792
793
794 Mailing List
795 http://www.cmake.org/HTML/MailingLists.html
796
797 For help and discussion about using cmake, a mailing list is
798 provided at cmake@cmake.org. The list is member-post-only but
799 one may sign up on the CMake web page. Please first read the
800 full documentation at http://www.cmake.org before posting ques‐
801 tions to the list.
802
803
804
805
806cmake 2.8.12.2 November 05, 2016 cmakepolicies(1)