1CMAKE-PROPERTIES(7) CMake CMAKE-PROPERTIES(7)
2
3
4
6 cmake-properties - CMake Properties Reference
7
9 ALLOW_DUPLICATE_CUSTOM_TARGETS
10 Allow duplicate custom targets to be created.
11
12 Normally CMake requires that all targets built in a project have glob‐
13 ally unique logical names (see policy CMP0002). This is necessary to
14 generate meaningful project file names in Xcode and Visual Studio Gen‐
15 erators IDE generators. It also allows the target names to be refer‐
16 enced unambiguously.
17
18 Makefile generators are capable of supporting duplicate add_custom_tar‐
19 get() names. For projects that care only about Makefile Generators and
20 do not wish to support Xcode or Visual Studio Generators IDE genera‐
21 tors, one may set this property to True to allow duplicate custom tar‐
22 gets. The property allows multiple add_custom_target() command calls
23 in different directories to specify the same target name. However,
24 setting this property will cause non-Makefile generators to produce an
25 error and refuse to generate the project.
26
27 AUTOGEN_SOURCE_GROUP
28 New in version 3.9.
29
30
31 Name of the source_group() for AUTOMOC and AUTORCC generated files.
32
33 Files generated by AUTOMOC and AUTORCC are not always known at config‐
34 ure time and therefore can’t be passed to source_group().
35 AUTOGEN_SOURCE_GROUP an be used instead to generate or select a source
36 group for AUTOMOC and AUTORCC generated files.
37
38 For AUTOMOC and AUTORCC specific overrides see AUTOMOC_SOURCE_GROUP and
39 AUTORCC_SOURCE_GROUP respectively.
40
41 AUTOGEN_TARGETS_FOLDER
42 Name of FOLDER for *_autogen targets that are added automatically by
43 CMake for targets for which AUTOMOC is enabled.
44
45 If not set, CMake uses the FOLDER property of the parent target as a
46 default value for this property. See also the documentation for the
47 FOLDER target property and the AUTOMOC target property.
48
49 AUTOMOC_SOURCE_GROUP
50 New in version 3.9.
51
52
53 Name of the source_group() for AUTOMOC generated files.
54
55 When set this is used instead of AUTOGEN_SOURCE_GROUP for files gener‐
56 ated by AUTOMOC.
57
58 AUTOMOC_TARGETS_FOLDER
59 Name of FOLDER for *_autogen targets that are added automatically by
60 CMake for targets for which AUTOMOC is enabled.
61
62 This property is obsolete. Use AUTOGEN_TARGETS_FOLDER instead.
63
64 If not set, CMake uses the FOLDER property of the parent target as a
65 default value for this property. See also the documentation for the
66 FOLDER target property and the AUTOMOC target property.
67
68 AUTORCC_SOURCE_GROUP
69 New in version 3.9.
70
71
72 Name of the source_group() for AUTORCC generated files.
73
74 When set this is used instead of AUTOGEN_SOURCE_GROUP for files gener‐
75 ated by AUTORCC.
76
77 CMAKE_C_KNOWN_FEATURES
78 New in version 3.1.
79
80
81 List of C features known to this version of CMake.
82
83 The features listed in this global property may be known to be avail‐
84 able to the C compiler. If the feature is available with the C com‐
85 piler, it will be listed in the CMAKE_C_COMPILE_FEATURES variable.
86
87 The features listed here may be used with the target_compile_features()
88 command. See the cmake-compile-features(7) manual for information on
89 compile features and a list of supported compilers.
90
91 The features known to this version of CMake are:
92
93 c_std_90
94 Compiler mode is at least C 90.
95
96 c_std_99
97 Compiler mode is at least C 99.
98
99 c_std_11
100 Compiler mode is at least C 11.
101
102 c_function_prototypes
103 Function prototypes, as defined in ISO/IEC 9899:1990.
104
105 c_restrict
106 restrict keyword, as defined in ISO/IEC 9899:1999.
107
108 c_static_assert
109 Static assert, as defined in ISO/IEC 9899:2011.
110
111 c_variadic_macros
112 Variadic macros, as defined in ISO/IEC 9899:1999.
113
114 CMAKE_CUDA_KNOWN_FEATURES
115 New in version 3.17.
116
117
118 List of CUDA features known to this version of CMake.
119
120 The features listed in this global property may be known to be avail‐
121 able to the CUDA compiler. If the feature is available with the C++
122 compiler, it will be listed in the CMAKE_CUDA_COMPILE_FEATURES vari‐
123 able.
124
125 The features listed here may be used with the target_compile_features()
126 command. See the cmake-compile-features(7) manual for information on
127 compile features and a list of supported compilers.
128
129 The features known to this version of CMake are:
130
131 cuda_std_03
132 Compiler mode is at least CUDA/C++ 03.
133
134 cuda_std_11
135 Compiler mode is at least CUDA/C++ 11.
136
137 cuda_std_14
138 Compiler mode is at least CUDA/C++ 14.
139
140 cuda_std_17
141 Compiler mode is at least CUDA/C++ 17.
142
143 cuda_std_20
144 Compiler mode is at least CUDA/C++ 20.
145
146 CMAKE_CXX_KNOWN_FEATURES
147 New in version 3.1.
148
149
150 List of C++ features known to this version of CMake.
151
152 The features listed in this global property may be known to be avail‐
153 able to the C++ compiler. If the feature is available with the C++
154 compiler, it will be listed in the CMAKE_CXX_COMPILE_FEATURES variable.
155
156 The features listed here may be used with the target_compile_features()
157 command. See the cmake-compile-features(7) manual for information on
158 compile features and a list of supported compilers.
159
160 The features known to this version of CMake are listed below.
161
162 High level meta features indicating C++ standard support
163 The following meta features indicate general support for the associated
164 language standard. It reflects the language support claimed by the
165 compiler, but it does not necessarily imply complete conformance to
166 that standard.
167
168 cxx_std_98
169 Compiler mode is at least C++ 98.
170
171 cxx_std_11
172 Compiler mode is at least C++ 11.
173
174 cxx_std_14
175 Compiler mode is at least C++ 14.
176
177 cxx_std_17
178 Compiler mode is at least C++ 17.
179
180 cxx_std_20
181 Compiler mode is at least C++ 20.
182
183 Low level individual compile features
184 For C++ 11 and C++ 14, compilers were sometimes slow to implement cer‐
185 tain language features. CMake provided some individual compile fea‐
186 tures to help projects determine whether specific features were avail‐
187 able. These individual features are now less relevant and projects
188 should generally prefer to use the high level meta features instead.
189 Individual compile features are not provided for C++ 17 or later.
190
191 See the cmake-compile-features(7) manual for further discussion of the
192 use of individual compile features.
193
194 Individual features from C++ 98
195 cxx_template_template_parameters
196 Template template parameters, as defined in ISO/IEC 14882:1998.
197
198 Individual features from C++ 11
199 cxx_alias_templates
200 Template aliases, as defined in N2258.
201
202 cxx_alignas
203 Alignment control alignas, as defined in N2341.
204
205 cxx_alignof
206 Alignment control alignof, as defined in N2341.
207
208 cxx_attributes
209 Generic attributes, as defined in N2761.
210
211 cxx_auto_type
212 Automatic type deduction, as defined in N1984.
213
214 cxx_constexpr
215 Constant expressions, as defined in N2235.
216
217 cxx_decltype_incomplete_return_types
218 Decltype on incomplete return types, as defined in N3276.
219
220 cxx_decltype
221 Decltype, as defined in N2343.
222
223 cxx_default_function_template_args
224 Default template arguments for function templates, as defined in
225 DR226
226
227 cxx_defaulted_functions
228 Defaulted functions, as defined in N2346.
229
230 cxx_defaulted_move_initializers
231 Defaulted move initializers, as defined in N3053.
232
233 cxx_delegating_constructors
234 Delegating constructors, as defined in N1986.
235
236 cxx_deleted_functions
237 Deleted functions, as defined in N2346.
238
239 cxx_enum_forward_declarations
240 Enum forward declarations, as defined in N2764.
241
242 cxx_explicit_conversions
243 Explicit conversion operators, as defined in N2437.
244
245 cxx_extended_friend_declarations
246 Extended friend declarations, as defined in N1791.
247
248 cxx_extern_templates
249 Extern templates, as defined in N1987.
250
251 cxx_final
252 Override control final keyword, as defined in N2928, N3206 and
253 N3272.
254
255 cxx_func_identifier
256 Predefined __func__ identifier, as defined in N2340.
257
258 cxx_generalized_initializers
259 Initializer lists, as defined in N2672.
260
261 cxx_inheriting_constructors
262 Inheriting constructors, as defined in N2540.
263
264 cxx_inline_namespaces
265 Inline namespaces, as defined in N2535.
266
267 cxx_lambdas
268 Lambda functions, as defined in N2927.
269
270 cxx_local_type_template_args
271 Local and unnamed types as template arguments, as defined in
272 N2657.
273
274 cxx_long_long_type
275 long long type, as defined in N1811.
276
277 cxx_noexcept
278 Exception specifications, as defined in N3050.
279
280 cxx_nonstatic_member_init
281 Non-static data member initialization, as defined in N2756.
282
283 cxx_nullptr
284 Null pointer, as defined in N2431.
285
286 cxx_override
287 Override control override keyword, as defined in N2928, N3206
288 and N3272.
289
290 cxx_range_for
291 Range-based for, as defined in N2930.
292
293 cxx_raw_string_literals
294 Raw string literals, as defined in N2442.
295
296 cxx_reference_qualified_functions
297 Reference qualified functions, as defined in N2439.
298
299 cxx_right_angle_brackets
300 Right angle bracket parsing, as defined in N1757.
301
302 cxx_rvalue_references
303 R-value references, as defined in N2118.
304
305 cxx_sizeof_member
306 Size of non-static data members, as defined in N2253.
307
308 cxx_static_assert
309 Static assert, as defined in N1720.
310
311 cxx_strong_enums
312 Strongly typed enums, as defined in N2347.
313
314 cxx_thread_local
315 Thread-local variables, as defined in N2659.
316
317 cxx_trailing_return_types
318 Automatic function return type, as defined in N2541.
319
320 cxx_unicode_literals
321 Unicode string literals, as defined in N2442.
322
323 cxx_uniform_initialization
324 Uniform initialization, as defined in N2640.
325
326 cxx_unrestricted_unions
327 Unrestricted unions, as defined in N2544.
328
329 cxx_user_literals
330 User-defined literals, as defined in N2765.
331
332 cxx_variadic_macros
333 Variadic macros, as defined in N1653.
334
335 cxx_variadic_templates
336 Variadic templates, as defined in N2242.
337
338 Individual features from C++ 14
339 cxx_aggregate_default_initializers
340 Aggregate default initializers, as defined in N3605.
341
342 cxx_attribute_deprecated
343 [[deprecated]] attribute, as defined in N3760.
344
345 cxx_binary_literals
346 Binary literals, as defined in N3472.
347
348 cxx_contextual_conversions
349 Contextual conversions, as defined in N3323.
350
351 cxx_decltype_auto
352 decltype(auto) semantics, as defined in N3638.
353
354 cxx_digit_separators
355 Digit separators, as defined in N3781.
356
357 cxx_generic_lambdas
358 Generic lambdas, as defined in N3649.
359
360 cxx_lambda_init_captures
361 Initialized lambda captures, as defined in N3648.
362
363 cxx_relaxed_constexpr
364 Relaxed constexpr, as defined in N3652.
365
366 cxx_return_type_deduction
367 Return type deduction on normal functions, as defined in N3386.
368
369 cxx_variable_templates
370 Variable templates, as defined in N3651.
371
372 CMAKE_ROLE
373 New in version 3.14.
374
375
376 Tells what mode the current running script is in. Could be one of sev‐
377 eral values:
378
379 PROJECT
380 Running in project mode (processing a CMakeLists.txt file).
381
382 SCRIPT Running in -P script mode.
383
384 FIND_PACKAGE
385 Running in --find-package mode.
386
387 CTEST Running in CTest script mode.
388
389 CPACK Running in CPack.
390
391 DEBUG_CONFIGURATIONS
392 Specify which configurations are for debugging.
393
394 The value must be a semi-colon separated list of configuration names.
395 Currently this property is used only by the target_link_libraries()
396 command. Additional uses may be defined in the future.
397
398 This property must be set at the top level of the project and before
399 the first target_link_libraries() command invocation. If any entry in
400 the list does not match a valid configuration for the project the
401 behavior is undefined.
402
403 DISABLED_FEATURES
404 List of features which are disabled during the CMake run.
405
406 List of features which are disabled during the CMake run. By default
407 it contains the names of all packages which were not found. This is
408 determined using the <NAME>_FOUND variables. Packages which are
409 searched QUIET are not listed. A project can add its own features to
410 this list. This property is used by the macros in FeatureSum‐
411 mary.cmake.
412
413 ECLIPSE_EXTRA_CPROJECT_CONTENTS
414 New in version 3.12.
415
416
417 Additional contents to be inserted into the generated Eclipse cproject
418 file.
419
420 The cproject file defines the CDT specific information. Some third
421 party IDE’s are based on Eclipse with the addition of other information
422 specific to that IDE. Through this property, it is possible to add
423 this additional contents to the generated project. It is expected to
424 contain valid XML.
425
426 Also see the ECLIPSE_EXTRA_NATURES property.
427
428 ECLIPSE_EXTRA_NATURES
429 List of natures to add to the generated Eclipse project file.
430
431 Eclipse projects specify language plugins by using natures. This prop‐
432 erty should be set to the unique identifier for a nature (which looks
433 like a Java package name).
434
435 Also see the ECLIPSE_EXTRA_CPROJECT_CONTENTS property.
436
437 ENABLED_FEATURES
438 List of features which are enabled during the CMake run.
439
440 List of features which are enabled during the CMake run. By default it
441 contains the names of all packages which were found. This is deter‐
442 mined using the <NAME>_FOUND variables. Packages which are searched
443 QUIET are not listed. A project can add its own features to this list.
444 This property is used by the macros in FeatureSummary.cmake.
445
446 ENABLED_LANGUAGES
447 Read-only property that contains the list of currently enabled lan‐
448 guages
449
450 Set to list of currently enabled languages.
451
452 FIND_LIBRARY_USE_LIB32_PATHS
453 New in version 3.7.
454
455
456 Whether the find_library() command should automatically search lib32
457 directories.
458
459 FIND_LIBRARY_USE_LIB32_PATHS is a boolean specifying whether the
460 find_library() command should automatically search the lib32 variant of
461 directories called lib in the search path when building 32-bit bina‐
462 ries.
463
464 See also the CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX variable.
465
466 FIND_LIBRARY_USE_LIB64_PATHS
467 Whether find_library() should automatically search lib64 directories.
468
469 FIND_LIBRARY_USE_LIB64_PATHS is a boolean specifying whether the
470 find_library() command should automatically search the lib64 variant of
471 directories called lib in the search path when building 64-bit bina‐
472 ries.
473
474 See also the CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX variable.
475
476 FIND_LIBRARY_USE_LIBX32_PATHS
477 New in version 3.9.
478
479
480 Whether the find_library() command should automatically search libx32
481 directories.
482
483 FIND_LIBRARY_USE_LIBX32_PATHS is a boolean specifying whether the
484 find_library() command should automatically search the libx32 variant
485 of directories called lib in the search path when building x32-abi
486 binaries.
487
488 See also the CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX variable.
489
490 FIND_LIBRARY_USE_OPENBSD_VERSIONING
491 Whether find_library() should find OpenBSD-style shared libraries.
492
493 This property is a boolean specifying whether the find_library() com‐
494 mand should find shared libraries with OpenBSD-style versioned exten‐
495 sion: “.so.<major>.<minor>”. The property is set to true on OpenBSD
496 and false on other platforms.
497
498 GENERATOR_IS_MULTI_CONFIG
499 New in version 3.9.
500
501
502 Read-only property that is true on multi-configuration generators.
503
504 True when using a multi-configuration generator such as:
505
506 · Ninja Multi-Config
507
508 · Visual Studio Generators
509
510 · Xcode
511
512 Multi-config generators use CMAKE_CONFIGURATION_TYPES as the set of
513 configurations and ignore CMAKE_BUILD_TYPE.
514
515 GLOBAL_DEPENDS_DEBUG_MODE
516 Enable global target dependency graph debug mode.
517
518 CMake automatically analyzes the global inter-target dependency graph
519 at the beginning of native build system generation. This property
520 causes it to display details of its analysis to stderr.
521
522 GLOBAL_DEPENDS_NO_CYCLES
523 Disallow global target dependency graph cycles.
524
525 CMake automatically analyzes the global inter-target dependency graph
526 at the beginning of native build system generation. It reports an
527 error if the dependency graph contains a cycle that does not consist of
528 all STATIC library targets. This property tells CMake to disallow all
529 cycles completely, even among static libraries.
530
531 IN_TRY_COMPILE
532 Read-only property that is true during a try-compile configuration.
533
534 True when building a project inside a try_compile() or try_run() com‐
535 mand.
536
537 JOB_POOLS
538 Ninja only: List of available pools.
539
540 A pool is a named integer property and defines the maximum number of
541 concurrent jobs which can be started by a rule assigned to the pool.
542 The JOB_POOLS property is a semicolon-separated list of pairs using the
543 syntax NAME=integer (without a space after the equality sign).
544
545 For instance:
546
547 set_property(GLOBAL PROPERTY JOB_POOLS two_jobs=2 ten_jobs=10)
548
549 Defined pools could be used globally by setting CMAKE_JOB_POOL_COMPILE
550 and CMAKE_JOB_POOL_LINK or per target by setting the target properties
551 JOB_POOL_COMPILE and JOB_POOL_LINK. Custom commands and custom targets
552 can specify pools using the option JOB_POOL. Using a pool that is not
553 defined by JOB_POOLS causes an error by ninja at build time.
554
555 If not set, this property uses the value of the CMAKE_JOB_POOLS vari‐
556 able.
557
558 Build targets provided by CMake that are meant for individual interac‐
559 tive use, such as install, are placed in the console pool automati‐
560 cally.
561
562 PACKAGES_FOUND
563 List of packages which were found during the CMake run.
564
565 List of packages which were found during the CMake run. Whether a
566 package has been found is determined using the <NAME>_FOUND variables.
567
568 PACKAGES_NOT_FOUND
569 List of packages which were not found during the CMake run.
570
571 List of packages which were not found during the CMake run. Whether a
572 package has been found is determined using the <NAME>_FOUND variables.
573
574 PREDEFINED_TARGETS_FOLDER
575 Name of FOLDER for targets that are added automatically by CMake.
576
577 If not set, CMake uses “CMakePredefinedTargets” as a default value for
578 this property. Targets such as INSTALL, PACKAGE and RUN_TESTS will be
579 organized into this FOLDER. See also the documentation for the FOLDER
580 target property.
581
582 REPORT_UNDEFINED_PROPERTIES
583 If set, report any undefined properties to this file.
584
585 If this property is set to a filename then when CMake runs it will
586 report any properties or variables that were accessed but not defined
587 into the filename specified in this property.
588
589 RULE_LAUNCH_COMPILE
590 Specify a launcher for compile rules.
591
592 Makefile Generators and the Ninja generator prefix compiler commands
593 with the given launcher command line. This is intended to allow
594 launchers to intercept build problems with high granularity. Other
595 generators ignore this property because their underlying build systems
596 provide no hook to wrap individual commands with a launcher.
597
598 RULE_LAUNCH_CUSTOM
599 Specify a launcher for custom rules.
600
601 Makefile Generators and the Ninja generator prefix custom commands with
602 the given launcher command line. This is intended to allow launchers
603 to intercept build problems with high granularity. Other generators
604 ignore this property because their underlying build systems provide no
605 hook to wrap individual commands with a launcher.
606
607 RULE_LAUNCH_LINK
608 Specify a launcher for link rules.
609
610 Makefile Generators and the Ninja generator prefix link and archive
611 commands with the given launcher command line. This is intended to
612 allow launchers to intercept build problems with high granularity.
613 Other generators ignore this property because their underlying build
614 systems provide no hook to wrap individual commands with a launcher.
615
616 RULE_MESSAGES
617 Specify whether to report a message for each make rule.
618
619 This property specifies whether Makefile generators should add a
620 progress message describing what each build rule does. If the property
621 is not set the default is ON. Set the property to OFF to disable gran‐
622 ular messages and report only as each target completes. This is
623 intended to allow scripted builds to avoid the build time cost of
624 detailed reports. If a CMAKE_RULE_MESSAGES cache entry exists its
625 value initializes the value of this property. Non-Makefile generators
626 currently ignore this property.
627
628 TARGET_ARCHIVES_MAY_BE_SHARED_LIBS
629 Set if shared libraries may be named like archives.
630
631 On AIX shared libraries may be named “lib<name>.a”. This property is
632 set to true on such platforms.
633
634 TARGET_MESSAGES
635 New in version 3.4.
636
637
638 Specify whether to report the completion of each target.
639
640 This property specifies whether Makefile Generators should add a
641 progress message describing that each target has been completed. If
642 the property is not set the default is ON. Set the property to OFF to
643 disable target completion messages.
644
645 This option is intended to reduce build output when little or no work
646 needs to be done to bring the build tree up to date.
647
648 If a CMAKE_TARGET_MESSAGES cache entry exists its value initializes the
649 value of this property.
650
651 Non-Makefile generators currently ignore this property.
652
653 See the counterpart property RULE_MESSAGES to disable everything except
654 for target completion messages.
655
656 TARGET_SUPPORTS_SHARED_LIBS
657 Does the target platform support shared libraries.
658
659 TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target
660 platform supports shared libraries. Basically all current general gen‐
661 eral purpose OS do so, the exception are usually embedded systems with
662 no or special OSs.
663
664 USE_FOLDERS
665 Use the FOLDER target property to organize targets into folders.
666
667 If not set, CMake treats this property as OFF by default. CMake gener‐
668 ators that are capable of organizing into a hierarchy of folders use
669 the values of the FOLDER target property to name those folders. See
670 also the documentation for the FOLDER target property.
671
672 XCODE_EMIT_EFFECTIVE_PLATFORM_NAME
673 New in version 3.8.
674
675
676 Control emission of EFFECTIVE_PLATFORM_NAME by the Xcode generator.
677
678 It is required for building the same target with multiple SDKs. A com‐
679 mon use case is the parallel use of iphoneos and iphonesimulator SDKs.
680
681 Three different states possible that control when the Xcode generator
682 emits the EFFECTIVE_PLATFORM_NAME variable:
683
684 · If set to ON it will always be emitted
685
686 · If set to OFF it will never be emitted
687
688 · If unset (the default) it will only be emitted when the project was
689 configured for an embedded Xcode SDK like iOS, tvOS, watchOS or any
690 of the simulators.
691
692 NOTE:
693 When this behavior is enable for generated Xcode projects, the
694 EFFECTIVE_PLATFORM_NAME variable will leak into Generator expres‐
695 sions like TARGET_FILE and will render those mostly unusable.
696
698 ADDITIONAL_CLEAN_FILES
699 New in version 3.15.
700
701
702 A ;-list of files or directories that will be removed as a part of the
703 global clean target. It is useful for specifying generated files or
704 directories that are used by multiple targets or by CMake itself, or
705 that are generated in ways which cannot be captured as outputs or
706 byproducts of custom commands.
707
708 If an additional clean file is specific to a single target only, then
709 the ADDITIONAL_CLEAN_FILES target property would usually be a better
710 choice than this directory property.
711
712 Relative paths are allowed and are interpreted relative to the current
713 binary directory.
714
715 Contents of ADDITIONAL_CLEAN_FILES may use generator expressions.
716
717 This property only works for the Ninja and the Makefile generators. It
718 is ignored by other generators.
719
720 BINARY_DIR
721 New in version 3.7.
722
723
724 This read-only directory property reports absolute path to the binary
725 directory corresponding to the source on which it is read.
726
727 BUILDSYSTEM_TARGETS
728 New in version 3.7.
729
730
731 This read-only directory property contains a semicolon-separated list
732 of buildsystem targets added in the directory by calls to the
733 add_library(), add_executable(), and add_custom_target() commands. The
734 list does not include any Imported Targets or Alias Targets, but does
735 include Interface Libraries. Each entry in the list is the logical
736 name of a target, suitable to pass to the get_property() command TARGET
737 option.
738
739 CACHE_VARIABLES
740 List of cache variables available in the current directory.
741
742 This read-only property specifies the list of CMake cache variables
743 currently defined. It is intended for debugging purposes.
744
745 CLEAN_NO_CUSTOM
746 Set to true to tell Makefile Generators not to remove the outputs of
747 custom commands for this directory during the make clean operation.
748 This is ignored on other generators because it is not possible to
749 implement.
750
751 CMAKE_CONFIGURE_DEPENDS
752 Tell CMake about additional input files to the configuration process.
753 If any named file is modified the build system will re-run CMake to
754 re-configure the file and generate the build system again.
755
756 Specify files as a semicolon-separated list of paths. Relative paths
757 are interpreted as relative to the current source directory.
758
759 COMPILE_DEFINITIONS
760 Preprocessor definitions for compiling a directory’s sources.
761
762 This property specifies the list of options given so far to the
763 add_compile_definitions() (or add_definitions()) command.
764
765 The COMPILE_DEFINITIONS property may be set to a semicolon-separated
766 list of preprocessor definitions using the syntax VAR or VAR=value.
767 Function-style definitions are not supported. CMake will automatically
768 escape the value correctly for the native build system (note that CMake
769 language syntax may require escapes to specify some values).
770
771 This property will be initialized in each directory by its value in the
772 directory’s parent.
773
774 CMake will automatically drop some definitions that are not supported
775 by the native build tool.
776
777 Disclaimer: Most native build tools have poor support for escaping cer‐
778 tain values. CMake has work-arounds for many cases but some values may
779 just not be possible to pass correctly. If a value does not seem to be
780 escaped correctly, do not attempt to work-around the problem by adding
781 escape sequences to the value. Your work-around may break in a future
782 version of CMake that has improved escape support. Instead consider
783 defining the macro in a (configured) header file. Then report the lim‐
784 itation. Known limitations include:
785
786 # - broken almost everywhere
787 ; - broken in VS IDE 7.0 and Borland Makefiles
788 , - broken in VS IDE
789 % - broken in some cases in NMake
790 & | - broken in some cases on MinGW
791 ^ < > \" - broken in most Make tools on Windows
792
793 CMake does not reject these values outright because they do work in
794 some cases. Use with caution.
795
796 Contents of COMPILE_DEFINITIONS may use “generator expressions” with
797 the syntax $<...>. See the cmake-generator-expressions(7) manual for
798 available expressions. See the cmake-buildsystem(7) manual for more on
799 defining buildsystem properties.
800
801 The corresponding COMPILE_DEFINITIONS_<CONFIG> property may be set to
802 specify per-configuration definitions. Generator expressions should be
803 preferred instead of setting the alternative property.
804
805 COMPILE_OPTIONS
806 List of options to pass to the compiler.
807
808 This property holds a semicolon-separated list of options given so far
809 to the add_compile_options() command.
810
811 This property is used to initialize the COMPILE_OPTIONS target property
812 when a target is created, which is used by the generators to set the
813 options for the compiler.
814
815 Contents of COMPILE_OPTIONS may use “generator expressions” with the
816 syntax $<...>. See the cmake-generator-expressions(7) manual for
817 available expressions. See the cmake-buildsystem(7) manual for more on
818 defining buildsystem properties.
819
820 DEFINITIONS
821 For CMake 2.4 compatibility only. Use COMPILE_DEFINITIONS instead.
822
823 This read-only property specifies the list of flags given so far to the
824 add_definitions() command. It is intended for debugging purposes. Use
825 the COMPILE_DEFINITIONS directory property instead.
826
827 This built-in read-only property does not exist if policy CMP0059 is
828 set to NEW.
829
830 EXCLUDE_FROM_ALL
831 Set this directory property to a true value on a subdirectory to
832 exclude its targets from the “all” target of its ancestors. If
833 excluded, running e.g. make in the parent directory will not build tar‐
834 gets the subdirectory by default. This does not affect the “all” tar‐
835 get of the subdirectory itself. Running e.g. make inside the subdirec‐
836 tory will still build its targets.
837
838 If the EXCLUDE_FROM_ALL target property is set on a target then its
839 value determines whether the target is included in the “all” target of
840 this directory and its ancestors.
841
842 IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
843 Specify #include line transforms for dependencies in a directory.
844
845 This property specifies rules to transform macro-like #include lines
846 during implicit dependency scanning of C and C++ source files. The
847 list of rules must be semicolon-separated with each entry of the form
848 A_MACRO(%)=value-with-% (the % must be literal). During dependency
849 scanning occurrences of A_MACRO(...) on #include lines will be replaced
850 by the value given with the macro argument substituted for %. For
851 example, the entry
852
853 MYDIR(%)=<mydir/%>
854
855 will convert lines of the form
856
857 #include MYDIR(myheader.h)
858
859 to
860
861 #include <mydir/myheader.h>
862
863 allowing the dependency to be followed.
864
865 This property applies to sources in all targets within a directory.
866 The property value is initialized in each directory by its value in the
867 directory’s parent.
868
869 INCLUDE_DIRECTORIES
870 List of preprocessor include file search directories.
871
872 This property specifies the list of directories given so far to the
873 include_directories() command.
874
875 This property is used to populate the INCLUDE_DIRECTORIES target prop‐
876 erty, which is used by the generators to set the include directories
877 for the compiler.
878
879 In addition to accepting values from that command, values may be set
880 directly on any directory using the set_property() command, and can be
881 set on the current directory using the set_directory_properties() com‐
882 mand. A directory gets its initial value from its parent directory if
883 it has one. The initial value of the INCLUDE_DIRECTORIES target prop‐
884 erty comes from the value of this property. Both directory and target
885 property values are adjusted by calls to the include_directories() com‐
886 mand. Calls to set_property() or set_directory_properties(), however,
887 will update the directory property value without updating target prop‐
888 erty values. Therefore direct property updates must be made before
889 calls to add_executable() or add_library() for targets they are meant
890 to affect.
891
892 The target property values are used by the generators to set the
893 include paths for the compiler.
894
895 Contents of INCLUDE_DIRECTORIES may use “generator expressions” with
896 the syntax $<...>. See the cmake-generator-expressions(7) manual for
897 available expressions. See the cmake-buildsystem(7) manual for more on
898 defining buildsystem properties.
899
900 INCLUDE_REGULAR_EXPRESSION
901 Include file scanning regular expression.
902
903 This property specifies the regular expression used during dependency
904 scanning to match include files that should be followed. See the
905 include_regular_expression() command for a high-level interface to set
906 this property.
907
908 INTERPROCEDURAL_OPTIMIZATION
909 Enable interprocedural optimization for targets in a directory.
910
911 If set to true, enables interprocedural optimizations if they are known
912 to be supported by the compiler.
913
914 INTERPROCEDURAL_OPTIMIZATION_<CONFIG>
915 Per-configuration interprocedural optimization for a directory.
916
917 This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION.
918 If set, this property overrides the generic property for the named con‐
919 figuration.
920
921 LABELS
922 New in version 3.10.
923
924
925 Specify a list of text labels associated with a directory and all of
926 its subdirectories. This is equivalent to setting the LABELS target
927 property and the LABELS test property on all targets and tests in the
928 current directory and subdirectories. Note: Launchers must enabled to
929 propagate labels to targets.
930
931 The CMAKE_DIRECTORY_LABELS variable can be used to initialize this
932 property.
933
934 The list is reported in dashboard submissions.
935
936 LINK_DIRECTORIES
937 List of linker search directories.
938
939 This property holds a semicolon-separated list of directories and is
940 typically populated using the link_directories() command. It gets its
941 initial value from its parent directory, if it has one.
942
943 The directory property is used to initialize the LINK_DIRECTORIES tar‐
944 get property when a target is created. That target property is used by
945 the generators to set the library search directories for the linker.
946
947 Contents of LINK_DIRECTORIES may use “generator expressions” with the
948 syntax $<...>. See the cmake-generator-expressions(7) manual for
949 available expressions. See the cmake-buildsystem(7) manual for more on
950 defining buildsystem properties.
951
952 LINK_OPTIONS
953 New in version 3.13.
954
955
956 List of options to use for the link step of shared library, module and
957 executable targets as well as the device link step.
958
959 This property holds a semicolon-separated list of options given so far
960 to the add_link_options() command.
961
962 This property is used to initialize the LINK_OPTIONS target property
963 when a target is created, which is used by the generators to set the
964 options for the compiler.
965
966 Contents of LINK_OPTIONS may use “generator expressions” with the syn‐
967 tax $<...>. See the cmake-generator-expressions(7) manual for avail‐
968 able expressions. See the cmake-buildsystem(7) manual for more on
969 defining buildsystem properties.
970
971 LISTFILE_STACK
972 The current stack of listfiles being processed.
973
974 This property is mainly useful when trying to debug errors in your
975 CMake scripts. It returns a list of what list files are currently
976 being processed, in order. So if one listfile does an include() com‐
977 mand then that is effectively pushing the included listfile onto the
978 stack.
979
980 MACROS
981 List of macro commands available in the current directory.
982
983 This read-only property specifies the list of CMake macros currently
984 defined. It is intended for debugging purposes. See the macro() com‐
985 mand.
986
987 PARENT_DIRECTORY
988 Source directory that added current subdirectory.
989
990 This read-only property specifies the source directory that added the
991 current source directory as a subdirectory of the build. In the
992 top-level directory the value is the empty-string.
993
994 RULE_LAUNCH_COMPILE
995 Specify a launcher for compile rules.
996
997 See the global property of the same name for details. This overrides
998 the global property for a directory.
999
1000 RULE_LAUNCH_CUSTOM
1001 Specify a launcher for custom rules.
1002
1003 See the global property of the same name for details. This overrides
1004 the global property for a directory.
1005
1006 RULE_LAUNCH_LINK
1007 Specify a launcher for link rules.
1008
1009 See the global property of the same name for details. This overrides
1010 the global property for a directory.
1011
1012 SOURCE_DIR
1013 New in version 3.7.
1014
1015
1016 This read-only directory property reports absolute path to the source
1017 directory on which it is read.
1018
1019 SUBDIRECTORIES
1020 New in version 3.7.
1021
1022
1023 This read-only directory property contains a semicolon-separated list
1024 of subdirectories processed so far by the add_subdirectory() or sub‐
1025 dirs() commands. Each entry is the absolute path to the source direc‐
1026 tory (containing the CMakeLists.txt file). This is suitable to pass to
1027 the get_property() command DIRECTORY option.
1028
1029 NOTE:
1030 The subdirs() command does not process its arguments until after the
1031 calling directory is fully processed. Therefore looking up this
1032 property in the current directory will not see them.
1033
1034 TESTS
1035 New in version 3.12.
1036
1037
1038 List of tests.
1039
1040 This read-only property holds a semicolon-separated list of tests
1041 defined so far, in the current directory, by the add_test() command.
1042
1043 TEST_INCLUDE_FILES
1044 New in version 3.10.
1045
1046
1047 A list of cmake files that will be included when ctest is run.
1048
1049 If you specify TEST_INCLUDE_FILES, those files will be included and
1050 processed when ctest is run on the directory.
1051
1052 VARIABLES
1053 List of variables defined in the current directory.
1054
1055 This read-only property specifies the list of CMake variables currently
1056 defined. It is intended for debugging purposes.
1057
1058 VS_GLOBAL_SECTION_POST_<section>
1059 Specify a postSolution global section in Visual Studio.
1060
1061 Setting a property like this generates an entry of the following form
1062 in the solution file:
1063
1064 GlobalSection(<section>) = postSolution
1065 <contents based on property value>
1066 EndGlobalSection
1067
1068 The property must be set to a semicolon-separated list of key=value
1069 pairs. Each such pair will be transformed into an entry in the solu‐
1070 tion global section. Whitespace around key and value is ignored. List
1071 elements which do not contain an equal sign are skipped.
1072
1073 This property only works for Visual Studio 9 and above; it is ignored
1074 on other generators. The property only applies when set on a directory
1075 whose CMakeLists.txt contains a project() command.
1076
1077 Note that CMake generates postSolution sections ExtensibilityGlobals
1078 and ExtensibilityAddIns by default. If you set the corresponding prop‐
1079 erty, it will override the default section. For example, setting
1080 VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default
1081 contents of the ExtensibilityGlobals section, while keeping Extensibil‐
1082 ityAddIns on its default. However, CMake will always add a Solu‐
1083 tionGuid to the ExtensibilityGlobals section if it is not specified
1084 explicitly.
1085
1086 VS_GLOBAL_SECTION_PRE_<section>
1087 Specify a preSolution global section in Visual Studio.
1088
1089 Setting a property like this generates an entry of the following form
1090 in the solution file:
1091
1092 GlobalSection(<section>) = preSolution
1093 <contents based on property value>
1094 EndGlobalSection
1095
1096 The property must be set to a semicolon-separated list of key=value
1097 pairs. Each such pair will be transformed into an entry in the solu‐
1098 tion global section. Whitespace around key and value is ignored. List
1099 elements which do not contain an equal sign are skipped.
1100
1101 This property only works for Visual Studio 9 and above; it is ignored
1102 on other generators. The property only applies when set on a directory
1103 whose CMakeLists.txt contains a project() command.
1104
1105 VS_STARTUP_PROJECT
1106 New in version 3.6.
1107
1108
1109 Specify the default startup project in a Visual Studio solution.
1110
1111 The Visual Studio Generators create a .sln file for each directory
1112 whose CMakeLists.txt file calls the project() command. Set this prop‐
1113 erty in the same directory as a project() command call (e.g. in the
1114 top-level CMakeLists.txt file) to specify the default startup project
1115 for the corresponding solution file.
1116
1117 The property must be set to the name of an existing target. This will
1118 cause that project to be listed first in the generated solution file
1119 causing Visual Studio to make it the startup project if the solution
1120 has never been opened before.
1121
1122 If this property is not specified, then the ALL_BUILD project will be
1123 the default.
1124
1126 ADDITIONAL_CLEAN_FILES
1127 New in version 3.15.
1128
1129
1130 A ;-list of files or directories that will be removed as a part of the
1131 global clean target. It can be used to specify files and directories
1132 that are generated as part of building the target or that are directly
1133 associated with the target in some way (e.g. created as a result of
1134 running the target).
1135
1136 For custom targets, if such files can be captured as outputs or byprod‐
1137 ucts instead, then that should be preferred over adding them to this
1138 property. If an additional clean file is used by multiple targets or
1139 isn’t target-specific, then the ADDITIONAL_CLEAN_FILES directory prop‐
1140 erty may be the more appropriate property to use.
1141
1142 Relative paths are allowed and are interpreted relative to the current
1143 binary directory.
1144
1145 Contents of ADDITIONAL_CLEAN_FILES may use generator expressions.
1146
1147 This property only works for the Ninja and the Makefile generators. It
1148 is ignored by other generators.
1149
1150 AIX_EXPORT_ALL_SYMBOLS
1151 New in version 3.17.
1152
1153
1154 On AIX, CMake automatically exports all symbols from shared libraries,
1155 and from executables with the ENABLE_EXPORTS target property set.
1156 Explicitly disable this boolean property to suppress the behavior and
1157 export no symbols by default. In this case it is expected that the
1158 project will use other means to export some symbols.
1159
1160 This property is initialized by the value of the
1161 CMAKE_AIX_EXPORT_ALL_SYMBOLS variable if it is set when a target is
1162 created.
1163
1164 ALIAS_GLOBAL
1165 New in version 3.18.
1166
1167
1168 Read-only property indicating of whether an ALIAS target is globally
1169 visible.
1170
1171 The boolean value of this property is TRUE for aliases to IMPORTED tar‐
1172 gets created with the GLOBAL options to add_executable() or
1173 add_library(), FALSE otherwise. It is undefined for targets built
1174 within the project.
1175
1176 NOTE:
1177 Promoting an IMPORTED target from LOCAL to GLOBAL scope by changing
1178 the value or IMPORTED_GLOBAL target property do not change the scope
1179 of local aliases.
1180
1181 ALIASED_TARGET
1182 Name of target aliased by this target.
1183
1184 If this is an Alias Target, this property contains the name of the tar‐
1185 get aliased.
1186
1187 ANDROID_ANT_ADDITIONAL_OPTIONS
1188 New in version 3.4.
1189
1190
1191 Set the additional options for Android Ant build system. This is a
1192 string value containing all command line options for the Ant build.
1193 This property is initialized by the value of the
1194 CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS variable if it is set when a tar‐
1195 get is created.
1196
1197 ANDROID_API
1198 New in version 3.1.
1199
1200
1201 When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
1202 Edition, this property sets the Android target API version (e.g. 15).
1203 The version number must be a positive decimal integer. This property
1204 is initialized by the value of the CMAKE_ANDROID_API variable if it is
1205 set when a target is created.
1206
1207 ANDROID_API_MIN
1208 New in version 3.2.
1209
1210
1211 Set the Android MIN API version (e.g. 9). The version number must be a
1212 positive decimal integer. This property is initialized by the value of
1213 the CMAKE_ANDROID_API_MIN variable if it is set when a target is cre‐
1214 ated. Native code builds using this API version.
1215
1216 ANDROID_ARCH
1217 New in version 3.4.
1218
1219
1220 When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
1221 Edition, this property sets the Android target architecture.
1222
1223 This is a string property that could be set to the one of the following
1224 values:
1225
1226 · armv7-a: “ARMv7-A (armv7-a)”
1227
1228 · armv7-a-hard: “ARMv7-A, hard-float ABI (armv7-a)”
1229
1230 · arm64-v8a: “ARMv8-A, 64bit (arm64-v8a)”
1231
1232 · x86: “x86 (x86)”
1233
1234 · x86_64: “x86_64 (x86_64)”
1235
1236 This property is initialized by the value of the CMAKE_ANDROID_ARCH
1237 variable if it is set when a target is created.
1238
1239 ANDROID_ASSETS_DIRECTORIES
1240 New in version 3.4.
1241
1242
1243 Set the Android assets directories to copy into the main assets folder
1244 before build. This a string property that contains the directory paths
1245 separated by semicolon. This property is initialized by the value of
1246 the CMAKE_ANDROID_ASSETS_DIRECTORIES variable if it is set when a tar‐
1247 get is created.
1248
1249 ANDROID_GUI
1250 New in version 3.1.
1251
1252
1253 When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
1254 Edition, this property specifies whether to build an executable as an
1255 application package on Android.
1256
1257 When this property is set to true the executable when built for Android
1258 will be created as an application package. This property is initial‐
1259 ized by the value of the CMAKE_ANDROID_GUI variable if it is set when a
1260 target is created.
1261
1262 Add the AndroidManifest.xml source file explicitly to the target
1263 add_executable() command invocation to specify the root directory of
1264 the application package source.
1265
1266 ANDROID_JAR_DEPENDENCIES
1267 New in version 3.4.
1268
1269
1270 Set the Android property that specifies JAR dependencies. This is a
1271 string value property. This property is initialized by the value of the
1272 CMAKE_ANDROID_JAR_DEPENDENCIES variable if it is set when a target is
1273 created.
1274
1275 ANDROID_JAR_DIRECTORIES
1276 New in version 3.4.
1277
1278
1279 Set the Android property that specifies directories to search for the
1280 JAR libraries.
1281
1282 This a string property that contains the directory paths separated by
1283 semicolons. This property is initialized by the value of the
1284 CMAKE_ANDROID_JAR_DIRECTORIES variable if it is set when a target is
1285 created.
1286
1287 Contents of ANDROID_JAR_DIRECTORIES may use “generator expressions”
1288 with the syntax $<...>. See the cmake-generator-expressions(7) manual
1289 for available expressions.
1290
1291 ANDROID_JAVA_SOURCE_DIR
1292 New in version 3.4.
1293
1294
1295 Set the Android property that defines the Java source code root direc‐
1296 tories. This a string property that contains the directory paths sepa‐
1297 rated by semicolon. This property is initialized by the value of the
1298 CMAKE_ANDROID_JAVA_SOURCE_DIR variable if it is set when a target is
1299 created.
1300
1301 ANDROID_NATIVE_LIB_DEPENDENCIES
1302 New in version 3.4.
1303
1304
1305 Set the Android property that specifies the .so dependencies. This is
1306 a string property.
1307
1308 This property is initialized by the value of the
1309 CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES variable if it is set when a tar‐
1310 get is created.
1311
1312 Contents of ANDROID_NATIVE_LIB_DEPENDENCIES may use “generator expres‐
1313 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
1314 manual for available expressions.
1315
1316 ANDROID_NATIVE_LIB_DIRECTORIES
1317 New in version 3.4.
1318
1319
1320 Set the Android property that specifies directories to search for the
1321 .so libraries.
1322
1323 This a string property that contains the directory paths separated by
1324 semicolons.
1325
1326 This property is initialized by the value of the
1327 CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES variable if it is set when a tar‐
1328 get is created.
1329
1330 Contents of ANDROID_NATIVE_LIB_DIRECTORIES may use “generator expres‐
1331 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
1332 manual for available expressions.
1333
1334 ANDROID_PROCESS_MAX
1335 New in version 3.4.
1336
1337
1338 Set the Android property that defines the maximum number of a parallel
1339 Android NDK compiler processes (e.g. 4). This property is initialized
1340 by the value of the CMAKE_ANDROID_PROCESS_MAX variable if it is set
1341 when a target is created.
1342
1343 ANDROID_PROGUARD
1344 New in version 3.4.
1345
1346
1347 When this property is set to true that enables the ProGuard tool to
1348 shrink, optimize, and obfuscate the code by removing unused code and
1349 renaming classes, fields, and methods with semantically obscure names.
1350 This property is initialized by the value of the CMAKE_ANDROID_PROGUARD
1351 variable if it is set when a target is created.
1352
1353 ANDROID_PROGUARD_CONFIG_PATH
1354 New in version 3.4.
1355
1356
1357 Set the Android property that specifies the location of the ProGuard
1358 config file. Leave empty to use the default one. This a string prop‐
1359 erty that contains the path to ProGuard config file. This property is
1360 initialized by the value of the CMAKE_ANDROID_PROGUARD_CONFIG_PATH
1361 variable if it is set when a target is created.
1362
1363 ANDROID_SECURE_PROPS_PATH
1364 New in version 3.4.
1365
1366
1367 Set the Android property that states the location of the secure proper‐
1368 ties file. This is a string property that contains the file path.
1369 This property is initialized by the value of the
1370 CMAKE_ANDROID_SECURE_PROPS_PATH variable if it is set when a target is
1371 created.
1372
1373 ANDROID_SKIP_ANT_STEP
1374 New in version 3.4.
1375
1376
1377 Set the Android property that defines whether or not to skip the Ant
1378 build step. This is a boolean property initialized by the value of the
1379 CMAKE_ANDROID_SKIP_ANT_STEP variable if it is set when a target is cre‐
1380 ated.
1381
1382 ANDROID_STL_TYPE
1383 New in version 3.4.
1384
1385
1386 When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
1387 Edition, this property specifies the type of STL support for the
1388 project. This is a string property that could set to the one of the
1389 following values:
1390
1391 none No C++ Support
1392
1393 system Minimal C++ without STL
1394
1395 gabi++_static
1396 GAbi++ Static
1397
1398 gabi++_shared
1399 GAbi++ Shared
1400
1401 gnustl_static
1402 GNU libstdc++ Static
1403
1404 gnustl_shared
1405 GNU libstdc++ Shared
1406
1407 stlport_static
1408 STLport Static
1409
1410 stlport_shared
1411 STLport Shared
1412
1413 This property is initialized by the value of the CMAKE_ANDROID_STL_TYPE
1414 variable if it is set when a target is created.
1415
1416 ARCHIVE_OUTPUT_DIRECTORY
1417 Output directory in which to build ARCHIVE target files.
1418
1419 This property specifies the directory into which archive target files
1420 should be built. The property value may use generator expressions.
1421 Multi-configuration generators (VS, Xcode) append a per-configuration
1422 subdirectory to the specified directory unless a generator expression
1423 is used.
1424
1425 This property is initialized by the value of the variable CMAKE_AR‐
1426 CHIVE_OUTPUT_DIRECTORY if it is set when a target is created.
1427
1428 See also the ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> target property.
1429
1430 ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
1431 Per-configuration output directory for ARCHIVE target files.
1432
1433 This is a per-configuration version of the ARCHIVE_OUTPUT_DIRECTORY
1434 target property, but multi-configuration generators (VS, Xcode) do NOT
1435 append a per-configuration subdirectory to the specified directory.
1436 This property is initialized by the value of the CMAKE_ARCHIVE_OUT‐
1437 PUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.
1438
1439 Contents of ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> may use generator expres‐
1440 sions.
1441
1442 ARCHIVE_OUTPUT_NAME
1443 Output name for ARCHIVE target files.
1444
1445 This property specifies the base name for archive target files. It
1446 overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties.
1447
1448 See also the ARCHIVE_OUTPUT_NAME_<CONFIG> target property.
1449
1450 ARCHIVE_OUTPUT_NAME_<CONFIG>
1451 Per-configuration output name for ARCHIVE target files.
1452
1453 This is the configuration-specific version of the ARCHIVE_OUTPUT_NAME
1454 target property.
1455
1456 AUTOGEN_BUILD_DIR
1457 New in version 3.9.
1458
1459
1460 Directory where AUTOMOC, AUTOUIC and AUTORCC generate files for the
1461 target.
1462
1463 The directory is created on demand and automatically added to the ADDI‐
1464 TIONAL_CLEAN_FILES target property.
1465
1466 When unset or empty the directory <dir>/<target-name>_autogen is used
1467 where <dir> is CMAKE_CURRENT_BINARY_DIR and <target-name> is NAME.
1468
1469 By default AUTOGEN_BUILD_DIR is unset.
1470
1471 See the cmake-qt(7) manual for more information on using CMake with Qt.
1472
1473 AUTOGEN_ORIGIN_DEPENDS
1474 New in version 3.14.
1475
1476
1477 Switch for forwarding origin target dependencies to the corresponding
1478 _autogen target.
1479
1480 Targets which have their AUTOMOC or AUTOUIC property ON have a corre‐
1481 sponding _autogen target which generates moc and uic files. As this
1482 _autogen target is created at generate-time, it is not possible to
1483 define dependencies of it using e.g. add_dependencies(). Instead the
1484 AUTOGEN_ORIGIN_DEPENDS target property decides whether the origin tar‐
1485 get dependencies should be forwarded to the _autogen target or not.
1486
1487 By default AUTOGEN_ORIGIN_DEPENDS is initialized from CMAKE_AUTO‐
1488 GEN_ORIGIN_DEPENDS which is ON by default.
1489
1490 In total the dependencies of the _autogen target are composed from
1491
1492 · forwarded origin target dependencies (enabled by default via
1493 AUTOGEN_ORIGIN_DEPENDS)
1494
1495 · additional user defined dependencies from AUTOGEN_TARGET_DEPENDS
1496
1497 See the cmake-qt(7) manual for more information on using CMake with Qt.
1498
1499 Note
1500 Disabling AUTOGEN_ORIGIN_DEPENDS is useful to avoid building of origin
1501 target dependencies when building the _autogen target only. This is
1502 especially interesting when a global autogen target is enabled.
1503
1504 When the _autogen target doesn’t require all the origin target’s depen‐
1505 dencies, and AUTOGEN_ORIGIN_DEPENDS is disabled, it might be necessary
1506 to extend AUTOGEN_TARGET_DEPENDS to add missing dependencies.
1507
1508 AUTOGEN_PARALLEL
1509 New in version 3.11.
1510
1511
1512 Number of parallel moc or uic processes to start when using AUTOMOC and
1513 AUTOUIC.
1514
1515 The custom <origin>_autogen target starts a number of threads of which
1516 each one parses a source file and on demand starts a moc or uic
1517 process. AUTOGEN_PARALLEL controls how many parallel threads (and
1518 therefore moc or uic processes) are started.
1519
1520 · An empty (or unset) value or the string AUTO sets the number of
1521 threads/processes to the number of physical CPUs on the host system.
1522
1523 · A positive non zero integer value sets the exact thread/process
1524 count.
1525
1526 · Otherwise a single thread/process is started.
1527
1528 By default AUTOGEN_PARALLEL is initialized from CMAKE_AUTOGEN_PARALLEL.
1529
1530 See the cmake-qt(7) manual for more information on using CMake with Qt.
1531
1532 AUTOGEN_TARGET_DEPENDS
1533 Additional target dependencies of the corresponding _autogen target.
1534
1535 Targets which have their AUTOMOC or AUTOUIC property ON have a corre‐
1536 sponding _autogen target which generates moc and uic files. As this
1537 _autogen target is created at generate-time, it is not possible to
1538 define dependencies of it using e.g. add_dependencies(). Instead the
1539 AUTOGEN_TARGET_DEPENDS target property can be set to a ;-list of addi‐
1540 tional dependencies for the _autogen target. Dependencies can be tar‐
1541 get names or file names.
1542
1543 In total the dependencies of the _autogen target are composed from
1544
1545 · forwarded origin target dependencies (enabled by default via AUTO‐
1546 GEN_ORIGIN_DEPENDS)
1547
1548 · additional user defined dependencies from AUTOGEN_TARGET_DEPENDS
1549
1550 See the cmake-qt(7) manual for more information on using CMake with Qt.
1551
1552 Use cases
1553 If AUTOMOC or AUTOUIC depends on a file that is either
1554
1555 · a GENERATED non C++ file (e.g. a GENERATED .json or .ui file) or
1556
1557 · a GENERATED C++ file that isn’t recognized by AUTOMOC and AUTOUIC
1558 because it’s skipped by SKIP_AUTOMOC, SKIP_AUTOUIC, SKIP_AUTOGEN or
1559 CMP0071 or
1560
1561 · a file that isn’t in the origin target’s sources
1562
1563 it must be added to AUTOGEN_TARGET_DEPENDS.
1564
1565 AUTOMOC
1566 Should the target be processed with auto-moc (for Qt projects).
1567
1568 AUTOMOC is a boolean specifying whether CMake will handle the Qt moc
1569 preprocessor automatically, i.e. without having to use the
1570 QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are sup‐
1571 ported.
1572
1573 This property is initialized by the value of the CMAKE_AUTOMOC variable
1574 if it is set when a target is created.
1575
1576 When this property is set ON, CMake will scan the header and source
1577 files at build time and invoke moc accordingly.
1578
1579 Header file processing
1580 At configuration time, a list of header files that should be scanned by
1581 AUTOMOC is computed from the target’s sources.
1582
1583 · All header files in the target’s sources are added to the scan list.
1584
1585 · For all C++ source files <source_base>.<source_extension> in the tar‐
1586 get’s sources, CMake searches for
1587
1588 · a regular header with the same base name
1589 (<source_base>.<header_extention>) and
1590
1591 · a private header with the same base name and a _p suffix
1592 (<source_base>_p.<header_extention>)
1593
1594 and adds these to the scan list.
1595
1596 At build time, CMake scans each unknown or modified header file from
1597 the list and searches for
1598
1599 · a Qt macro from AUTOMOC_MACRO_NAMES,
1600
1601 · additional file dependencies from the FILE argument of a Q_PLUG‐
1602 IN_METADATA macro and
1603
1604 · additional file dependencies detected by filters defined in AUTO‐
1605 MOC_DEPEND_FILTERS.
1606
1607 If a Qt macro is found, then the header will be compiled by the moc to
1608 the output file moc_<base_name>.cpp. The complete output file path is
1609 described in the section Output file location.
1610
1611 The header will be moc compiled again if a file from the additional
1612 file dependencies changes.
1613
1614 Header moc output files moc_<base_name>.cpp can be included in source
1615 files. In the section Including header moc files in sources there is
1616 more information on that topic.
1617
1618 Source file processing
1619 At build time, CMake scans each unknown or modified C++ source file
1620 from the target’s sources for
1621
1622 · a Qt macro from AUTOMOC_MACRO_NAMES,
1623
1624 · includes of header moc files (see Including header moc files in
1625 sources),
1626
1627 · additional file dependencies from the FILE argument of a Q_PLUG‐
1628 IN_METADATA macro and
1629
1630 · additional file dependencies detected by filters defined in AUTO‐
1631 MOC_DEPEND_FILTERS.
1632
1633 If a Qt macro is found, then the C++ source file <base>.<source_exten‐
1634 sion> is expected to as well contain an include statement
1635
1636 #include <<base>.moc> // or
1637 #include "<base>.moc"
1638
1639 The source file then will be compiled by the moc to the output file
1640 <base>.moc. A description of the complete output file path is in sec‐
1641 tion Output file location.
1642
1643 The source will be moc compiled again if a file from the additional
1644 file dependencies changes.
1645
1646 Including header moc files in sources
1647 A source file can include the moc output file of a header
1648 <header_base>.<header_extension> by using an include statement of the
1649 form
1650
1651 #include <moc_<header_base>.cpp> // or
1652 #include "moc_<header_base>.cpp"
1653
1654 If the moc output file of a header is included by a source, it will be
1655 generated in a different location than if it was not included. This is
1656 described in the section Output file location.
1657
1658 Output file location
1659 Included moc output files
1660 moc output files that are included by a source file will be generated
1661 in
1662
1663 · <AUTOGEN_BUILD_DIR>/include for single configuration generators or in
1664
1665 · <AUTOGEN_BUILD_DIR>/include_<CONFIG> for multi configuration genera‐
1666 tors.
1667
1668 Where <AUTOGEN_BUILD_DIR> is the value of the target property AUTO‐
1669 GEN_BUILD_DIR.
1670
1671 The include directory is automatically added to the target’s
1672 INCLUDE_DIRECTORIES.
1673
1674 Not included moc output files
1675 moc output files that are not included in a source file will be gener‐
1676 ated in
1677
1678 · <AUTOGEN_BUILD_DIR>/<SOURCE_DIR_CHECKSUM> for single configuration
1679 generators or in,
1680
1681 · <AUTOGEN_BUILD_DIR>/include_<CONFIG>/<SOURCE_DIR_CHECKSUM> for multi
1682 configuration generators.
1683
1684 Where <SOURCE_DIR_CHECKSUM> is a checksum computed from the relative
1685 parent directory path of the moc input file. This scheme allows to
1686 have moc input files with the same name in different directories.
1687
1688 All not included moc output files will be included automatically by the
1689 CMake generated file
1690
1691 · <AUTOGEN_BUILD_DIR>/mocs_compilation.cpp,
1692
1693 which is added to the target’s sources.
1694
1695 Qt version detection
1696 AUTOMOC enabled targets need to know the Qt major and minor version
1697 they’re working with. The major version usually is provided by the
1698 INTERFACE_QT_MAJOR_VERSION property of the Qt[45]Core library, that the
1699 target links to. To find the minor version, CMake builds a list of
1700 available Qt versions from
1701
1702 · Qt5Core_VERSION_MAJOR and Qt5Core_VERSION_MINOR variables (usually
1703 set by find_package(Qt5...))
1704
1705 · Qt5Core_VERSION_MAJOR and Qt5Core_VERSION_MINOR directory properties
1706
1707 · QT_VERSION_MAJOR and QT_VERSION_MINOR variables (usually set by
1708 find_package(Qt4...))
1709
1710 · QT_VERSION_MAJOR and QT_VERSION_MINOR directory properties
1711
1712 in the context of the add_executable() or add_library() call.
1713
1714 Assumed INTERFACE_QT_MAJOR_VERSION is a valid number, the first entry
1715 in the list with a matching major version is taken. If no matching
1716 major version was found, an error is generated. If INTER‐
1717 FACE_QT_MAJOR_VERSION is not a valid number, the first entry in the
1718 list is taken.
1719
1720 A find_package(Qt[45]...) call sets the QT/Qt5Core_VERSION_MAJOR/MINOR
1721 variables. If the call is in a different context than the add_exe‐
1722 cutable() or add_library() call, e.g. in a function, then the version
1723 variables might not be available to the AUTOMOC enabled target. In
1724 that case the version variables can be forwarded from the find_pack‐
1725 age(Qt[45]...) calling context to the add_executable() or add_library()
1726 calling context as directory properties. The following Qt5 example
1727 demonstrates the procedure.
1728
1729 function (add_qt5_client)
1730 find_package(Qt5 REQUIRED QUIET COMPONENTS Core Widgets)
1731 ...
1732 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
1733 PROPERTY Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}")
1734 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
1735 PROPERTY Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MAJOR}")
1736 ...
1737 endfunction ()
1738 ...
1739 add_qt5_client()
1740 add_executable(myTarget main.cpp)
1741 target_link_libraries(myTarget Qt5::QtWidgets)
1742 set_property(TARGET myTarget PROPERTY AUTOMOC ON)
1743
1744 Modifiers
1745 AUTOMOC_EXECUTABLE: The moc executable will be detected automatically,
1746 but can be forced to a certain binary using this target property.
1747
1748 AUTOMOC_MOC_OPTIONS: Additional command line options for moc can be set
1749 in this target property.
1750
1751 AUTOMOC_MACRO_NAMES: This list of Qt macro names can be extended to
1752 search for additional macros in headers and sources.
1753
1754 AUTOMOC_DEPEND_FILTERS: moc dependency file names can be extracted from
1755 headers or sources by defining file name filters in this target prop‐
1756 erty.
1757
1758 AUTOMOC_COMPILER_PREDEFINES: Compiler pre definitions for moc are writ‐
1759 ten to the moc_predefs.h file. The generation of this file can be
1760 enabled or disabled in this target property.
1761
1762 SKIP_AUTOMOC: Sources and headers can be excluded from AUTOMOC process‐
1763 ing by setting this source file property.
1764
1765 SKIP_AUTOGEN: Source files can be excluded from AUTOMOC, AUTOUIC and
1766 AUTORCC processing by setting this source file property.
1767
1768 AUTOGEN_SOURCE_GROUP: This global property can be used to group files
1769 generated by AUTOMOC or AUTORCC together in an IDE, e.g. in MSVS.
1770
1771 AUTOGEN_TARGETS_FOLDER: This global property can be used to group
1772 AUTOMOC, AUTOUIC and AUTORCC targets together in an IDE, e.g. in MSVS.
1773
1774 CMAKE_GLOBAL_AUTOGEN_TARGET: A global autogen target, that depends on
1775 all AUTOMOC or AUTOUIC generated <ORIGIN>_autogen targets in the
1776 project, will be generated when this variable is ON.
1777
1778 AUTOGEN_PARALLEL: This target property controls the number of moc or
1779 uic processes to start in parallel during builds.
1780
1781 See the cmake-qt(7) manual for more information on using CMake with Qt.
1782
1783 AUTOMOC_COMPILER_PREDEFINES
1784 New in version 3.10.
1785
1786
1787 Boolean value used by AUTOMOC to determine if the compiler pre defini‐
1788 tions file moc_predefs.h should be generated.
1789
1790 CMake generates a moc_predefs.h file with compiler pre definitions from
1791 the output of the command defined in CMAKE_CXX_COMPILER_PREDEFINES_COM‐
1792 MAND when
1793
1794 · AUTOMOC is enabled,
1795
1796 · AUTOMOC_COMPILER_PREDEFINES is enabled,
1797
1798 · CMAKE_CXX_COMPILER_PREDEFINES_COMMAND isn’t empty and
1799
1800 · the Qt version is greater or equal 5.8.
1801
1802 The moc_predefs.h file, which is generated in AUTOGEN_BUILD_DIR, is
1803 passed to moc as the argument to the --include option.
1804
1805 By default AUTOMOC_COMPILER_PREDEFINES is initialized from CMAKE_AUTO‐
1806 MOC_COMPILER_PREDEFINES, which is ON by default.
1807
1808 See the cmake-qt(7) manual for more information on using CMake with Qt.
1809
1810 AUTOMOC_DEPEND_FILTERS
1811 New in version 3.9.
1812
1813
1814 Filter definitions used by AUTOMOC to extract file names from a source
1815 file that are registered as additional dependencies for the moc file of
1816 the source file.
1817
1818 Filters are defined as KEYWORD;REGULAR_EXPRESSION pairs. First the file
1819 content is searched for KEYWORD. If it is found at least once, then
1820 file names are extracted by successively searching for REGULAR_EXPRES‐
1821 SION and taking the first match group.
1822
1823 The file name found in the first match group is searched for
1824
1825 · first in the vicinity of the source file
1826
1827 · and afterwards in the target’s INCLUDE_DIRECTORIES.
1828
1829 If any of the extracted files changes, then the moc file for the source
1830 file gets rebuilt even when the source file itself doesn’t change.
1831
1832 If any of the extracted files is GENERATED or if it is not in the tar‐
1833 get’s sources, then it might be necessary to add it to the _autogen
1834 target dependencies. See AUTOGEN_TARGET_DEPENDS for reference.
1835
1836 By default AUTOMOC_DEPEND_FILTERS is initialized from CMAKE_AUTO‐
1837 MOC_DEPEND_FILTERS, which is empty by default.
1838
1839 From Qt 5.15.0 on this variable is ignored as moc is able to output the
1840 correct dependencies.
1841
1842 See the cmake-qt(7) manual for more information on using CMake with Qt.
1843
1844 Example 1
1845 A header file my_class.hpp uses a custom macro JSON_FILE_MACRO which is
1846 defined in an other header macros.hpp. We want the moc file of
1847 my_class.hpp to depend on the file name argument of JSON_FILE_MACRO:
1848
1849 // my_class.hpp
1850 class My_Class : public QObject
1851 {
1852 Q_OBJECT
1853 JSON_FILE_MACRO ( "info.json" )
1854 ...
1855 };
1856
1857 In CMakeLists.txt we add a filter to CMAKE_AUTOMOC_DEPEND_FILTERS like
1858 this:
1859
1860 list( APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
1861 "JSON_FILE_MACRO"
1862 "[\n][ \t]*JSON_FILE_MACRO[ \t]*\\([ \t]*\"([^\"]+)\""
1863 )
1864
1865 We assume info.json is a plain (not GENERATED) file that is listed in
1866 the target’s source. Therefore we do not need to add it to AUTO‐
1867 GEN_TARGET_DEPENDS.
1868
1869 Example 2
1870 In the target my_target a header file complex_class.hpp uses a custom
1871 macro JSON_BASED_CLASS which is defined in an other header macros.hpp:
1872
1873 // macros.hpp
1874 ...
1875 #define JSON_BASED_CLASS(name, json) \
1876 class name : public QObject \
1877 { \
1878 Q_OBJECT \
1879 Q_PLUGIN_METADATA(IID "demo" FILE json) \
1880 name() {} \
1881 };
1882 ...
1883
1884 // complex_class.hpp
1885 #pragma once
1886 JSON_BASED_CLASS(Complex_Class, "meta.json")
1887 // end of file
1888
1889 Since complex_class.hpp doesn’t contain a Q_OBJECT macro it would be
1890 ignored by AUTOMOC. We change this by adding JSON_BASED_CLASS to
1891 CMAKE_AUTOMOC_MACRO_NAMES:
1892
1893 list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "JSON_BASED_CLASS")
1894
1895 We want the moc file of complex_class.hpp to depend on meta.json. So
1896 we add a filter to CMAKE_AUTOMOC_DEPEND_FILTERS:
1897
1898 list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
1899 "JSON_BASED_CLASS"
1900 "[\n^][ \t]*JSON_BASED_CLASS[ \t]*\\([^,]*,[ \t]*\"([^\"]+)\""
1901 )
1902
1903 Additionally we assume meta.json is GENERATED which is why we have to
1904 add it to AUTOGEN_TARGET_DEPENDS:
1905
1906 set_property(TARGET my_target APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "meta.json")
1907
1908 AUTOMOC_EXECUTABLE
1909 New in version 3.14.
1910
1911
1912 AUTOMOC_EXECUTABLE is file path pointing to the moc executable to use
1913 for AUTOMOC enabled files. Setting this property will make CMake skip
1914 the automatic detection of the moc binary as well as the sanity-tests
1915 normally run to ensure that the binary is available and working as
1916 expected.
1917
1918 Usually this property does not need to be set. Only consider this prop‐
1919 erty if auto-detection of moc can not work – e.g. because you are
1920 building the moc binary as part of your project.
1921
1922 See the cmake-qt(7) manual for more information on using CMake with Qt.
1923
1924 AUTOMOC_MACRO_NAMES
1925 New in version 3.10.
1926
1927
1928 A semicolon-separated list list of macro names used by AUTOMOC to
1929 determine if a C++ file needs to be processed by moc.
1930
1931 This property is only used if the AUTOMOC property is ON for this tar‐
1932 get.
1933
1934 When running AUTOMOC, CMake searches for the strings listed in
1935 AUTOMOC_MACRO_NAMES in C++ source and header files. If any of the
1936 strings is found
1937
1938 · as the first non space string on a new line or
1939
1940 · as the first non space string after a { on a new line,
1941
1942 then the file will be processed by moc.
1943
1944 By default AUTOMOC_MACRO_NAMES is initialized from CMAKE_AUTO‐
1945 MOC_MACRO_NAMES.
1946
1947 See the cmake-qt(7) manual for more information on using CMake with Qt.
1948
1949 Example
1950 In this case the Q_OBJECT macro is hidden inside another macro called
1951 CUSTOM_MACRO. To let CMake know that source files that contain CUS‐
1952 TOM_MACRO need to be moc processed, we call:
1953
1954 set_property(TARGET tgt APPEND PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
1955
1956 AUTOMOC_MOC_OPTIONS
1957 Additional options for moc when using AUTOMOC
1958
1959 This property is only used if the AUTOMOC property is ON for this tar‐
1960 get. In this case, it holds additional command line options which will
1961 be used when moc is executed during the build, i.e. it is equivalent
1962 to the optional OPTIONS argument of the qt4_wrap_cpp() macro.
1963
1964 This property is initialized by the value of the CMAKE_AUTO‐
1965 MOC_MOC_OPTIONS variable if it is set when a target is created, or an
1966 empty string otherwise.
1967
1968 See the cmake-qt(7) manual for more information on using CMake with Qt.
1969
1970 AUTOMOC_PATH_PREFIX
1971 New in version 3.16.
1972
1973
1974 When this property is ON, CMake will generate the -p path prefix option
1975 for moc on AUTOMOC enabled Qt targets.
1976
1977 To generate the path prefix, CMake tests if the header compiled by moc
1978 is in any of the target include directories. If so, CMake will compute
1979 the relative path accordingly. If the header is not in the include
1980 directories, CMake will omit the -p path prefix option. moc usually
1981 generates a relative include path in that case.
1982
1983 AUTOMOC_PATH_PREFIX is initialized from the variable CMAKE_AUTO‐
1984 MOC_PATH_PREFIX, which is OFF by default.
1985
1986 See the cmake-qt(7) manual for more information on using CMake with Qt.
1987
1988 Reproducible builds
1989 For reproducible builds it is recommended to keep headers that are moc
1990 compiled in one of the target include directories and set
1991 AUTOMOC_PATH_PREFIX to ON. This ensures that:
1992
1993 · moc output files are identical on different build setups,
1994
1995 · moc output files will compile correctly when the source and/or build
1996 directory is a symbolic link.
1997
1998 AUTORCC
1999 Should the target be processed with auto-rcc (for Qt projects).
2000
2001 AUTORCC is a boolean specifying whether CMake will handle the Qt rcc
2002 code generator automatically, i.e. without having to use the
2003 QT4_ADD_RESOURCES() or QT5_ADD_RESOURCES() macro. Currently Qt4 and
2004 Qt5 are supported.
2005
2006 When this property is ON, CMake will handle .qrc files added as target
2007 sources at build time and invoke rcc accordingly. This property is
2008 initialized by the value of the CMAKE_AUTORCC variable if it is set
2009 when a target is created.
2010
2011 By default AUTORCC is processed by a custom command. If the .qrc file
2012 is GENERATED, a custom target is used instead.
2013
2014 When there are multiple .qrc files with the same name, CMake will gen‐
2015 erate unspecified unique output file names for rcc. Therefore, if
2016 Q_INIT_RESOURCE() or Q_CLEANUP_RESOURCE() need to be used, the .qrc
2017 file name must be unique.
2018
2019 Modifiers
2020 AUTORCC_EXECUTABLE: The rcc executable will be detected automatically,
2021 but can be forced to a certain binary by setting this target property.
2022
2023 AUTORCC_OPTIONS: Additional command line options for rcc can be set via
2024 this target property. The corresponding AUTORCC_OPTIONS source file
2025 property can be used to specify options to be applied only to a spe‐
2026 cific .qrc file.
2027
2028 SKIP_AUTORCC: .qrc files can be excluded from AUTORCC processing by
2029 setting this source file property.
2030
2031 SKIP_AUTOGEN: Source files can be excluded from AUTOMOC, AUTOUIC and
2032 AUTORCC processing by setting this source file property.
2033
2034 AUTOGEN_SOURCE_GROUP: This global property can be used to group files
2035 generated by AUTOMOC or AUTORCC together in an IDE, e.g. in MSVS.
2036
2037 AUTOGEN_TARGETS_FOLDER: This global property can be used to group AUTO‐
2038 MOC, AUTOUIC and AUTORCC targets together in an IDE, e.g. in MSVS.
2039
2040 CMAKE_GLOBAL_AUTORCC_TARGET: A global autorcc target that depends on
2041 all AUTORCC targets in the project will be generated when this variable
2042 is ON.
2043
2044 See the cmake-qt(7) manual for more information on using CMake with Qt.
2045
2046 AUTORCC_EXECUTABLE
2047 New in version 3.14.
2048
2049
2050 AUTORCC_EXECUTABLE is file path pointing to the rcc executable to use
2051 for AUTORCC enabled files. Setting this property will make CMake skip
2052 the automatic detection of the rcc binary as well as the sanity-tests
2053 normally run to ensure that the binary is available and working as
2054 expected.
2055
2056 Usually this property does not need to be set. Only consider this prop‐
2057 erty if auto-detection of rcc can not work – e.g. because you are
2058 building the rcc binary as part of your project.
2059
2060 See the cmake-qt(7) manual for more information on using CMake with Qt.
2061
2062 AUTORCC_OPTIONS
2063 Additional options for rcc when using AUTORCC
2064
2065 This property holds additional command line options which will be used
2066 when rcc is executed during the build via AUTORCC, i.e. it is equiva‐
2067 lent to the optional OPTIONS argument of the qt4_add_resources() macro.
2068
2069 This property is initialized by the value of the CMAKE_AUTORCC_OPTIONS
2070 variable if it is set when a target is created, or an empty string oth‐
2071 erwise.
2072
2073 The options set on the target may be overridden by AUTORCC_OPTIONS set
2074 on the .qrc source file.
2075
2076 See the cmake-qt(7) manual for more information on using CMake with Qt.
2077
2078 EXAMPLE
2079 # ...
2080 set_property(TARGET tgt PROPERTY AUTORCC_OPTIONS "--compress;9")
2081 # ...
2082
2083 AUTOUIC
2084 Should the target be processed with auto-uic (for Qt projects).
2085
2086 AUTOUIC is a boolean specifying whether CMake will handle the Qt uic
2087 code generator automatically, i.e. without having to use the
2088 QT4_WRAP_UI() or QT5_WRAP_UI() macro. Currently Qt4 and Qt5 are sup‐
2089 ported.
2090
2091 This property is initialized by the value of the CMAKE_AUTOUIC variable
2092 if it is set when a target is created.
2093
2094 When this property is ON, CMake will scan the header and source files
2095 at build time and invoke uic accordingly.
2096
2097 Header and source file processing
2098 At build time, CMake scans each header and source file from the tar‐
2099 get’s sources for include statements of the form
2100
2101 #include "ui_<ui_base>.h"
2102
2103 Once such an include statement is found in a file, CMake searches for
2104 the uic input file <ui_base>.ui
2105
2106 · in the vicinity of the file and
2107
2108 · in the AUTOUIC_SEARCH_PATHS of the target.
2109
2110 If the <ui_base>.ui file was found, uic is called on it to generate
2111 ui_<ui_base>.h in the directory
2112
2113 · <AUTOGEN_BUILD_DIR>/include for single configuration generators or in
2114
2115 · <AUTOGEN_BUILD_DIR>/include_<CONFIG> for multi configuration genera‐
2116 tors.
2117
2118 Where <AUTOGEN_BUILD_DIR> is the value of the target property AUTO‐
2119 GEN_BUILD_DIR.
2120
2121 The include directory is automatically added to the target’s
2122 INCLUDE_DIRECTORIES.
2123
2124 Modifiers
2125 AUTOUIC_EXECUTABLE: The uic executable will be detected automatically,
2126 but can be forced to a certain binary using this target property.
2127
2128 AUTOUIC_OPTIONS: Additional command line options for uic can be set via
2129 this target property. The corresponding AUTOUIC_OPTIONS source file
2130 property can be used to specify options to be applied only to a spe‐
2131 cific <base_name>.ui file.
2132
2133 SKIP_AUTOUIC: Source files can be excluded from AUTOUIC processing by
2134 setting this source file property.
2135
2136 SKIP_AUTOGEN: Source files can be excluded from AUTOMOC, AUTOUIC and
2137 AUTORCC processing by setting this source file property.
2138
2139 AUTOGEN_TARGETS_FOLDER: This global property can be used to group AUTO‐
2140 MOC, AUTOUIC and AUTORCC targets together in an IDE, e.g. in MSVS.
2141
2142 CMAKE_GLOBAL_AUTOGEN_TARGET: A global autogen target, that depends on
2143 all AUTOMOC or AUTOUIC generated <ORIGIN>_autogen targets in the
2144 project, will be generated when this variable is ON.
2145
2146 AUTOGEN_PARALLEL: This target property controls the number of moc or
2147 uic processes to start in parallel during builds.
2148
2149 See the cmake-qt(7) manual for more information on using CMake with Qt.
2150
2151 AUTOUIC_EXECUTABLE
2152 New in version 3.14.
2153
2154
2155 AUTOUIC_EXECUTABLE is file path pointing to the uic executable to use
2156 for AUTOUIC enabled files. Setting this property will make CMake skip
2157 the automatic detection of the uic binary as well as the sanity-tests
2158 normally run to ensure that the binary is available and working as
2159 expected.
2160
2161 Usually this property does not need to be set. Only consider this prop‐
2162 erty if auto-detection of uic can not work – e.g. because you are
2163 building the uic binary as part of your project.
2164
2165 See the cmake-qt(7) manual for more information on using CMake with Qt.
2166
2167 AUTOUIC_OPTIONS
2168 Additional options for uic when using AUTOUIC
2169
2170 This property holds additional command line options which will be used
2171 when uic is executed during the build via AUTOUIC, i.e. it is equiva‐
2172 lent to the optional OPTIONS argument of the qt4_wrap_ui() macro.
2173
2174 This property is initialized by the value of the CMAKE_AUTOUIC_OPTIONS
2175 variable if it is set when a target is created, or an empty string oth‐
2176 erwise.
2177
2178 The options set on the target may be overridden by AUTOUIC_OPTIONS set
2179 on the .ui source file.
2180
2181 This property may use “generator expressions” with the syntax $<...>.
2182 See the cmake-generator-expressions(7) manual for available expres‐
2183 sions.
2184
2185 See the cmake-qt(7) manual for more information on using CMake with Qt.
2186
2187 EXAMPLE
2188 # ...
2189 set_property(TARGET tgt PROPERTY AUTOUIC_OPTIONS "--no-protection")
2190 # ...
2191
2192 AUTOUIC_SEARCH_PATHS
2193 New in version 3.9.
2194
2195
2196 Search path list used by AUTOUIC to find included .ui files.
2197
2198 This property is initialized by the value of the
2199 CMAKE_AUTOUIC_SEARCH_PATHS variable if it is set when a target is cre‐
2200 ated. Otherwise it is empty.
2201
2202 See the cmake-qt(7) manual for more information on using CMake with Qt.
2203
2204 BINARY_DIR
2205 New in version 3.4.
2206
2207
2208 This read-only property reports the value of the CMAKE_CUR‐
2209 RENT_BINARY_DIR variable in the directory in which the target was
2210 defined.
2211
2212 BUILD_RPATH
2213 New in version 3.8.
2214
2215
2216 A semicolon-separated list specifying runtime path (RPATH) entries to
2217 add to binaries linked in the build tree (for platforms that support
2218 it). The entries will not be used for binaries in the install tree.
2219 See also the INSTALL_RPATH target property.
2220
2221 This property is initialized by the value of the variable
2222 CMAKE_BUILD_RPATH if it is set when a target is created.
2223
2224 This property supports generator expressions.
2225
2226 BUILD_RPATH_USE_ORIGIN
2227 New in version 3.14.
2228
2229
2230 Whether to use relative paths for the build RPATH.
2231
2232 This property is initialized by the value of the variable
2233 CMAKE_BUILD_RPATH_USE_ORIGIN.
2234
2235 On platforms that support runtime paths (RPATH) with the $ORIGIN token,
2236 setting this property to TRUE enables relative paths in the build RPATH
2237 for executables and shared libraries that point to shared libraries in
2238 the same build tree.
2239
2240 Normally the build RPATH of a binary contains absolute paths to the
2241 directory of each shared library it links to. The RPATH entries for
2242 directories contained within the build tree can be made relative to
2243 enable relocatable builds and to help achieve reproducible builds by
2244 omitting the build directory from the build environment.
2245
2246 This property has no effect on platforms that do not support the $ORI‐
2247 GIN token in RPATH, or when the CMAKE_SKIP_RPATH variable is set. The
2248 runtime path set through the BUILD_RPATH target property is also unaf‐
2249 fected by this property.
2250
2251 BUILD_WITH_INSTALL_NAME_DIR
2252 New in version 3.9.
2253
2254
2255 BUILD_WITH_INSTALL_NAME_DIR is a boolean specifying whether the macOS
2256 install_name of a target in the build tree uses the directory given by
2257 INSTALL_NAME_DIR. This setting only applies to targets on macOS.
2258
2259 This property is initialized by the value of the variable
2260 CMAKE_BUILD_WITH_INSTALL_NAME_DIR if it is set when a target is cre‐
2261 ated.
2262
2263 If this property is not set and policy CMP0068 is not NEW, the value of
2264 BUILD_WITH_INSTALL_RPATH is used in its place.
2265
2266 BUILD_WITH_INSTALL_RPATH
2267 BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the
2268 target in the build tree with the INSTALL_RPATH. This takes precedence
2269 over SKIP_BUILD_RPATH and avoids the need for relinking before instal‐
2270 lation.
2271
2272 This property is initialized by the value of the
2273 CMAKE_BUILD_WITH_INSTALL_RPATH variable if it is set when a target is
2274 created.
2275
2276 If policy CMP0068 is not NEW, this property also controls use of
2277 INSTALL_NAME_DIR in the build tree on macOS. Either way, the
2278 BUILD_WITH_INSTALL_NAME_DIR target property takes precedence.
2279
2280 BUNDLE
2281 This target is a CFBundle on the macOS.
2282
2283 If a module library target has this property set to true it will be
2284 built as a CFBundle when built on the mac. It will have the directory
2285 structure required for a CFBundle and will be suitable to be used for
2286 creating Browser Plugins or other application resources.
2287
2288 BUNDLE_EXTENSION
2289 The file extension used to name a BUNDLE, a FRAMEWORK, or a MACOSX_BUN‐
2290 DLE target on the macOS and iOS.
2291
2292 The default value is bundle, framework, or app for the respective tar‐
2293 get types.
2294
2295 C_EXTENSIONS
2296 New in version 3.1.
2297
2298
2299 Boolean specifying whether compiler specific extensions are requested.
2300
2301 This property specifies whether compiler specific extensions should be
2302 used. For some compilers, this results in adding a flag such as
2303 -std=gnu11 instead of -std=c11 to the compile line. This property is
2304 ON by default. The basic C standard level is controlled by the C_STAN‐
2305 DARD target property.
2306
2307 See the cmake-compile-features(7) manual for information on compile
2308 features and a list of supported compilers.
2309
2310 This property is initialized by the value of the CMAKE_C_EXTENSIONS
2311 variable if it is set when a target is created.
2312
2313 C_STANDARD
2314 New in version 3.1.
2315
2316
2317 The C standard whose features are requested to build this target.
2318
2319 This property specifies the C standard whose features are requested to
2320 build this target. For some compilers, this results in adding a flag
2321 such as -std=gnu11 to the compile line. For compilers that have no
2322 notion of a C standard level, such as Microsoft Visual C++ before VS
2323 16.7, this property has no effect.
2324
2325 Supported values are 90, 99 and 11.
2326
2327 If the value requested does not result in a compile flag being added
2328 for the compiler in use, a previous standard flag will be added
2329 instead. This means that using:
2330
2331 set_property(TARGET tgt PROPERTY C_STANDARD 11)
2332
2333 with a compiler which does not support -std=gnu11 or an equivalent flag
2334 will not result in an error or warning, but will instead add the
2335 -std=gnu99 or -std=gnu90 flag if supported. This “decay” behavior may
2336 be controlled with the C_STANDARD_REQUIRED target property. Addition‐
2337 ally, the C_EXTENSIONS target property may be used to control whether
2338 compiler-specific extensions are enabled on a per-target basis.
2339
2340 See the cmake-compile-features(7) manual for information on compile
2341 features and a list of supported compilers.
2342
2343 This property is initialized by the value of the CMAKE_C_STANDARD vari‐
2344 able if it is set when a target is created.
2345
2346 C_STANDARD_REQUIRED
2347 New in version 3.1.
2348
2349
2350 Boolean describing whether the value of C_STANDARD is a requirement.
2351
2352 If this property is set to ON, then the value of the C_STANDARD target
2353 property is treated as a requirement. If this property is OFF or
2354 unset, the C_STANDARD target property is treated as optional and may
2355 “decay” to a previous standard if the requested is not available. For
2356 compilers that have no notion of a C standard level, such as Microsoft
2357 Visual C++ before VS 16.7, this property has no effect.
2358
2359 See the cmake-compile-features(7) manual for information on compile
2360 features and a list of supported compilers.
2361
2362 This property is initialized by the value of the CMAKE_C_STAN‐
2363 DARD_REQUIRED variable if it is set when a target is created.
2364
2365 COMMON_LANGUAGE_RUNTIME
2366 New in version 3.12.
2367
2368
2369 By setting this target property, the target is configured to build with
2370 C++/CLI support.
2371
2372 The Visual Studio generator defines the clr parameter depending on the
2373 value of COMMON_LANGUAGE_RUNTIME:
2374
2375 · property not set: native C++ (i.e. default)
2376
2377 · property set but empty: mixed unmanaged/managed C++
2378
2379 · property set to any non empty value: managed C++
2380
2381 Supported values: "", "pure", "safe"
2382
2383 This property is only evaluated Visual Studio Generators for VS 2010
2384 and above.
2385
2386 To be able to build managed C++ targets with VS 2017 and above the com‐
2387 ponent C++/CLI support must be installed, which may not be done by
2388 default.
2389
2390 See also IMPORTED_COMMON_LANGUAGE_RUNTIME
2391
2392 COMPATIBLE_INTERFACE_BOOL
2393 Properties which must be compatible with their link interface
2394
2395 The COMPATIBLE_INTERFACE_BOOL property may contain a list of properties
2396 for this target which must be consistent when evaluated as a boolean
2397 with the INTERFACE variant of the property in all linked dependees.
2398 For example, if a property FOO appears in the list, then for each
2399 dependee, the INTERFACE_FOO property content in all of its dependencies
2400 must be consistent with each other, and with the FOO property in the
2401 depender.
2402
2403 Consistency in this sense has the meaning that if the property is set,
2404 then it must have the same boolean value as all others, and if the
2405 property is not set, then it is ignored.
2406
2407 Note that for each dependee, the set of properties specified in this
2408 property must not intersect with the set specified in any of the other
2409 Compatible Interface Properties.
2410
2411 COMPATIBLE_INTERFACE_NUMBER_MAX
2412 Properties whose maximum value from the link interface will be used.
2413
2414 The COMPATIBLE_INTERFACE_NUMBER_MAX property may contain a list of
2415 properties for this target whose maximum value may be read at generate
2416 time when evaluated in the INTERFACE variant of the property in all
2417 linked dependees. For example, if a property FOO appears in the list,
2418 then for each dependee, the INTERFACE_FOO property content in all of
2419 its dependencies will be compared with each other and with the FOO
2420 property in the depender. When reading the FOO property at generate
2421 time, the maximum value will be returned. If the property is not set,
2422 then it is ignored.
2423
2424 Note that for each dependee, the set of properties specified in this
2425 property must not intersect with the set specified in any of the other
2426 Compatible Interface Properties.
2427
2428 COMPATIBLE_INTERFACE_NUMBER_MIN
2429 Properties whose maximum value from the link interface will be used.
2430
2431 The COMPATIBLE_INTERFACE_NUMBER_MIN property may contain a list of
2432 properties for this target whose minimum value may be read at generate
2433 time when evaluated in the INTERFACE variant of the property of all
2434 linked dependees. For example, if a property FOO appears in the list,
2435 then for each dependee, the INTERFACE_FOO property content in all of
2436 its dependencies will be compared with each other and with the FOO
2437 property in the depender. When reading the FOO property at generate
2438 time, the minimum value will be returned. If the property is not set,
2439 then it is ignored.
2440
2441 Note that for each dependee, the set of properties specified in this
2442 property must not intersect with the set specified in any of the other
2443 Compatible Interface Properties.
2444
2445 COMPATIBLE_INTERFACE_STRING
2446 Properties which must be string-compatible with their link interface
2447
2448 The COMPATIBLE_INTERFACE_STRING property may contain a list of proper‐
2449 ties for this target which must be the same when evaluated as a string
2450 in the INTERFACE variant of the property all linked dependees. For
2451 example, if a property FOO appears in the list, then for each dependee,
2452 the INTERFACE_FOO property content in all of its dependencies must be
2453 equal with each other, and with the FOO property in the depender. If
2454 the property is not set, then it is ignored.
2455
2456 Note that for each dependee, the set of properties specified in this
2457 property must not intersect with the set specified in any of the other
2458 Compatible Interface Properties.
2459
2460 COMPILE_DEFINITIONS
2461 Preprocessor definitions for compiling a target’s sources.
2462
2463 The COMPILE_DEFINITIONS property may be set to a semicolon-separated
2464 list of preprocessor definitions using the syntax VAR or VAR=value.
2465 Function-style definitions are not supported. CMake will automatically
2466 escape the value correctly for the native build system (note that CMake
2467 language syntax may require escapes to specify some values).
2468
2469 CMake will automatically drop some definitions that are not supported
2470 by the native build tool.
2471
2472 Disclaimer: Most native build tools have poor support for escaping cer‐
2473 tain values. CMake has work-arounds for many cases but some values may
2474 just not be possible to pass correctly. If a value does not seem to be
2475 escaped correctly, do not attempt to work-around the problem by adding
2476 escape sequences to the value. Your work-around may break in a future
2477 version of CMake that has improved escape support. Instead consider
2478 defining the macro in a (configured) header file. Then report the lim‐
2479 itation. Known limitations include:
2480
2481 # - broken almost everywhere
2482 ; - broken in VS IDE 7.0 and Borland Makefiles
2483 , - broken in VS IDE
2484 % - broken in some cases in NMake
2485 & | - broken in some cases on MinGW
2486 ^ < > \" - broken in most Make tools on Windows
2487
2488 CMake does not reject these values outright because they do work in
2489 some cases. Use with caution.
2490
2491 Contents of COMPILE_DEFINITIONS may use “generator expressions” with
2492 the syntax $<...>. See the cmake-generator-expressions(7) manual for
2493 available expressions. See the cmake-buildsystem(7) manual for more on
2494 defining buildsystem properties.
2495
2496 The corresponding COMPILE_DEFINITIONS_<CONFIG> property may be set to
2497 specify per-configuration definitions. Generator expressions should be
2498 preferred instead of setting the alternative property.
2499
2500 COMPILE_FEATURES
2501 New in version 3.1.
2502
2503
2504 Compiler features enabled for this target.
2505
2506 The list of features in this property are a subset of the features
2507 listed in the CMAKE_C_COMPILE_FEATURES, CMAKE_CUDA_COMPILE_FEATURES,
2508 and CMAKE_CXX_COMPILE_FEATURES variables.
2509
2510 Contents of COMPILE_FEATURES may use “generator expressions” with the
2511 syntax $<...>. See the cmake-generator-expressions(7) manual for
2512 available expressions. See the cmake-compile-features(7) manual for
2513 information on compile features and a list of supported compilers.
2514
2515 COMPILE_FLAGS
2516 Additional flags to use when compiling this target’s sources.
2517
2518 The COMPILE_FLAGS property sets additional compiler flags used to build
2519 sources within the target. Use COMPILE_DEFINITIONS to pass additional
2520 preprocessor definitions.
2521
2522 This property is deprecated. Use the COMPILE_OPTIONS property or the
2523 target_compile_options() command instead.
2524
2525 COMPILE_OPTIONS
2526 List of options to pass to the compiler.
2527
2528 This property holds a semicolon-separated list of options specified so
2529 far for its target. Use the target_compile_options() command to append
2530 more options.
2531
2532 This property is initialized by the COMPILE_OPTIONS directory property
2533 when a target is created, and is used by the generators to set the
2534 options for the compiler.
2535
2536 Contents of COMPILE_OPTIONS may use “generator expressions” with the
2537 syntax $<...>. See the cmake-generator-expressions(7) manual for
2538 available expressions. See the cmake-buildsystem(7) manual for more on
2539 defining buildsystem properties.
2540
2541 COMPILE_PDB_NAME
2542 New in version 3.1.
2543
2544
2545 Output name for the MS debug symbol .pdb file generated by the compiler
2546 while building source files.
2547
2548 This property specifies the base name for the debug symbols file. If
2549 not set, the default is unspecified.
2550
2551 NOTE:
2552 The compiler-generated program database files are specified by the
2553 /Fd compiler flag and are not the same as linker-generated program
2554 database files specified by the /pdb linker flag. Use the PDB_NAME
2555 property to specify the latter.
2556
2557 COMPILE_PDB_NAME_<CONFIG>
2558 New in version 3.1.
2559
2560
2561 Per-configuration output name for the MS debug symbol .pdb file gener‐
2562 ated by the compiler while building source files.
2563
2564 This is the configuration-specific version of COMPILE_PDB_NAME.
2565
2566 NOTE:
2567 The compiler-generated program database files are specified by the
2568 /Fd compiler flag and are not the same as linker-generated program
2569 database files specified by the /pdb linker flag. Use the
2570 PDB_NAME_<CONFIG> property to specify the latter.
2571
2572 COMPILE_PDB_OUTPUT_DIRECTORY
2573 New in version 3.1.
2574
2575
2576 Output directory for the MS debug symbol .pdb file generated by the
2577 compiler while building source files.
2578
2579 This property specifies the directory into which the MS debug symbols
2580 will be placed by the compiler. This property is initialized by the
2581 value of the CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY variable if it is set
2582 when a target is created.
2583
2584 NOTE:
2585 The compiler-generated program database files are specified by the
2586 /Fd compiler flag and are not the same as linker-generated program
2587 database files specified by the /pdb linker flag. Use the PDB_OUT‐
2588 PUT_DIRECTORY property to specify the latter.
2589
2590 COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
2591 New in version 3.1.
2592
2593
2594 Per-configuration output directory for the MS debug symbol .pdb file
2595 generated by the compiler while building source files.
2596
2597 This is a per-configuration version of COMPILE_PDB_OUTPUT_DIRECTORY,
2598 but multi-configuration generators (Visual Studio, Xcode) do NOT append
2599 a per-configuration subdirectory to the specified directory. This
2600 property is initialized by the value of the CMAKE_COMPILE_PDB_OUT‐
2601 PUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.
2602
2603 NOTE:
2604 The compiler-generated program database files are specified by the
2605 /Fd compiler flag and are not the same as linker-generated program
2606 database files specified by the /pdb linker flag. Use the PDB_OUT‐
2607 PUT_DIRECTORY_<CONFIG> property to specify the latter.
2608
2609 <CONFIG>_OUTPUT_NAME
2610 Old per-configuration target file base name. Use OUTPUT_NAME_<CONFIG>
2611 instead.
2612
2613 This is a configuration-specific version of the OUTPUT_NAME target
2614 property.
2615
2616 <CONFIG>_POSTFIX
2617 Postfix to append to the target file name for configuration <CONFIG>.
2618
2619 When building with configuration <CONFIG> the value of this property is
2620 appended to the target file name built on disk. For non-executable
2621 targets, this property is initialized by the value of the variable
2622 CMAKE_<CONFIG>_POSTFIX if it is set when a target is created. This
2623 property is ignored on the Mac for Frameworks and App Bundles.
2624
2625 For macOS see also the FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG> target
2626 property.
2627
2628 CROSSCOMPILING_EMULATOR
2629 New in version 3.3.
2630
2631
2632 Use the given emulator to run executables created when crosscompiling.
2633 This command will be added as a prefix to add_test(), add_custom_com‐
2634 mand(), and add_custom_target() commands for built target system exe‐
2635 cutables.
2636
2637 If this property contains a semicolon-separated list, then the first
2638 value is the command and remaining values are its arguments.
2639
2640 This property is initialized by the value of the CMAKE_CROSSCOMPIL‐
2641 ING_EMULATOR variable if it is set when a target is created.
2642
2643 CUDA_ARCHITECTURES
2644 New in version 3.18.
2645
2646
2647 List of architectures to generate device code for.
2648
2649 An architecture can be suffixed by either -real or -virtual to specify
2650 the kind of architecture to generate code for. If no suffix is given
2651 then code is generated for both real and virtual architectures.
2652
2653 A non-empty false value (e.g. OFF) disables adding architectures. This
2654 is intended to support packagers and rare cases where full control over
2655 the passed flags is required.
2656
2657 This property is initialized by the value of the CMAKE_CUDA_ARCHITEC‐
2658 TURES variable if it is set when a target is created.
2659
2660 The CUDA_ARCHITECTURES target property must be set to a non-empty value
2661 on targets that compile CUDA sources, or it is an error. See policy
2662 CMP0104.
2663
2664 Examples
2665 set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 35 50 72)
2666
2667 Generates code for real and virtual architectures 30, 50 and 72.
2668
2669 set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 70-real 72-virtual)
2670
2671 Generates code for real architecture 70 and virtual architecture 72.
2672
2673 set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES OFF)
2674
2675 CMake will not pass any architecture flags to the compiler.
2676
2677 CUDA_EXTENSIONS
2678 New in version 3.8.
2679
2680
2681 Boolean specifying whether compiler specific extensions are requested.
2682
2683 This property specifies whether compiler specific extensions should be
2684 used. For some compilers, this results in adding a flag such as
2685 -std=gnu++11 instead of -std=c++11 to the compile line. This property
2686 is ON by default. The basic CUDA/C++ standard level is controlled by
2687 the CUDA_STANDARD target property.
2688
2689 See the cmake-compile-features(7) manual for information on compile
2690 features and a list of supported compilers.
2691
2692 This property is initialized by the value of the CMAKE_CUDA_EXTENSIONS
2693 variable if it is set when a target is created.
2694
2695 CUDA_PTX_COMPILATION
2696 New in version 3.9.
2697
2698
2699 Compile CUDA sources to .ptx files instead of .obj files within Object
2700 Libraries.
2701
2702 For example:
2703
2704 add_library(myptx OBJECT a.cu b.cu)
2705 set_property(TARGET myptx PROPERTY CUDA_PTX_COMPILATION ON)
2706
2707 CUDA_RESOLVE_DEVICE_SYMBOLS
2708 New in version 3.9.
2709
2710
2711 CUDA only: Enables device linking for the specific library target where
2712 required.
2713
2714 If set, this will tell the required compilers to enable device linking
2715 on the library target. Device linking is an additional link step
2716 required by some CUDA compilers when CUDA_SEPARABLE_COMPILATION is
2717 enabled. Normally device linking is deferred until a shared library or
2718 executable is generated, allowing for multiple static libraries to
2719 resolve device symbols at the same time when they are used by a shared
2720 library or executable.
2721
2722 By default static library targets have this property is disabled, while
2723 shared, module, and executable targets have this property enabled.
2724
2725 Note that device linking is not supported for Object Libraries.
2726
2727 For instance:
2728
2729 set_property(TARGET mystaticlib PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS ON)
2730
2731 CUDA_RUNTIME_LIBRARY
2732 New in version 3.17.
2733
2734
2735 Select the CUDA runtime library for use by compilers targeting the CUDA
2736 language.
2737
2738 The allowed case insensitive values are:
2739
2740 None Link with -cudart=none or equivalent flag(s) to use no CUDA run‐
2741 time library.
2742
2743 Shared Link with -cudart=shared or equivalent flag(s) to use a dynami‐
2744 cally-linked CUDA runtime library.
2745
2746 Static Link with -cudart=static or equivalent flag(s) to use a stati‐
2747 cally-linked CUDA runtime library.
2748
2749 Contents of CUDA_RUNTIME_LIBRARY may use generator expressions.
2750
2751 If that property is not set then CMake uses an appropriate default
2752 value based on the compiler to select the CUDA runtime library.
2753
2754 NOTE:
2755 This property has effect only when the CUDA language is enabled. To
2756 control the CUDA runtime linking when only using the CUDA SDK with
2757 the C or C++ language we recommend using the FindCUDAToolkit module.
2758
2759 CUDA_SEPARABLE_COMPILATION
2760 New in version 3.8.
2761
2762
2763 CUDA only: Enables separate compilation of device code
2764
2765 If set this will enable separable compilation for all CUDA files for
2766 the given target.
2767
2768 For instance:
2769
2770 set_property(TARGET myexe PROPERTY CUDA_SEPARABLE_COMPILATION ON)
2771
2772 This property is initialized by the value of the CMAKE_CUDA_SEPARA‐
2773 BLE_COMPILATION variable if it is set when a target is created.
2774
2775 CUDA_STANDARD
2776 New in version 3.8.
2777
2778
2779 The CUDA/C++ standard whose features are requested to build this tar‐
2780 get.
2781
2782 This property specifies the CUDA/C++ standard whose features are
2783 requested to build this target. For some compilers, this results in
2784 adding a flag such as -std=gnu++11 to the compile line.
2785
2786 Supported values are 98, 03, 11, 14, 17, 20.
2787
2788 If the value requested does not result in a compile flag being added
2789 for the compiler in use, a previous standard flag will be added
2790 instead. This means that using:
2791
2792 set_property(TARGET tgt PROPERTY CUDA_STANDARD 11)
2793
2794 with a compiler which does not support -std=gnu++11 or an equivalent
2795 flag will not result in an error or warning, but will instead add the
2796 -std=gnu++98 flag if supported. This “decay” behavior may be con‐
2797 trolled with the CUDA_STANDARD_REQUIRED target property. Additionally,
2798 the CUDA_EXTENSIONS target property may be used to control whether com‐
2799 piler-specific extensions are enabled on a per-target basis.
2800
2801 See the cmake-compile-features(7) manual for information on compile
2802 features and a list of supported compilers.
2803
2804 This property is initialized by the value of the CMAKE_CUDA_STANDARD
2805 variable if it is set when a target is created.
2806
2807 CUDA_STANDARD_REQUIRED
2808 New in version 3.8.
2809
2810
2811 Boolean describing whether the value of CUDA_STANDARD is a requirement.
2812
2813 If this property is set to ON, then the value of the CUDA_STANDARD tar‐
2814 get property is treated as a requirement. If this property is OFF or
2815 unset, the CUDA_STANDARD target property is treated as optional and may
2816 “decay” to a previous standard if the requested is not available. For
2817 compilers that have no notion of a standard level, such as MSVC 1800
2818 (Visual Studio 2013) and lower, this has no effect.
2819
2820 See the cmake-compile-features(7) manual for information on compile
2821 features and a list of supported compilers.
2822
2823 This property is initialized by the value of the CMAKE_CUDA_STAN‐
2824 DARD_REQUIRED variable if it is set when a target is created.
2825
2826 CXX_EXTENSIONS
2827 New in version 3.1.
2828
2829
2830 Boolean specifying whether compiler specific extensions are requested.
2831
2832 This property specifies whether compiler specific extensions should be
2833 used. For some compilers, this results in adding a flag such as
2834 -std=gnu++11 instead of -std=c++11 to the compile line. This property
2835 is ON by default. The basic C++ standard level is controlled by the
2836 CXX_STANDARD target property.
2837
2838 See the cmake-compile-features(7) manual for information on compile
2839 features and a list of supported compilers.
2840
2841 This property is initialized by the value of the CMAKE_CXX_EXTENSIONS
2842 variable if it is set when a target is created.
2843
2844 CXX_STANDARD
2845 New in version 3.1.
2846
2847
2848 The C++ standard whose features are requested to build this target.
2849
2850 This property specifies the C++ standard whose features are requested
2851 to build this target. For some compilers, this results in adding a
2852 flag such as -std=gnu++11 to the compile line. For compilers that have
2853 no notion of a standard level, such as Microsoft Visual C++ before 2015
2854 Update 3, this has no effect.
2855
2856 Supported values are 98, 11, 14, 17, and 20.
2857
2858 If the value requested does not result in a compile flag being added
2859 for the compiler in use, a previous standard flag will be added
2860 instead. This means that using:
2861
2862 set_property(TARGET tgt PROPERTY CXX_STANDARD 11)
2863
2864 with a compiler which does not support -std=gnu++11 or an equivalent
2865 flag will not result in an error or warning, but will instead add the
2866 -std=gnu++98 flag if supported. This “decay” behavior may be con‐
2867 trolled with the CXX_STANDARD_REQUIRED target property. Additionally,
2868 the CXX_EXTENSIONS target property may be used to control whether com‐
2869 piler-specific extensions are enabled on a per-target basis.
2870
2871 See the cmake-compile-features(7) manual for information on compile
2872 features and a list of supported compilers.
2873
2874 This property is initialized by the value of the CMAKE_CXX_STANDARD
2875 variable if it is set when a target is created.
2876
2877 CXX_STANDARD_REQUIRED
2878 New in version 3.1.
2879
2880
2881 Boolean describing whether the value of CXX_STANDARD is a requirement.
2882
2883 If this property is set to ON, then the value of the CXX_STANDARD tar‐
2884 get property is treated as a requirement. If this property is OFF or
2885 unset, the CXX_STANDARD target property is treated as optional and may
2886 “decay” to a previous standard if the requested is not available. For
2887 compilers that have no notion of a standard level, such as MSVC 1800
2888 (Visual Studio 2013) and lower, this has no effect.
2889
2890 See the cmake-compile-features(7) manual for information on compile
2891 features and a list of supported compilers.
2892
2893 This property is initialized by the value of the CMAKE_CXX_STAN‐
2894 DARD_REQUIRED variable if it is set when a target is created.
2895
2896 DEBUG_POSTFIX
2897 See target property <CONFIG>_POSTFIX.
2898
2899 This property is a special case of the more-general <CONFIG>_POSTFIX
2900 property for the DEBUG configuration.
2901
2902 DEFINE_SYMBOL
2903 Define a symbol when compiling this target’s sources.
2904
2905 DEFINE_SYMBOL sets the name of the preprocessor symbol defined when
2906 compiling sources in a shared library. If not set here then it is set
2907 to target_EXPORTS by default (with some substitutions if the target is
2908 not a valid C identifier). This is useful for headers to know whether
2909 they are being included from inside their library or outside to prop‐
2910 erly setup dllexport/dllimport decorations.
2911
2912 DEPLOYMENT_ADDITIONAL_FILES
2913 New in version 3.13.
2914
2915
2916 Set the WinCE project AdditionalFiles in DeploymentTool in .vcproj
2917 files generated by the Visual Studio 9 2008 generator. This is useful
2918 when you want to debug on remote WinCE device. Specify additional
2919 files that will be copied to the device. For example:
2920
2921 set_property(TARGET ${TARGET} PROPERTY
2922 DEPLOYMENT_ADDITIONAL_FILES "english.lng|local_folder|remote_folder|0"
2923 "german.lng|local_folder|remote_folder|0")
2924
2925 produces:
2926
2927 <DeploymentTool AdditionalFiles="english.lng|local_folder|remote_folder|0;german.lng|local_folder|remote_folder|0" ... />
2928
2929 DEPLOYMENT_REMOTE_DIRECTORY
2930 New in version 3.6.
2931
2932
2933 Set the WinCE project RemoteDirectory in DeploymentTool and RemoteExe‐
2934 cutable in DebuggerTool in .vcproj files generated by the Visual Studio
2935 9 2008 generator. This is useful when you want to debug on remote
2936 WinCE device. For example:
2937
2938 set_property(TARGET ${TARGET} PROPERTY
2939 DEPLOYMENT_REMOTE_DIRECTORY "\\FlashStorage")
2940
2941 produces:
2942
2943 <DeploymentTool RemoteDirectory="\FlashStorage" ... />
2944 <DebuggerTool RemoteExecutable="\FlashStorage\target_file" ... />
2945
2946 DEPRECATION
2947 New in version 3.17.
2948
2949
2950 Deprecation message from imported target’s developer.
2951
2952 DEPRECATION is the message regarding a deprecation status to be dis‐
2953 played to downstream users of a target.
2954
2955 DISABLE_PRECOMPILE_HEADERS
2956 New in version 3.16.
2957
2958
2959 Disables the precompilation of header files specified by PRECOM‐
2960 PILE_HEADERS property.
2961
2962 If the property is not set, CMake will use the value provided by
2963 CMAKE_DISABLE_PRECOMPILE_HEADERS.
2964
2965 DOTNET_TARGET_FRAMEWORK
2966 New in version 3.17.
2967
2968
2969 Specify the .NET target framework.
2970
2971 Used to specify the .NET target framework for C++/CLI and C#. For
2972 example: netcoreapp2.1.
2973
2974 This property is only evaluated for Visual Studio Generators VS 2010
2975 and above.
2976
2977 Can be initialized for all targets using the variable CMAKE_DOTNET_TAR‐
2978 GET_FRAMEWORK.
2979
2980 DOTNET_TARGET_FRAMEWORK_VERSION
2981 New in version 3.12.
2982
2983
2984 Specify the .NET target framework version.
2985
2986 Used to specify the .NET target framework version for C++/CLI and C#.
2987 For example: v4.5.
2988
2989 This property is only evaluated for Visual Studio Generators VS 2010
2990 and above.
2991
2992 To initialize this variable for all targets set CMAKE_DOTNET_TAR‐
2993 GET_FRAMEWORK or CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION. If both are
2994 set, the latter is ignored.
2995
2996 EchoString
2997 A message to be displayed when the target is built.
2998
2999 A message to display on some generators (such as Makefile Generators)
3000 when the target is built.
3001
3002 ENABLE_EXPORTS
3003 Specify whether an executable exports symbols for loadable modules.
3004
3005 Normally an executable does not export any symbols because it is the
3006 final program. It is possible for an executable to export symbols to
3007 be used by loadable modules. When this property is set to true CMake
3008 will allow other targets to “link” to the executable with the tar‐
3009 get_link_libraries() command. On all platforms a target-level depen‐
3010 dency on the executable is created for targets that link to it. Han‐
3011 dling of the executable on the link lines of the loadable modules
3012 varies by platform:
3013
3014 · On Windows-based systems (including Cygwin) an “import library” is
3015 created along with the executable to list the exported symbols.
3016 Loadable modules link to the import library to get the symbols.
3017
3018 · On macOS, loadable modules link to the executable itself using the
3019 -bundle_loader flag.
3020
3021 · On AIX, a linker “import file” is created along with the executable
3022 to list the exported symbols for import when linking other targets.
3023 Loadable modules link to the import file to get the symbols.
3024
3025 · On other platforms, loadable modules are simply linked without refer‐
3026 encing the executable since the dynamic loader will automatically
3027 bind symbols when the module is loaded.
3028
3029 This property is initialized by the value of the variable
3030 CMAKE_ENABLE_EXPORTS if it is set when a target is created.
3031
3032 EXCLUDE_FROM_ALL
3033 Set this target property to a true (or false) value to exclude (or
3034 include) the target from the “all” target of the containing directory
3035 and its ancestors. If excluded, running e.g. make in the containing
3036 directory or its ancestors will not build the target by default.
3037
3038 If this target property is not set then the target will be included in
3039 the “all” target of the containing directory. Furthermore, it will be
3040 included in the “all” target of its ancestor directories unless the
3041 EXCLUDE_FROM_ALL directory property is set.
3042
3043 With EXCLUDE_FROM_ALL set to false or not set at all, the target will
3044 be brought up to date as part of doing a make install or its equivalent
3045 for the CMake generator being used.
3046
3047 If a target has EXCLUDE_FROM_ALL set to true, it may still be listed in
3048 an install(TARGETS) command, but the user is responsible for ensuring
3049 that the target’s build artifacts are not missing or outdated when an
3050 install is performed.
3051
3052 This property may use “generator expressions” with the syntax $<...>.
3053 See the cmake-generator-expressions(7) manual for available expres‐
3054 sions.
3055
3056 Only the “Ninja Multi-Config” generator supports a property value that
3057 varies by configuration. For all other generators the value of this
3058 property must be the same for all configurations.
3059
3060 EXCLUDE_FROM_DEFAULT_BUILD
3061 Exclude target from Build Solution.
3062
3063 This property is only used by Visual Studio generators. When set to
3064 TRUE, the target will not be built when you press Build Solution.
3065
3066 EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>
3067 Per-configuration version of target exclusion from Build Solution.
3068
3069 This is the configuration-specific version of
3070 EXCLUDE_FROM_DEFAULT_BUILD. If the generic EXCLUDE_FROM_DEFAULT_BUILD
3071 is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> takes
3072 precedence in configurations for which it has a value.
3073
3074 EXPORT_NAME
3075 Exported name for target files.
3076
3077 This sets the name for the IMPORTED target generated by the
3078 install(EXPORT) and export() commands. If not set, the logical target
3079 name is used by default.
3080
3081 EXPORT_PROPERTIES
3082 New in version 3.12.
3083
3084
3085 List additional properties to export for a target.
3086
3087 This property contains a list of property names that should be exported
3088 by the install(EXPORT) and export() commands. By default only a lim‐
3089 ited number of properties are exported. This property can be used to
3090 additionally export other properties as well.
3091
3092 Properties starting with INTERFACE_ or IMPORTED_ are not allowed as
3093 they are reserved for internal CMake use.
3094
3095 Properties containing generator expressions are also not allowed.
3096
3097 NOTE:
3098 Since CMake 3.19, Interface Libraries may have arbitrary target
3099 properties. If a project exports an interface library with custom
3100 properties, the resulting package may not work with dependents con‐
3101 figured by older versions of CMake that reject the custom proper‐
3102 ties.
3103
3104 FOLDER
3105 Set the folder name. Use to organize targets in an IDE.
3106
3107 Targets with no FOLDER property will appear as top level entities in
3108 IDEs like Visual Studio. Targets with the same FOLDER property value
3109 will appear next to each other in a folder of that name. To nest fold‐
3110 ers, use FOLDER values such as ‘GUI/Dialogs’ with ‘/’ characters sepa‐
3111 rating folder levels.
3112
3113 This property is initialized by the value of the variable CMAKE_FOLDER
3114 if it is set when a target is created.
3115
3116 Fortran_FORMAT
3117 Set to FIXED or FREE to indicate the Fortran source layout.
3118
3119 This property tells CMake whether the Fortran source files in a target
3120 use fixed-format or free-format. CMake will pass the corresponding
3121 format flag to the compiler. Use the source-specific Fortran_FORMAT
3122 property to change the format of a specific source file. If the vari‐
3123 able CMAKE_Fortran_FORMAT is set when a target is created its value is
3124 used to initialize this property.
3125
3126 Fortran_MODULE_DIRECTORY
3127 Specify output directory for Fortran modules provided by the target.
3128
3129 If the target contains Fortran source files that provide modules and
3130 the compiler supports a module output directory this specifies the
3131 directory in which the modules will be placed. When this property is
3132 not set the modules will be placed in the build directory corresponding
3133 to the target’s source directory. If the variable CMAKE_Fortran_MOD‐
3134 ULE_DIRECTORY is set when a target is created its value is used to ini‐
3135 tialize this property.
3136
3137 When using one of the Visual Studio Generators with the Intel Fortran
3138 plugin installed in Visual Studio, a subdirectory named after the con‐
3139 figuration will be appended to the path where modules are created. For
3140 example, if Fortran_MODULE_DIRECTORY is set to C:/some/path, modules
3141 will end up in C:/some/path/Debug (or C:/some/path/Release etc.) when
3142 an Intel Fortran .vfproj file is generated, and in C:/some/path when
3143 any other generator is used.
3144
3145 Note that some compilers will automatically search the module output
3146 directory for modules USEd during compilation but others will not. If
3147 your sources USE modules their location must be specified by
3148 INCLUDE_DIRECTORIES regardless of this property.
3149
3150 Fortran_PREPROCESS
3151 New in version 3.18.
3152
3153
3154 Control whether the Fortran source file should be unconditionally pre‐
3155 processed.
3156
3157 If unset or empty, rely on the compiler to determine whether the file
3158 should be preprocessed. If explicitly set to OFF then the file does not
3159 need to be preprocessed. If explicitly set to ON, then the file does
3160 need to be preprocessed as part of the compilation step.
3161
3162 When using the Ninja generator, all source files are first preprocessed
3163 in order to generate module dependency information. Setting this prop‐
3164 erty to OFF will make Ninja skip this step.
3165
3166 Use the source-specific Fortran_PREPROCESS property if a single file
3167 needs to be preprocessed. If the variable CMAKE_Fortran_PREPROCESS is
3168 set when a target is created its value is used to initialize this prop‐
3169 erty.
3170
3171 NOTE:
3172 For some compilers, NAG, PGI and Solaris Studio, setting this to OFF
3173 will have no effect.
3174
3175 FRAMEWORK
3176 Build SHARED or STATIC library as Framework Bundle on the macOS and
3177 iOS.
3178
3179 If such a library target has this property set to TRUE it will be built
3180 as a framework when built on the macOS and iOS. It will have the
3181 directory structure required for a framework and will be suitable to be
3182 used with the -framework option. This property is initialized by the
3183 value of the CMAKE_FRAMEWORK variable if it is set when a target is
3184 created.
3185
3186 To customize Info.plist file in the framework, use MACOSX_FRAME‐
3187 WORK_INFO_PLIST target property.
3188
3189 For macOS see also the FRAMEWORK_VERSION target property.
3190
3191 Example of creation dynamicFramework:
3192
3193 add_library(dynamicFramework SHARED
3194 dynamicFramework.c
3195 dynamicFramework.h
3196 )
3197 set_target_properties(dynamicFramework PROPERTIES
3198 FRAMEWORK TRUE
3199 FRAMEWORK_VERSION C
3200 MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework
3201 MACOSX_FRAMEWORK_INFO_PLIST Info.plist
3202 # "current version" in semantic format in Mach-O binary file
3203 VERSION 16.4.0
3204 # "compatibility version" in semantic format in Mach-O binary file
3205 SOVERSION 1.0.0
3206 PUBLIC_HEADER dynamicFramework.h
3207 XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
3208 )
3209
3210 FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>
3211 New in version 3.18.
3212
3213
3214 Postfix to append to the framework file name for configuration <CON‐
3215 FIG>, when using a multi-config generator (like Xcode and Ninja
3216 Multi-Config).
3217
3218 When building with configuration <CONFIG> the value of this property is
3219 appended to the framework file name built on disk.
3220
3221 For example, given a framework called my_fw, a value of _debug for the
3222 FRAMEWORK_MULTI_CONFIG_POSTFIX_DEBUG property, and Debug;Release in
3223 CMAKE_CONFIGURATION_TYPES, the following relevant files would be cre‐
3224 ated for the Debug and Release configurations:
3225
3226 · Release/my_fw.framework/my_fw
3227
3228 · Release/my_fw.framework/Versions/A/my_fw
3229
3230 · Debug/my_fw.framework/my_fw_debug
3231
3232 · Debug/my_fw.framework/Versions/A/my_fw_debug
3233
3234 For framework targets, this property is initialized by the value of the
3235 CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG> variable if it is set
3236 when a target is created.
3237
3238 This property is ignored for non-framework targets, and when using sin‐
3239 gle config generators.
3240
3241 FRAMEWORK_VERSION
3242 New in version 3.4.
3243
3244
3245 Version of a framework created using the FRAMEWORK target property
3246 (e.g. A).
3247
3248 This property only affects macOS, as iOS doesn’t have versioned direc‐
3249 tory structure.
3250
3251 GENERATOR_FILE_NAME
3252 Generator’s file for this target.
3253
3254 An internal property used by some generators to record the name of the
3255 project or dsp file associated with this target. Note that at config‐
3256 ure time, this property is only set for targets created by
3257 include_external_msproject().
3258
3259 GHS_INTEGRITY_APP
3260 New in version 3.14.
3261
3262
3263 ON / OFF boolean to determine if an executable target should be treated
3264 as an Integrity Application.
3265
3266 If no value is set and if a .int file is added as a source file to the
3267 executable target it will be treated as an Integrity Application.
3268
3269 Supported on Green Hills MULTI.
3270
3271 GHS_NO_SOURCE_GROUP_FILE
3272 New in version 3.14.
3273
3274
3275 ON / OFF boolean to control if the project file for a target should be
3276 one single file or multiple files.
3277
3278 The default behavior or when the property is OFF is to generate a
3279 project file for the target and then a sub-project file for each source
3280 group.
3281
3282 When this property is ON or if CMAKE_GHS_NO_SOURCE_GROUP_FILE is ON
3283 then only a single project file is generated for the target.
3284
3285 Supported on Green Hills MULTI.
3286
3287 GNUtoMS
3288 Convert GNU import library (.dll.a) to MS format (.lib).
3289
3290 When linking a shared library or executable that exports symbols using
3291 GNU tools on Windows (MinGW/MSYS) with Visual Studio installed convert
3292 the import library (.dll.a) from GNU to MS format (.lib). Both import
3293 libraries will be installed by install(TARGETS) and exported by
3294 install(EXPORT) and export() to be linked by applications with either
3295 GNU- or MS-compatible tools.
3296
3297 If the variable CMAKE_GNUtoMS is set when a target is created its value
3298 is used to initialize this property. The variable must be set prior to
3299 the first command that enables a language such as project() or
3300 enable_language(). CMake provides the variable as an option to the
3301 user automatically when configuring on Windows with GNU tools.
3302
3303 HAS_CXX
3304 Link the target using the C++ linker tool (obsolete).
3305
3306 This is equivalent to setting the LINKER_LANGUAGE property to CXX.
3307
3308 IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
3309 Specify #include line transforms for dependencies in a target.
3310
3311 This property specifies rules to transform macro-like #include lines
3312 during implicit dependency scanning of C and C++ source files. The
3313 list of rules must be semicolon-separated with each entry of the form
3314 A_MACRO(%)=value-with-% (the % must be literal). During dependency
3315 scanning occurrences of A_MACRO(...) on #include lines will be replaced
3316 by the value given with the macro argument substituted for %. For
3317 example, the entry
3318
3319 MYDIR(%)=<mydir/%>
3320
3321 will convert lines of the form
3322
3323 #include MYDIR(myheader.h)
3324
3325 to
3326
3327 #include <mydir/myheader.h>
3328
3329 allowing the dependency to be followed.
3330
3331 This property applies to sources in the target on which it is set.
3332
3333 IMPORTED
3334 Read-only indication of whether a target is IMPORTED.
3335
3336 The boolean value of this property is True for targets created with the
3337 IMPORTED option to add_executable() or add_library(). It is False for
3338 targets built within the project.
3339
3340 IMPORTED_COMMON_LANGUAGE_RUNTIME
3341 New in version 3.12.
3342
3343
3344 Property to define if the target uses C++/CLI.
3345
3346 Ignored for non-imported targets.
3347
3348 See also the COMMON_LANGUAGE_RUNTIME target property.
3349
3350 IMPORTED_CONFIGURATIONS
3351 Configurations provided for an IMPORTED target.
3352
3353 Set this to the list of configuration names available for an IMPORTED
3354 target. The names correspond to configurations defined in the project
3355 from which the target is imported. If the importing project uses a
3356 different set of configurations the names may be mapped using the
3357 MAP_IMPORTED_CONFIG_<CONFIG> property. Ignored for non-imported tar‐
3358 gets.
3359
3360 IMPORTED_GLOBAL
3361 New in version 3.11.
3362
3363
3364 Indication of whether an IMPORTED target is globally visible.
3365
3366 The boolean value of this property is True for targets created with the
3367 IMPORTED GLOBAL options to add_executable() or add_library(). It is
3368 always False for targets built within the project.
3369
3370 For targets created with the IMPORTED option to add_executable() or
3371 add_library() but without the additional option GLOBAL this is False,
3372 too. However, setting this property for such a locally IMPORTED target
3373 to True promotes that target to global scope. This promotion can only
3374 be done in the same directory where that IMPORTED target was created in
3375 the first place.
3376
3377 NOTE:
3378 Once an imported target has been made global, it cannot be changed
3379 back to non-global. Therefore, if a project sets this property, it
3380 may only provide a value of True. CMake will issue an error if the
3381 project tries to set the property to a non-True value, even if the
3382 value was already False.
3383
3384 NOTE:
3385 Local ALIAS targets created before promoting an IMPORTED target from
3386 LOCAL to GLOBAL, keep their initial scope (see ALIAS_GLOBAL target
3387 property).
3388
3389 IMPORTED_IMPLIB
3390 Full path to the import library for an IMPORTED target.
3391
3392 Set this to the location of the .lib part of a Windows DLL, or on AIX
3393 set it to an import file created for executables that export symbols
3394 (see the ENABLE_EXPORTS target property). Ignored for non-imported
3395 targets.
3396
3397 IMPORTED_IMPLIB_<CONFIG>
3398 <CONFIG>-specific version of IMPORTED_IMPLIB property.
3399
3400 Configuration names correspond to those provided by the project from
3401 which the target is imported.
3402
3403 IMPORTED_LIBNAME
3404 New in version 3.8.
3405
3406
3407 Specify the link library name for an imported Interface Library.
3408
3409 An interface library builds no library file itself but does specify
3410 usage requirements for its consumers. The IMPORTED_LIBNAME property
3411 may be set to specify a single library name to be placed on the link
3412 line in place of the interface library target name as a requirement for
3413 using the interface.
3414
3415 This property is intended for use in naming libraries provided by a
3416 platform SDK for which the full path to a library file may not be
3417 known. The value may be a plain library name such as foo but may not
3418 be a path (e.g. /usr/lib/libfoo.so) or a flag (e.g. -Wl,...). The name
3419 is never treated as a library target name even if it happens to name
3420 one.
3421
3422 The IMPORTED_LIBNAME property is allowed only on imported Interface
3423 Libraries and is rejected on targets of other types (for which the
3424 IMPORTED_LOCATION target property may be used).
3425
3426 IMPORTED_LIBNAME_<CONFIG>
3427 New in version 3.8.
3428
3429
3430 <CONFIG>-specific version of IMPORTED_LIBNAME property.
3431
3432 Configuration names correspond to those provided by the project from
3433 which the target is imported.
3434
3435 IMPORTED_LINK_DEPENDENT_LIBRARIES
3436 Dependent shared libraries of an imported shared library.
3437
3438 Shared libraries may be linked to other shared libraries as part of
3439 their implementation. On some platforms the linker searches for the
3440 dependent libraries of shared libraries they are including in the link.
3441 Set this property to the list of dependent shared libraries of an
3442 imported library. The list should be disjoint from the list of inter‐
3443 face libraries in the INTERFACE_LINK_LIBRARIES property. On platforms
3444 requiring dependent shared libraries to be found at link time CMake
3445 uses this list to add appropriate files or paths to the link command
3446 line. Ignored for non-imported targets.
3447
3448 IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG>
3449 <CONFIG>-specific version of IMPORTED_LINK_DEPENDENT_LIBRARIES.
3450
3451 Configuration names correspond to those provided by the project from
3452 which the target is imported. If set, this property completely over‐
3453 rides the generic property for the named configuration.
3454
3455 IMPORTED_LINK_INTERFACE_LANGUAGES
3456 Languages compiled into an IMPORTED static library.
3457
3458 Set this to the list of languages of source files compiled to produce a
3459 STATIC IMPORTED library (such as C or CXX). CMake accounts for these
3460 languages when computing how to link a target to the imported library.
3461 For example, when a C executable links to an imported C++ static
3462 library CMake chooses the C++ linker to satisfy language runtime depen‐
3463 dencies of the static library.
3464
3465 This property is ignored for targets that are not STATIC libraries.
3466 This property is ignored for non-imported targets.
3467
3468 IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>
3469 <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LANGUAGES.
3470
3471 Configuration names correspond to those provided by the project from
3472 which the target is imported. If set, this property completely over‐
3473 rides the generic property for the named configuration.
3474
3475 IMPORTED_LINK_INTERFACE_LIBRARIES
3476 Transitive link interface of an IMPORTED target.
3477
3478 Set this to the list of libraries whose interface is included when an
3479 IMPORTED library target is linked to another target. The libraries
3480 will be included on the link line for the target. Unlike the
3481 LINK_INTERFACE_LIBRARIES property, this property applies to all
3482 imported target types, including STATIC libraries. This property is
3483 ignored for non-imported targets.
3484
3485 This property is ignored if the target also has a non-empty INTER‐
3486 FACE_LINK_LIBRARIES property.
3487
3488 This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.
3489
3490 IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>
3491 <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LIBRARIES.
3492
3493 Configuration names correspond to those provided by the project from
3494 which the target is imported. If set, this property completely over‐
3495 rides the generic property for the named configuration.
3496
3497 This property is ignored if the target also has a non-empty INTER‐
3498 FACE_LINK_LIBRARIES property.
3499
3500 This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.
3501
3502 IMPORTED_LINK_INTERFACE_MULTIPLICITY
3503 Repetition count for cycles of IMPORTED static libraries.
3504
3505 This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets.
3506
3507 IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG>
3508 <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_MULTIPLICITY.
3509
3510 If set, this property completely overrides the generic property for the
3511 named configuration.
3512
3513 IMPORTED_LOCATION
3514 Full path to the main file on disk for an IMPORTED target.
3515
3516 Set this to the location of an IMPORTED target file on disk. For exe‐
3517 cutables this is the location of the executable file. For bundles on
3518 macOS this is the location of the executable file inside Contents/MacOS
3519 under the application bundle folder. For STATIC libraries and modules
3520 this is the location of the library or module. For SHARED libraries on
3521 non-DLL platforms this is the location of the shared library. For
3522 frameworks on macOS this is the location of the library file symlink
3523 just inside the framework folder. For DLLs this is the location of the
3524 .dll part of the library. For UNKNOWN libraries this is the location
3525 of the file to be linked. Ignored for non-imported targets.
3526
3527 The IMPORTED_LOCATION target property may be overridden for a given
3528 configuration <CONFIG> by the configuration-specific IMPORTED_LOCA‐
3529 TION_<CONFIG> target property. Furthermore, the MAP_IMPORTED_CON‐
3530 FIG_<CONFIG> target property may be used to map between a project’s
3531 configurations and those of an imported target. If none of these is
3532 set then the name of any other configuration listed in the
3533 IMPORTED_CONFIGURATIONS target property may be selected and its
3534 IMPORTED_LOCATION_<CONFIG> value used.
3535
3536 To get the location of an imported target read one of the LOCATION or
3537 LOCATION_<CONFIG> properties.
3538
3539 For platforms with import libraries (e.g. Windows) see also
3540 IMPORTED_IMPLIB.
3541
3542 IMPORTED_LOCATION_<CONFIG>
3543 <CONFIG>-specific version of IMPORTED_LOCATION property.
3544
3545 Configuration names correspond to those provided by the project from
3546 which the target is imported.
3547
3548 IMPORTED_NO_SONAME
3549 Specifies that an IMPORTED shared library target has no soname.
3550
3551 Set this property to true for an imported shared library file that has
3552 no soname field. CMake may adjust generated link commands for some
3553 platforms to prevent the linker from using the path to the library in
3554 place of its missing soname. Ignored for non-imported targets.
3555
3556 IMPORTED_NO_SONAME_<CONFIG>
3557 <CONFIG>-specific version of IMPORTED_NO_SONAME property.
3558
3559 Configuration names correspond to those provided by the project from
3560 which the target is imported.
3561
3562 IMPORTED_OBJECTS
3563 New in version 3.9.
3564
3565
3566 A semicolon-separated list of absolute paths to the object files on
3567 disk for an imported object library.
3568
3569 Ignored for non-imported targets.
3570
3571 Projects may skip IMPORTED_OBJECTS if the configuration-specific prop‐
3572 erty IMPORTED_OBJECTS_<CONFIG> is set instead.
3573
3574 IMPORTED_OBJECTS_<CONFIG>
3575 New in version 3.9.
3576
3577
3578 <CONFIG>-specific version of IMPORTED_OBJECTS property.
3579
3580 Configuration names correspond to those provided by the project from
3581 which the target is imported.
3582
3583 IMPORTED_SONAME
3584 The soname of an IMPORTED target of shared library type.
3585
3586 Set this to the soname embedded in an imported shared library. This is
3587 meaningful only on platforms supporting the feature. Ignored for
3588 non-imported targets.
3589
3590 IMPORTED_SONAME_<CONFIG>
3591 <CONFIG>-specific version of IMPORTED_SONAME property.
3592
3593 Configuration names correspond to those provided by the project from
3594 which the target is imported.
3595
3596 IMPORT_PREFIX
3597 What comes before the import library name.
3598
3599 Similar to the target property PREFIX, but used for import libraries
3600 (typically corresponding to a DLL) instead of regular libraries. A
3601 target property that can be set to override the prefix (such as lib) on
3602 an import library name.
3603
3604 IMPORT_SUFFIX
3605 What comes after the import library name.
3606
3607 Similar to the target property SUFFIX, but used for import libraries
3608 (typically corresponding to a DLL) instead of regular libraries. A
3609 target property that can be set to override the suffix (such as .lib)
3610 on an import library name.
3611
3612 INCLUDE_DIRECTORIES
3613 List of preprocessor include file search directories.
3614
3615 This property specifies the list of directories given so far to the
3616 target_include_directories() command. In addition to accepting values
3617 from that command, values may be set directly on any target using the
3618 set_property() command. A target gets its initial value for this prop‐
3619 erty from the value of the INCLUDE_DIRECTORIES directory property.
3620 Both directory and target property values are adjusted by calls to the
3621 include_directories() command.
3622
3623 The value of this property is used by the generators to set the include
3624 paths for the compiler.
3625
3626 Relative paths should not be added to this property directly. Use one
3627 of the commands above instead to handle relative paths.
3628
3629 Contents of INCLUDE_DIRECTORIES may use cmake-generator-expressions(7)
3630 with the syntax $<...>. See the cmake-generator-expressions(7) manual
3631 for available expressions. See the cmake-buildsystem(7) manual for
3632 more on defining buildsystem properties.
3633
3634 INSTALL_NAME_DIR
3635 macOS directory name for installed targets.
3636
3637 INSTALL_NAME_DIR is a string specifying the directory portion of the
3638 “install_name” field of shared libraries on macOS to use in the
3639 installed targets.
3640
3641 This property is initialized by the value of the variable
3642 CMAKE_INSTALL_NAME_DIR if it is set when a target is created.
3643
3644 This property supports generator expressions. In particular, the
3645 $<INSTALL_PREFIX> generator expression can be used to set the directory
3646 relative to the install-time prefix.
3647
3648 INSTALL_REMOVE_ENVIRONMENT_RPATH
3649 New in version 3.16.
3650
3651
3652 Controls whether toolchain-defined rpaths should be removed during
3653 installation.
3654
3655 When a target is being installed, CMake may need to rewrite its rpath
3656 information. This occurs when the install rpath (as specified by the
3657 INSTALL_RPATH target property) has different contents to the rpath that
3658 the target was built with. Some toolchains insert their own rpath con‐
3659 tents into the binary as part of the build. By default, CMake will
3660 preserve those extra inserted contents in the install rpath. For those
3661 scenarios where such toolchain-inserted entries need to be discarded
3662 during install, set the INSTALL_REMOVE_ENVIRONMENT_RPATH target prop‐
3663 erty to true.
3664
3665 This property is initialized by the value of CMAKE_INSTALL_REMOVE_ENVI‐
3666 RONMENT_RPATH when the target is created.
3667
3668 INSTALL_RPATH
3669 The rpath to use for installed targets.
3670
3671 A semicolon-separated list specifying the rpath to use in installed
3672 targets (for platforms that support it). This property is initialized
3673 by the value of the variable CMAKE_INSTALL_RPATH if it is set when a
3674 target is created.
3675
3676 Because the rpath may contain ${ORIGIN}, which coincides with CMake
3677 syntax, the contents of INSTALL_RPATH are properly escaped in the
3678 cmake_install.cmake script (see policy CMP0095.)
3679
3680 This property supports generator expressions.
3681
3682 INSTALL_RPATH_USE_LINK_PATH
3683 Add paths to linker search and installed rpath.
3684
3685 INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to True will
3686 append to the runtime search path (rpath) of installed binaries any
3687 directories outside the project that are in the linker search path or
3688 contain linked library files. The directories are appended after the
3689 value of the INSTALL_RPATH target property.
3690
3691 This property is initialized by the value of the variable
3692 CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is cre‐
3693 ated.
3694
3695 INTERFACE_AUTOUIC_OPTIONS
3696 List of interface options to pass to uic.
3697
3698 Targets may populate this property to publish the options required to
3699 use when invoking uic. Consuming targets can add entries to their own
3700 AUTOUIC_OPTIONS property such as $<TARGET_PROPERTY:foo,INTER‐
3701 FACE_AUTOUIC_OPTIONS> to use the uic options specified in the interface
3702 of foo. This is done automatically by the target_link_libraries() com‐
3703 mand.
3704
3705 This property supports generator expressions. See the cmake-genera‐
3706 tor-expressions(7) manual for available expressions.
3707
3708 INTERFACE_COMPILE_DEFINITIONS
3709 List of public compile definitions requirements for a library.
3710
3711 Targets may populate this property to publish the compile definitions
3712 required to compile against the headers for the target. The tar‐
3713 get_compile_definitions() command populates this property with values
3714 given to the PUBLIC and INTERFACE keywords. Projects may also get and
3715 set the property directly.
3716
3717 When target dependencies are specified using target_link_libraries(),
3718 CMake will read this property from all target dependencies to determine
3719 the build properties of the consumer.
3720
3721 Contents of INTERFACE_COMPILE_DEFINITIONS may use “generator expres‐
3722 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
3723 manual for available expressions. See the cmake-buildsystem(7) -manual
3724 for more on defining buildsystem properties.
3725
3726 INTERFACE_COMPILE_FEATURES
3727 New in version 3.1.
3728
3729
3730 List of public compile features requirements for a library.
3731
3732 Targets may populate this property to publish the compile features
3733 required to compile against the headers for the target. The tar‐
3734 get_compile_features() command populates this property with values
3735 given to the PUBLIC and INTERFACE keywords. Projects may also get and
3736 set the property directly.
3737
3738 When target dependencies are specified using target_link_libraries(),
3739 CMake will read this property from all target dependencies to determine
3740 the build properties of the consumer.
3741
3742 Contents of INTERFACE_COMPILE_FEATURES may use “generator expressions”
3743 with the syntax $<...>. See the cmake-generator-expressions(7) manual
3744 for available expressions. See the cmake-buildsystem(7) -manual for
3745 more on defining buildsystem properties.
3746
3747 See the cmake-compile-features(7) manual for information on compile
3748 features and a list of supported compilers.
3749
3750 INTERFACE_COMPILE_OPTIONS
3751 List of public compile options requirements for a library.
3752
3753 Targets may populate this property to publish the compile options
3754 required to compile against the headers for the target. The tar‐
3755 get_compile_options() command populates this property with values given
3756 to the PUBLIC and INTERFACE keywords. Projects may also get and set
3757 the property directly.
3758
3759 When target dependencies are specified using target_link_libraries(),
3760 CMake will read this property from all target dependencies to determine
3761 the build properties of the consumer.
3762
3763 Contents of INTERFACE_COMPILE_OPTIONS may use “generator expressions”
3764 with the syntax $<...>. See the cmake-generator-expressions(7) manual
3765 for available expressions. See the cmake-buildsystem(7) -manual for
3766 more on defining buildsystem properties.
3767
3768 INTERFACE_INCLUDE_DIRECTORIES
3769 List of public include directories requirements for a library.
3770
3771 Targets may populate this property to publish the include directories
3772 required to compile against the headers for the target. The tar‐
3773 get_include_directories() command populates this property with values
3774 given to the PUBLIC and INTERFACE keywords. Projects may also get and
3775 set the property directly.
3776
3777 When target dependencies are specified using target_link_libraries(),
3778 CMake will read this property from all target dependencies to determine
3779 the build properties of the consumer.
3780
3781 Contents of INTERFACE_INCLUDE_DIRECTORIES may use “generator expres‐
3782 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
3783 manual for available expressions. See the cmake-buildsystem(7) -manual
3784 for more on defining buildsystem properties.
3785
3786 Include directories usage requirements commonly differ between the
3787 build-tree and the install-tree. The BUILD_INTERFACE and
3788 INSTALL_INTERFACE generator expressions can be used to describe sepa‐
3789 rate usage requirements based on the usage location. Relative paths
3790 are allowed within the INSTALL_INTERFACE expression and are interpreted
3791 relative to the installation prefix. For example:
3792
3793 target_include_directories(mylib INTERFACE
3794 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib>
3795 $<INSTALL_INTERFACE:include/mylib> # <prefix>/include/mylib
3796 )
3797
3798 Creating Relocatable Packages
3799 Note that it is not advisable to populate the INSTALL_INTERFACE of the
3800 INTERFACE_INCLUDE_DIRECTORIES of a target with absolute paths to the
3801 include directories of dependencies. That would hard-code into
3802 installed packages the include directory paths for dependencies as
3803 found on the machine the package was made on.
3804
3805 The INSTALL_INTERFACE of the INTERFACE_INCLUDE_DIRECTORIES is only
3806 suitable for specifying the required include directories for headers
3807 provided with the target itself, not those provided by the transitive
3808 dependencies listed in its INTERFACE_LINK_LIBRARIES target property.
3809 Those dependencies should themselves be targets that specify their own
3810 header locations in INTERFACE_INCLUDE_DIRECTORIES.
3811
3812 See the Creating Relocatable Packages section of the cmake-packages(7)
3813 manual for discussion of additional care that must be taken when speci‐
3814 fying usage requirements while creating packages for redistribution.
3815
3816 INTERFACE_LINK_DEPENDS
3817 New in version 3.13.
3818
3819
3820 Additional public interface files on which a target binary depends for
3821 linking.
3822
3823 This property is supported only by Ninja and Makefile Generators. It
3824 is intended to specify dependencies on “linker scripts” for custom
3825 Makefile link rules.
3826
3827 When target dependencies are specified using target_link_libraries(),
3828 CMake will read this property from all target dependencies to determine
3829 the build properties of the consumer.
3830
3831 Contents of INTERFACE_LINK_DEPENDS may use “generator expressions” with
3832 the syntax $<...>. See the cmake-generator-expressions(7) manual for
3833 available expressions. See the cmake-buildsystem(7) -manual for more
3834 on defining buildsystem properties.
3835
3836 Link dependency files usage requirements commonly differ between the
3837 build-tree and the install-tree. The BUILD_INTERFACE and
3838 INSTALL_INTERFACE generator expressions can be used to describe sepa‐
3839 rate usage requirements based on the usage location. Relative paths
3840 are allowed within the INSTALL_INTERFACE expression and are interpreted
3841 relative to the installation prefix. For example:
3842
3843 set_property(TARGET mylib PROPERTY INTERFACE_LINK_DEPENDS
3844 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mylinkscript>
3845 $<INSTALL_INTERFACE:mylinkscript> # <prefix>/mylinkscript
3846 )
3847
3848 INTERFACE_LINK_DIRECTORIES
3849 New in version 3.13.
3850
3851
3852 List of public link directories requirements for a library.
3853
3854 Targets may populate this property to publish the link directories
3855 required to compile against the headers for the target. The tar‐
3856 get_link_directories() command populates this property with values
3857 given to the PUBLIC and INTERFACE keywords. Projects may also get and
3858 set the property directly.
3859
3860 When target dependencies are specified using target_link_libraries(),
3861 CMake will read this property from all target dependencies to determine
3862 the build properties of the consumer.
3863
3864 Contents of INTERFACE_LINK_DIRECTORIES may use “generator expressions”
3865 with the syntax $<...>. See the cmake-generator-expressions(7) manual
3866 for available expressions. See the cmake-buildsystem(7) -manual for
3867 more on defining buildsystem properties.
3868
3869 INTERFACE_LINK_LIBRARIES
3870 List public interface libraries for a library.
3871
3872 This property contains the list of transitive link dependencies. When
3873 the target is linked into another target using the tar‐
3874 get_link_libraries() command, the libraries listed (and recursively
3875 their link interface libraries) will be provided to the other target
3876 also. This property is overridden by the LINK_INTERFACE_LIBRARIES or
3877 LINK_INTERFACE_LIBRARIES_<CONFIG> property if policy CMP0022 is OLD or
3878 unset.
3879
3880 Contents of INTERFACE_LINK_LIBRARIES may use “generator expressions”
3881 with the syntax $<...>. See the cmake-generator-expressions(7) manual
3882 for available expressions. See the cmake-buildsystem(7) manual for
3883 more on defining buildsystem properties.
3884
3885 NOTE:
3886 A call to target_link_libraries(<target> ...) may update this prop‐
3887 erty on <target>. If <target> was not created in the same directory
3888 as the call then target_link_libraries() will wrap each entry with
3889 the form ::@(directory-id);...;::@, where the ::@ is literal and the
3890 (directory-id) is unspecified. This tells the generators that the
3891 named libraries must be looked up in the scope of the caller rather
3892 than in the scope in which the <target> was created. Valid direc‐
3893 tory ids are stripped on export by the install(EXPORT) and export()
3894 commands.
3895
3896 Creating Relocatable Packages
3897 Note that it is not advisable to populate the INTERFACE_LINK_LIBRARIES
3898 of a target with absolute paths to dependencies. That would hard-code
3899 into installed packages the library file paths for dependencies as
3900 found on the machine the package was made on.
3901
3902 See the Creating Relocatable Packages section of the cmake-packages(7)
3903 manual for discussion of additional care that must be taken when speci‐
3904 fying usage requirements while creating packages for redistribution.
3905
3906 INTERFACE_LINK_OPTIONS
3907 New in version 3.13.
3908
3909
3910 List of public link options requirements for a library.
3911
3912 Targets may populate this property to publish the link options required
3913 to compile against the headers for the target. The tar‐
3914 get_link_options() command populates this property with values given to
3915 the PUBLIC and INTERFACE keywords. Projects may also get and set the
3916 property directly.
3917
3918 When target dependencies are specified using target_link_libraries(),
3919 CMake will read this property from all target dependencies to determine
3920 the build properties of the consumer.
3921
3922 Contents of INTERFACE_LINK_OPTIONS may use “generator expressions” with
3923 the syntax $<...>. See the cmake-generator-expressions(7) manual for
3924 available expressions. See the cmake-buildsystem(7) -manual for more
3925 on defining buildsystem properties.
3926
3927 INTERFACE_POSITION_INDEPENDENT_CODE
3928 Whether consumers need to create a position-independent target
3929
3930 The INTERFACE_POSITION_INDEPENDENT_CODE property informs consumers of
3931 this target whether they must set their POSITION_INDEPENDENT_CODE prop‐
3932 erty to ON. If this property is set to ON, then the POSITION_INDEPEN‐
3933 DENT_CODE property on all consumers will be set to ON. Similarly, if
3934 this property is set to OFF, then the POSITION_INDEPENDENT_CODE prop‐
3935 erty on all consumers will be set to OFF. If this property is unde‐
3936 fined, then consumers will determine their POSITION_INDEPENDENT_CODE
3937 property by other means. Consumers must ensure that the targets that
3938 they link to have a consistent requirement for their INTERFACE_POSI‐
3939 TION_INDEPENDENT_CODE property.
3940
3941 Contents of INTERFACE_POSITION_INDEPENDENT_CODE may use “generator
3942 expressions” with the syntax $<...>. See the cmake-generator-expres‐
3943 sions(7) manual for available expressions. See the cmake-buildsys‐
3944 tem(7) manual for more on defining buildsystem properties.
3945
3946 INTERFACE_PRECOMPILE_HEADERS
3947 New in version 3.16.
3948
3949
3950 List of interface header files to precompile into consuming targets.
3951
3952 Targets may populate this property to publish the header files for con‐
3953 suming targets to precompile. The target_precompile_headers() command
3954 populates this property with values given to the PUBLIC and INTERFACE
3955 keywords. Projects may also get and set the property directly. See
3956 the discussion in target_precompile_headers() for guidance on appropri‐
3957 ate use of this property for installed or exported targets.
3958
3959 Contents of INTERFACE_PRECOMPILE_HEADERS may use “generator expres‐
3960 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
3961 manual for available expressions. See the cmake-buildsystem(7) manual
3962 for more on defining buildsystem properties.
3963
3964 INTERFACE_SOURCES
3965 New in version 3.1.
3966
3967
3968 List of interface sources to compile into consuming targets.
3969
3970 Targets may populate this property to publish the sources for consuming
3971 targets to compile. The target_sources() command populates this prop‐
3972 erty with values given to the PUBLIC and INTERFACE keywords. Projects
3973 may also get and set the property directly.
3974
3975 When target dependencies are specified using target_link_libraries(),
3976 CMake will read this property from all target dependencies to determine
3977 the sources of the consumer.
3978
3979 Contents of INTERFACE_SOURCES may use “generator expressions” with the
3980 syntax $<...>. See the cmake-generator-expressions(7) manual for
3981 available expressions. See the cmake-buildsystem(7) manual for more on
3982 defining buildsystem properties.
3983
3984 INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
3985 List of public system include directories for a library.
3986
3987 Targets may populate this property to publish the include directories
3988 which contain system headers, and therefore should not result in com‐
3989 piler warnings. The target_include_directories(SYSTEM) command signa‐
3990 ture populates this property with values given to the PUBLIC and INTER‐
3991 FACE keywords.
3992
3993 Projects may also get and set the property directly, but must be aware
3994 that adding directories to this property does not make those directo‐
3995 ries used during compilation. Adding directories to this property
3996 marks directories as SYSTEM which otherwise would be used in a non-SYS‐
3997 TEM manner. This can appear similar to ‘duplication’, so prefer the
3998 high-level target_include_directories(SYSTEM) command and avoid setting
3999 the property by low-level means.
4000
4001 When target dependencies are specified using target_link_libraries(),
4002 CMake will read this property from all target dependencies to mark the
4003 same include directories as containing system headers.
4004
4005 Contents of INTERFACE_SYSTEM_INCLUDE_DIRECTORIES may use “generator
4006 expressions” with the syntax $<...>. See the cmake-generator-expres‐
4007 sions(7) manual for available expressions. See the cmake-buildsys‐
4008 tem(7) manual for more on defining buildsystem properties.
4009
4010 INTERPROCEDURAL_OPTIMIZATION
4011 Enable interprocedural optimization for a target.
4012
4013 If set to true, enables interprocedural optimizations if they are known
4014 to be supported by the compiler. Depending on value of policy CMP0069,
4015 the error will be reported or ignored, if interprocedural optimization
4016 is enabled but not supported.
4017
4018 This property is initialized by the CMAKE_INTERPROCEDURAL_OPTIMIZATION
4019 variable if it is set when a target is created.
4020
4021 INTERPROCEDURAL_OPTIMIZATION_<CONFIG>
4022 Per-configuration interprocedural optimization for a target.
4023
4024 This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION.
4025 If set, this property overrides the generic property for the named con‐
4026 figuration.
4027
4028 This property is initialized by the CMAKE_INTERPROCEDURAL_OPTIMIZA‐
4029 TION_<CONFIG> variable if it is set when a target is created.
4030
4031 IOS_INSTALL_COMBINED
4032 New in version 3.5.
4033
4034
4035 Build a combined (device and simulator) target when installing.
4036
4037 When this property is set to set to false (which is the default) then
4038 it will either be built with the device SDK or the simulator SDK
4039 depending on the SDK set. But if this property is set to true then the
4040 target will at install time also be built for the corresponding SDK and
4041 combined into one library.
4042
4043 NOTE:
4044 If a selected architecture is available for both: device SDK and
4045 simulator SDK it will be built for the SDK selected by
4046 CMAKE_OSX_SYSROOT and removed from the corresponding SDK.
4047
4048 This feature requires at least Xcode version 6.
4049
4050 ISPC_HEADER_DIRECTORY
4051 New in version 3.19.
4052
4053
4054 Specify relative output directory for ISPC headers provided by the tar‐
4055 get.
4056
4057 If the target contains ISPC source files, this specifies the directory
4058 in which the generated headers will be placed. Relative paths are
4059 treated with respect to the value of CMAKE_CURRENT_BINARY_DIR. When
4060 this property is not set, the headers will be placed a generator
4061 defined build directory. If the variable CMAKE_ISPC_HEADER_DIRECTORY is
4062 set when a target is created its value is used to initialize this prop‐
4063 erty.
4064
4065 ISPC_HEADER_SUFFIX
4066 New in version 3.19.2.
4067
4068
4069 Specify output suffix to be used for ISPC generated headers provided by
4070 the target.
4071
4072 This property is initialized by the value of the CMAKE_ISPC_HEADER_SUF‐
4073 FIX variable if it is set when a target is created.
4074
4075 If the target contains ISPC source files, this specifies the header
4076 suffix to be used for the generated headers.
4077
4078 The default value is _ispc.h.
4079
4080 ISPC_INSTRUCTION_SETS
4081 New in version 3.19.
4082
4083
4084 List of instruction set architectures to generate code for.
4085
4086 This property is initialized by the value of the CMAKE_ISPC_INSTRUC‐
4087 TION_SETS variable if it is set when a target is created.
4088
4089 The ISPC_INSTRUCTION_SETS target property must be used when generating
4090 for multiple instruction sets so that CMake can track what object files
4091 will be generated.
4092
4093 Examples
4094 set_property(TARGET tgt PROPERTY ISPC_INSTRUCTION_SETS avx2-i32x4 avx512skx-i32x835)
4095
4096 Generates code for avx2 and avx512skx target architectures.
4097
4098 JOB_POOL_COMPILE
4099 Ninja only: Pool used for compiling.
4100
4101 The number of parallel compile processes could be limited by defining
4102 pools with the global JOB_POOLS property and then specifying here the
4103 pool name.
4104
4105 For instance:
4106
4107 set_property(TARGET myexe PROPERTY JOB_POOL_COMPILE ten_jobs)
4108
4109 This property is initialized by the value of CMAKE_JOB_POOL_COMPILE.
4110
4111 JOB_POOL_LINK
4112 Ninja only: Pool used for linking.
4113
4114 The number of parallel link processes could be limited by defining
4115 pools with the global JOB_POOLS property and then specifying here the
4116 pool name.
4117
4118 For instance:
4119
4120 set_property(TARGET myexe PROPERTY JOB_POOL_LINK two_jobs)
4121
4122 This property is initialized by the value of CMAKE_JOB_POOL_LINK.
4123
4124 JOB_POOL_PRECOMPILE_HEADER
4125 New in version 3.17.
4126
4127
4128 Ninja only: Pool used for generating pre-compiled headers.
4129
4130 The number of parallel compile processes could be limited by defining
4131 pools with the global JOB_POOLS property and then specifying here the
4132 pool name.
4133
4134 For instance:
4135
4136 set_property(TARGET myexe PROPERTY JOB_POOL_PRECOMPILE_HEADER two_jobs)
4137
4138 This property is initialized by the value of CMAKE_JOB_POOL_PRECOM‐
4139 PILE_HEADER.
4140
4141 If neither JOB_POOL_PRECOMPILE_HEADER nor CMAKE_JOB_POOL_PRECOM‐
4142 PILE_HEADER are set then JOB_POOL_COMPILE will be used for this task.
4143
4144 LABELS
4145 Specify a list of text labels associated with a target.
4146
4147 Target label semantics are currently unspecified.
4148
4149 <LANG>_CLANG_TIDY
4150 New in version 3.6.
4151
4152
4153 This property is implemented only when <LANG> is C or CXX.
4154
4155 Specify a semicolon-separated list containing a command line for the
4156 clang-tidy tool. The Makefile Generators and the Ninja generator will
4157 run this tool along with the compiler and report a warning if the tool
4158 reports any problems.
4159
4160 This property is initialized by the value of the
4161 CMAKE_<LANG>_CLANG_TIDY variable if it is set when a target is created.
4162
4163 <LANG>_COMPILER_LAUNCHER
4164 New in version 3.4.
4165
4166
4167 This property is implemented only when <LANG> is C, CXX, Fortran, ISPC,
4168 OBJC, OBJCXX, or CUDA.
4169
4170 Specify a semicolon-separated list containing a command line for a com‐
4171 piler launching tool. The Makefile Generators and the Ninja generator
4172 will run this tool and pass the compiler and its arguments to the tool.
4173 Some example tools are distcc and ccache.
4174
4175 This property is initialized by the value of the CMAKE_<LANG>_COM‐
4176 PILER_LAUNCHER variable if it is set when a target is created.
4177
4178 <LANG>_CPPCHECK
4179 New in version 3.10.
4180
4181
4182 This property is supported only when <LANG> is C or CXX.
4183
4184 Specify a semicolon-separated list containing a command line for the
4185 cppcheck static analysis tool. The Makefile Generators and the Ninja
4186 generator will run cppcheck along with the compiler and report any
4187 problems. If the command-line specifies the exit code options to
4188 cppcheck then the build will fail if the tool returns non-zero.
4189
4190 This property is initialized by the value of the CMAKE_<LANG>_CPPCHECK
4191 variable if it is set when a target is created.
4192
4193 <LANG>_CPPLINT
4194 New in version 3.8.
4195
4196
4197 This property is supported only when <LANG> is C or CXX.
4198
4199 Specify a semicolon-separated list containing a command line for the
4200 cpplint style checker. The Makefile Generators and the Ninja generator
4201 will run cpplint along with the compiler and report any problems.
4202
4203 This property is initialized by the value of the CMAKE_<LANG>_CPPLINT
4204 variable if it is set when a target is created.
4205
4206 <LANG>_INCLUDE_WHAT_YOU_USE
4207 New in version 3.3.
4208
4209
4210 This property is implemented only when <LANG> is C or CXX.
4211
4212 Specify a semicolon-separated list containing a command line for the
4213 include-what-you-use tool. The Makefile Generators and the Ninja gen‐
4214 erator will run this tool along with the compiler and report a warning
4215 if the tool reports any problems.
4216
4217 This property is initialized by the value of the
4218 CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable if it is set when a target
4219 is created.
4220
4221 <LANG>_VISIBILITY_PRESET
4222 Value for symbol visibility compile flags
4223
4224 The <LANG>_VISIBILITY_PRESET property determines the value passed in a
4225 visibility related compile option, such as -fvisibility= for <LANG>.
4226 This property affects compilation in sources of all types of targets
4227 (subject to policy CMP0063).
4228
4229 This property is initialized by the value of the CMAKE_<LANG>_VISIBIL‐
4230 ITY_PRESET variable if it is set when a target is created.
4231
4232 LIBRARY_OUTPUT_DIRECTORY
4233 Output directory in which to build LIBRARY target files.
4234
4235 This property specifies the directory into which library target files
4236 should be built. The property value may use generator expressions.
4237 Multi-configuration generators (VS, Xcode) append a per-configuration
4238 subdirectory to the specified directory unless a generator expression
4239 is used.
4240
4241 This property is initialized by the value of the variable
4242 CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.
4243
4244 See also the LIBRARY_OUTPUT_DIRECTORY_<CONFIG> target property.
4245
4246 LIBRARY_OUTPUT_DIRECTORY_<CONFIG>
4247 Per-configuration output directory for LIBRARY target files.
4248
4249 This is a per-configuration version of the LIBRARY_OUTPUT_DIRECTORY
4250 target property, but multi-configuration generators (Visual Studio Gen‐
4251 erators, Xcode) do NOT append a per-configuration subdirectory to the
4252 specified directory. This property is initialized by the value of the
4253 CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a
4254 target is created.
4255
4256 Contents of LIBRARY_OUTPUT_DIRECTORY_<CONFIG> may use generator expres‐
4257 sions.
4258
4259 LIBRARY_OUTPUT_NAME
4260 Output name for LIBRARY target files.
4261
4262 This property specifies the base name for library target files. It
4263 overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties.
4264
4265 See also the LIBRARY_OUTPUT_NAME_<CONFIG> target property.
4266
4267 LIBRARY_OUTPUT_NAME_<CONFIG>
4268 Per-configuration output name for LIBRARY target files.
4269
4270 This is the configuration-specific version of the LIBRARY_OUTPUT_NAME
4271 target property.
4272
4273 LINK_DEPENDS
4274 Additional files on which a target binary depends for linking.
4275
4276 Specifies a semicolon-separated list of full-paths to files on which
4277 the link rule for this target depends. The target binary will be
4278 linked if any of the named files is newer than it.
4279
4280 This property is supported only by Ninja and Makefile Generators. It
4281 is intended to specify dependencies on “linker scripts” for custom
4282 Makefile link rules.
4283
4284 Contents of LINK_DEPENDS may use “generator expressions” with the syn‐
4285 tax $<...>. See the cmake-generator-expressions(7) manual for avail‐
4286 able expressions. See the cmake-buildsystem(7) manual for more on
4287 defining buildsystem properties.
4288
4289 LINK_DEPENDS_NO_SHARED
4290 Do not depend on linked shared library files.
4291
4292 Set this property to true to tell CMake generators not to add
4293 file-level dependencies on the shared library files linked by this tar‐
4294 get. Modification to the shared libraries will not be sufficient to
4295 re-link this target. Logical target-level dependencies will not be
4296 affected so the linked shared libraries will still be brought up to
4297 date before this target is built.
4298
4299 This property is initialized by the value of the variable
4300 CMAKE_LINK_DEPENDS_NO_SHARED if it is set when a target is created.
4301
4302 LINK_DIRECTORIES
4303 New in version 3.13.
4304
4305
4306 List of directories to use for the link step of shared library, module
4307 and executable targets.
4308
4309 This property holds a semicolon-separated list of directories specified
4310 so far for its target. Use the target_link_directories() command to
4311 append more search directories.
4312
4313 This property is initialized by the LINK_DIRECTORIES directory property
4314 when a target is created, and is used by the generators to set the
4315 search directories for the linker.
4316
4317 Contents of LINK_DIRECTORIES may use “generator expressions” with the
4318 syntax $<...>. See the cmake-generator-expressions(7) manual for
4319 available expressions. See the cmake-buildsystem(7) manual for more on
4320 defining buildsystem properties.
4321
4322 LINK_FLAGS
4323 Additional flags to use when linking this target if it is a shared
4324 library, module library, or an executable. Static libraries need to use
4325 STATIC_LIBRARY_OPTIONS or STATIC_LIBRARY_FLAGS properties.
4326
4327 The LINK_FLAGS property, managed as a string, can be used to add extra
4328 flags to the link step of a target. LINK_FLAGS_<CONFIG> will add to
4329 the configuration <CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL,
4330 RELWITHDEBINFO, …
4331
4332 NOTE:
4333 This property has been superseded by LINK_OPTIONS property.
4334
4335 LINK_FLAGS_<CONFIG>
4336 Per-configuration linker flags for a SHARED library, MODULE or EXE‐
4337 CUTABLE target.
4338
4339 This is the configuration-specific version of LINK_FLAGS.
4340
4341 NOTE:
4342 This property has been superseded by LINK_OPTIONS property.
4343
4344 LINK_INTERFACE_LIBRARIES
4345 List public interface libraries for a shared library or executable.
4346
4347 By default linking to a shared library target transitively links to
4348 targets with which the library itself was linked. For an executable
4349 with exports (see the ENABLE_EXPORTS target property) no default tran‐
4350 sitive link dependencies are used. This property replaces the default
4351 transitive link dependencies with an explicit list. When the target is
4352 linked into another target using the target_link_libraries() command,
4353 the libraries listed (and recursively their link interface libraries)
4354 will be provided to the other target also. If the list is empty then
4355 no transitive link dependencies will be incorporated when this target
4356 is linked into another target even if the default set is non-empty.
4357 This property is initialized by the value of the CMAKE_LINK_INTER‐
4358 FACE_LIBRARIES variable if it is set when a target is created. This
4359 property is ignored for STATIC libraries.
4360
4361 This property is overridden by the INTERFACE_LINK_LIBRARIES property if
4362 policy CMP0022 is NEW.
4363
4364 This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.
4365
4366 Creating Relocatable Packages
4367 Note that it is not advisable to populate the LINK_INTERFACE_LIBRARIES
4368 of a target with absolute paths to dependencies. That would hard-code
4369 into installed packages the library file paths for dependencies as
4370 found on the machine the package was made on.
4371
4372 See the Creating Relocatable Packages section of the cmake-packages(7)
4373 manual for discussion of additional care that must be taken when speci‐
4374 fying usage requirements while creating packages for redistribution.
4375
4376 LINK_INTERFACE_LIBRARIES_<CONFIG>
4377 Per-configuration list of public interface libraries for a target.
4378
4379 This is the configuration-specific version of LINK_INTERFACE_LIBRARIES.
4380 If set, this property completely overrides the generic property for the
4381 named configuration.
4382
4383 This property is overridden by the INTERFACE_LINK_LIBRARIES property if
4384 policy CMP0022 is NEW.
4385
4386 This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.
4387
4388 Creating Relocatable Packages
4389 Note that it is not advisable to populate the LINK_INTER‐
4390 FACE_LIBRARIES_<CONFIG> of a target with absolute paths to dependen‐
4391 cies. That would hard-code into installed packages the library file
4392 paths for dependencies as found on the machine the package was made on.
4393
4394 See the Creating Relocatable Packages section of the cmake-packages(7)
4395 manual for discussion of additional care that must be taken when speci‐
4396 fying usage requirements while creating packages for redistribution.
4397
4398 LINK_INTERFACE_MULTIPLICITY
4399 Repetition count for STATIC libraries with cyclic dependencies.
4400
4401 When linking to a STATIC library target with cyclic dependencies the
4402 linker may need to scan more than once through the archives in the
4403 strongly connected component of the dependency graph. CMake by default
4404 constructs the link line so that the linker will scan through the com‐
4405 ponent at least twice. This property specifies the minimum number of
4406 scans if it is larger than the default. CMake uses the largest value
4407 specified by any target in a component.
4408
4409 LINK_INTERFACE_MULTIPLICITY_<CONFIG>
4410 Per-configuration repetition count for cycles of STATIC libraries.
4411
4412 This is the configuration-specific version of LINK_INTERFACE_MULTIPLIC‐
4413 ITY. If set, this property completely overrides the generic property
4414 for the named configuration.
4415
4416 LINK_LIBRARIES
4417 List of direct link dependencies.
4418
4419 This property specifies the list of libraries or targets which will be
4420 used for linking. In addition to accepting values from the tar‐
4421 get_link_libraries() command, values may be set directly on any target
4422 using the set_property() command.
4423
4424 The value of this property is used by the generators to set the link
4425 libraries for the compiler.
4426
4427 Contents of LINK_LIBRARIES may use “generator expressions” with the
4428 syntax $<...>. See the cmake-generator-expressions(7) manual for
4429 available expressions. See the cmake-buildsystem(7) manual for more on
4430 defining buildsystem properties.
4431
4432 NOTE:
4433 A call to target_link_libraries(<target> ...) may update this prop‐
4434 erty on <target>. If <target> was not created in the same directory
4435 as the call then target_link_libraries() will wrap each entry with
4436 the form ::@(directory-id);...;::@, where the ::@ is literal and the
4437 (directory-id) is unspecified. This tells the generators that the
4438 named libraries must be looked up in the scope of the caller rather
4439 than in the scope in which the <target> was created. Valid direc‐
4440 tory ids are stripped on export by the install(EXPORT) and export()
4441 commands.
4442
4443 LINK_OPTIONS
4444 New in version 3.13.
4445
4446
4447 List of options to use for the link step of shared library, module and
4448 executable targets as well as the device link step. Targets that are
4449 static libraries need to use the STATIC_LIBRARY_OPTIONS target prop‐
4450 erty.
4451
4452 These options are used for both normal linking and device linking (see
4453 policy CMP0105). To control link options for normal and device link
4454 steps, $<HOST_LINK> and $<DEVICE_LINK> generator expressions can be
4455 used.
4456
4457 This property holds a semicolon-separated list of options specified so
4458 far for its target. Use the target_link_options() command to append
4459 more options.
4460
4461 This property is initialized by the LINK_OPTIONS directory property
4462 when a target is created, and is used by the generators to set the
4463 options for the compiler.
4464
4465 Contents of LINK_OPTIONS may use “generator expressions” with the syn‐
4466 tax $<...>. See the cmake-generator-expressions(7) manual for avail‐
4467 able expressions. See the cmake-buildsystem(7) manual for more on
4468 defining buildsystem properties.
4469
4470 NOTE:
4471 This property must be used in preference to LINK_FLAGS property.
4472
4473 LINK_SEARCH_END_STATIC
4474 End a link line such that static system libraries are used.
4475
4476 Some linkers support switches such as -Bstatic and -Bdynamic to deter‐
4477 mine whether to use static or shared libraries for -lXXX options.
4478 CMake uses these options to set the link type for libraries whose full
4479 paths are not known or (in some cases) are in implicit link directories
4480 for the platform. By default CMake adds an option at the end of the
4481 library list (if necessary) to set the linker search type back to its
4482 starting type. This property switches the final linker search type to
4483 -Bstatic regardless of how it started.
4484
4485 This property is initialized by the value of the variable
4486 CMAKE_LINK_SEARCH_END_STATIC if it is set when a target is created.
4487
4488 See also LINK_SEARCH_START_STATIC.
4489
4490 LINK_SEARCH_START_STATIC
4491 Assume the linker looks for static libraries by default.
4492
4493 Some linkers support switches such as -Bstatic and -Bdynamic to deter‐
4494 mine whether to use static or shared libraries for -lXXX options.
4495 CMake uses these options to set the link type for libraries whose full
4496 paths are not known or (in some cases) are in implicit link directories
4497 for the platform. By default the linker search type is assumed to be
4498 -Bdynamic at the beginning of the library list. This property switches
4499 the assumption to -Bstatic. It is intended for use when linking an
4500 executable statically (e.g. with the GNU -static option).
4501
4502 This property is initialized by the value of the variable
4503 CMAKE_LINK_SEARCH_START_STATIC if it is set when a target is
4504 created.
4505
4506 See also LINK_SEARCH_END_STATIC.
4507
4508 LINK_WHAT_YOU_USE
4509 New in version 3.7.
4510
4511
4512 This is a boolean option that when set to TRUE will automatically run
4513 ldd -r -u on the target after it is linked. In addition, the linker
4514 flag -Wl,--no-as-needed will be passed to the target with the link com‐
4515 mand so that all libraries specified on the command line will be linked
4516 into the target. This will result in the link producing a list of
4517 libraries that provide no symbols used by this target but are being
4518 linked to it. This is only applicable to executable and shared library
4519 targets and will only work when ld and ldd accept the flags used.
4520
4521 This property is initialized by the value of the
4522 CMAKE_LINK_WHAT_YOU_USE variable if it is set when a target is created.
4523
4524 LINKER_LANGUAGE
4525 Specifies language whose compiler will invoke the linker.
4526
4527 For executables, shared libraries, and modules, this sets the language
4528 whose compiler is used to link the target (such as “C” or “CXX”). A
4529 typical value for an executable is the language of the source file pro‐
4530 viding the program entry point (main). If not set, the language with
4531 the highest linker preference value is the default. See documentation
4532 of CMAKE_<LANG>_LINKER_PREFERENCE variables.
4533
4534 If this property is not set by the user, it will be calculated at gen‐
4535 erate-time by CMake.
4536
4537 LOCATION
4538 Read-only location of a target on disk.
4539
4540 For an imported target, this read-only property returns the value of
4541 the LOCATION_<CONFIG> property for an unspecified configuration <CON‐
4542 FIG> provided by the target.
4543
4544 For a non-imported target, this property is provided for compatibility
4545 with CMake 2.4 and below. It was meant to get the location of an exe‐
4546 cutable target’s output file for use in add_custom_command(). The path
4547 may contain a build-system-specific portion that is replaced at build
4548 time with the configuration getting built (such as $(ConfigurationName)
4549 in VS). In CMake 2.6 and above add_custom_command() automatically rec‐
4550 ognizes a target name in its COMMAND and DEPENDS options and computes
4551 the target location. In CMake 2.8.4 and above add_custom_command()
4552 recognizes generator expressions to refer to target locations anywhere
4553 in the command. Therefore this property is not needed for creating
4554 custom commands.
4555
4556 Do not set properties that affect the location of a target after read‐
4557 ing this property. These include properties whose names match (RUN‐
4558 TIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?,
4559 (IMPLIB_)?(PREFIX|SUFFIX), or “LINKER_LANGUAGE”. Failure to follow
4560 this rule is not diagnosed and leaves the location of the target unde‐
4561 fined.
4562
4563 LOCATION_<CONFIG>
4564 Read-only property providing a target location on disk.
4565
4566 A read-only property that indicates where a target’s main file is
4567 located on disk for the configuration <CONFIG>. The property is
4568 defined only for library and executable targets. An imported target
4569 may provide a set of configurations different from that of the import‐
4570 ing project. By default CMake looks for an exact-match but otherwise
4571 uses an arbitrary available configuration. Use the MAP_IMPORTED_CON‐
4572 FIG_<CONFIG> property to map imported configurations explicitly.
4573
4574 Do not set properties that affect the location of a target after read‐
4575 ing this property. These include properties whose names match (RUN‐
4576 TIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?,
4577 (IMPLIB_)?(PREFIX|SUFFIX), or LINKER_LANGUAGE. Failure to follow this
4578 rule is not diagnosed and leaves the location of the target undefined.
4579
4580 MACHO_COMPATIBILITY_VERSION
4581 New in version 3.17.
4582
4583
4584 What compatibility version number is this target for Mach-O binaries.
4585
4586 For shared libraries on Mach-O systems (e.g. macOS, iOS) the MACHO_COM‐
4587 PATIBILITY_VERSION property corresponds to the compatibility version
4588 and MACHO_CURRENT_VERSION corresponds to the current version. These
4589 are both embedded in the shared library binary and can be checked with
4590 the otool -L <binary> command.
4591
4592 It should be noted that the MACHO_CURRENT_VERSION and MACHO_COMPATIBIL‐
4593 ITY_VERSION properties do not affect the file names or version-related
4594 symlinks that CMake generates for the library. The VERSION and SOVER‐
4595 SION target properties still control the file and symlink names. The
4596 install_name is also still controlled by SOVERSION.
4597
4598 When MACHO_CURRENT_VERSION and MACHO_COMPATIBILITY_VERSION are not
4599 given, VERSION and SOVERSION are used for the version details to be
4600 embedded in the binaries respectively. The MACHO_CURRENT_VERSION and
4601 MACHO_COMPATIBILITY_VERSION properties only need to be given if the
4602 project needs to decouple the file and symlink naming from the version
4603 details embedded in the binaries (e.g. to match libtool conventions).
4604
4605 MACHO_CURRENT_VERSION
4606 New in version 3.17.
4607
4608
4609 What current version number is this target for Mach-O binaries.
4610
4611 For shared libraries on Mach-O systems (e.g. macOS, iOS) the MACHO_COM‐
4612 PATIBILITY_VERSION property corresponds to the compatibility version
4613 and MACHO_CURRENT_VERSION corresponds to the current version. These
4614 are both embedded in the shared library binary and can be checked with
4615 the otool -L <binary> command.
4616
4617 It should be noted that the MACHO_CURRENT_VERSION and MACHO_COMPATIBIL‐
4618 ITY_VERSION properties do not affect the file names or version-related
4619 symlinks that CMake generates for the library. The VERSION and SOVER‐
4620 SION target properties still control the file and symlink names. The
4621 install_name is also still controlled by SOVERSION.
4622
4623 When MACHO_CURRENT_VERSION and MACHO_COMPATIBILITY_VERSION are not
4624 given, VERSION and SOVERSION are used for the version details to be
4625 embedded in the binaries respectively. The MACHO_CURRENT_VERSION and
4626 MACHO_COMPATIBILITY_VERSION properties only need to be given if the
4627 project needs to decouple the file and symlink naming from the version
4628 details embedded in the binaries (e.g. to match libtool conventions).
4629
4630 MACOSX_BUNDLE
4631 Build an executable as an Application Bundle on macOS or iOS.
4632
4633 When this property is set to TRUE the executable when built on macOS or
4634 iOS will be created as an application bundle. This makes it a GUI exe‐
4635 cutable that can be launched from the Finder. See the MACOSX_BUN‐
4636 DLE_INFO_PLIST target property for information about creation of the
4637 Info.plist file for the application bundle. This property is initial‐
4638 ized by the value of the variable CMAKE_MACOSX_BUNDLE if it is set when
4639 a target is created.
4640
4641 MACOSX_BUNDLE_INFO_PLIST
4642 Specify a custom Info.plist template for a macOS and iOS Application
4643 Bundle.
4644
4645 An executable target with MACOSX_BUNDLE enabled will be built as an
4646 application bundle on macOS. By default its Info.plist file is created
4647 by configuring a template called MacOSXBundleInfo.plist.in located in
4648 the CMAKE_MODULE_PATH. This property specifies an alternative template
4649 file name which may be a full path.
4650
4651 The following target properties may be set to specify content to be
4652 configured into the file:
4653
4654 MACOSX_BUNDLE_BUNDLE_NAME
4655 Sets CFBundleName.
4656
4657 MACOSX_BUNDLE_BUNDLE_VERSION
4658 Sets CFBundleVersion.
4659
4660 MACOSX_BUNDLE_COPYRIGHT
4661 Sets NSHumanReadableCopyright.
4662
4663 MACOSX_BUNDLE_GUI_IDENTIFIER
4664 Sets CFBundleIdentifier.
4665
4666 MACOSX_BUNDLE_ICON_FILE
4667 Sets CFBundleIconFile.
4668
4669 MACOSX_BUNDLE_INFO_STRING
4670 Sets CFBundleGetInfoString.
4671
4672 MACOSX_BUNDLE_LONG_VERSION_STRING
4673 Sets CFBundleLongVersionString.
4674
4675 MACOSX_BUNDLE_SHORT_VERSION_STRING
4676 Sets CFBundleShortVersionString.
4677
4678 CMake variables of the same name may be set to affect all targets in a
4679 directory that do not have each specific property set. If a custom
4680 Info.plist is specified by this property it may of course hard-code all
4681 the settings instead of using the target properties.
4682
4683 MACOSX_FRAMEWORK_INFO_PLIST
4684 Specify a custom Info.plist template for a macOS and iOS Framework.
4685
4686 A library target with FRAMEWORK enabled will be built as a framework on
4687 macOS. By default its Info.plist file is created by configuring a tem‐
4688 plate called MacOSXFrameworkInfo.plist.in located in the CMAKE_MOD‐
4689 ULE_PATH. This property specifies an alternative template file name
4690 which may be a full path.
4691
4692 The following target properties may be set to specify content to be
4693 configured into the file:
4694
4695 MACOSX_FRAMEWORK_BUNDLE_VERSION
4696 Sets CFBundleVersion.
4697
4698 MACOSX_FRAMEWORK_ICON_FILE
4699 Sets CFBundleIconFile.
4700
4701 MACOSX_FRAMEWORK_IDENTIFIER
4702 Sets CFBundleIdentifier.
4703
4704 MACOSX_FRAMEWORK_SHORT_VERSION_STRING
4705 Sets CFBundleShortVersionString.
4706
4707 CMake variables of the same name may be set to affect all targets in a
4708 directory that do not have each specific property set. If a custom
4709 Info.plist is specified by this property it may of course hard-code all
4710 the settings instead of using the target properties.
4711
4712 MACOSX_RPATH
4713 Whether this target on macOS or iOS is located at runtime using rpaths.
4714
4715 When this property is set to TRUE, the directory portion of the
4716 install_name field of this shared library will be @rpath unless over‐
4717 ridden by INSTALL_NAME_DIR. This indicates the shared library is to be
4718 found at runtime using runtime paths (rpaths).
4719
4720 This property is initialized by the value of the variable
4721 CMAKE_MACOSX_RPATH if it is set when a target is created.
4722
4723 Runtime paths will also be embedded in binaries using this target and
4724 can be controlled by the INSTALL_RPATH target property on the target
4725 linking to this target.
4726
4727 Policy CMP0042 was introduced to change the default value of
4728 MACOSX_RPATH to TRUE. This is because use of @rpath is a more flexible
4729 and powerful alternative to @executable_path and @loader_path.
4730
4731 MANUALLY_ADDED_DEPENDENCIES
4732 New in version 3.8.
4733
4734
4735 Get manually added dependencies to other top-level targets.
4736
4737 This read-only property can be used to query all dependencies that were
4738 added for this target with the add_dependencies() command.
4739
4740 MAP_IMPORTED_CONFIG_<CONFIG>
4741 Map from project configuration to imported target’s configuration.
4742
4743 Set this to the list of configurations of an imported target that may
4744 be used for the current project’s <CONFIG> configuration. Targets
4745 imported from another project may not provide the same set of configu‐
4746 ration names available in the current project. Setting this property
4747 tells CMake what imported configurations are suitable for use when
4748 building the <CONFIG> configuration. The first configuration in the
4749 list found to be provided by the imported target (i.e. via
4750 IMPORTED_LOCATION_<CONFIG> for the mapped-to <CONFIG>) is selected. As
4751 a special case, an empty list element refers to the configuration-less
4752 imported target location (i.e. IMPORTED_LOCATION).
4753
4754 If this property is set and no matching configurations are available,
4755 then the imported target is considered to be not found. This property
4756 is ignored for non-imported targets.
4757
4758 This property is initialized by the value of the
4759 CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> variable if it is set when a target
4760 is created.
4761
4762 Example
4763 For example creating imported C++ library foo:
4764
4765 add_library(foo STATIC IMPORTED)
4766
4767 Use foo_debug path for Debug build type:
4768
4769 set_property(
4770 TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
4771 )
4772
4773 set_target_properties(foo PROPERTIES
4774 IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
4775 IMPORTED_LOCATION_DEBUG "${foo_debug}"
4776 )
4777
4778 Use foo_release path for Release build type:
4779
4780 set_property(
4781 TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
4782 )
4783
4784 set_target_properties(foo PROPERTIES
4785 IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
4786 IMPORTED_LOCATION_RELEASE "${foo_release}"
4787 )
4788
4789 Use Release version of library for MinSizeRel and RelWithDebInfo build
4790 types:
4791
4792 set_target_properties(foo PROPERTIES
4793 MAP_IMPORTED_CONFIG_MINSIZEREL Release
4794 MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
4795 )
4796
4797 MSVC_RUNTIME_LIBRARY
4798 New in version 3.15.
4799
4800
4801 Select the MSVC runtime library for use by compilers targeting the MSVC
4802 ABI.
4803
4804 The allowed values are:
4805
4806 MultiThreaded
4807 Compile with -MT or equivalent flag(s) to use a multi-threaded
4808 statically-linked runtime library.
4809
4810 MultiThreadedDLL
4811 Compile with -MD or equivalent flag(s) to use a multi-threaded
4812 dynamically-linked runtime library.
4813
4814 MultiThreadedDebug
4815 Compile with -MTd or equivalent flag(s) to use a multi-threaded
4816 statically-linked runtime library.
4817
4818 MultiThreadedDebugDLL
4819 Compile with -MDd or equivalent flag(s) to use a multi-threaded
4820 dynamically-linked runtime library.
4821
4822 The value is ignored on non-MSVC compilers but an unsupported value
4823 will be rejected as an error when using a compiler targeting the MSVC
4824 ABI.
4825
4826 The value may also be the empty string ("") in which case no runtime
4827 library selection flag will be added explicitly by CMake. Note that
4828 with Visual Studio Generators the native build system may choose to add
4829 its own default runtime library selection flag.
4830
4831 Use generator expressions to support per-configuration specification.
4832 For example, the code:
4833
4834 add_executable(foo foo.c)
4835 set_property(TARGET foo PROPERTY
4836 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
4837
4838 selects for the target foo a multi-threaded statically-linked runtime
4839 library with or without debug information depending on the configura‐
4840 tion.
4841
4842 If this property is not set then CMake uses the default value Multi‐
4843 Threaded$<$<CONFIG:Debug>:Debug>DLL to select a MSVC runtime library.
4844
4845 NOTE:
4846 This property has effect only when policy CMP0091 is set to NEW
4847 prior to the first project() or enable_language() command that
4848 enables a language using a compiler targeting the MSVC ABI.
4849
4850 NAME
4851 Logical name for the target.
4852
4853 Read-only logical name for the target as used by CMake.
4854
4855 NO_SONAME
4856 Whether to set soname when linking a shared library.
4857
4858 Enable this boolean property if a generated SHARED library should not
4859 have soname set. Default is to set soname on all shared libraries as
4860 long as the platform supports it. Generally, use this property only
4861 for leaf private libraries or plugins. If you use it on normal shared
4862 libraries which other targets link against, on some platforms a linker
4863 will insert a full path to the library (as specified at link time) into
4864 the dynamic section of the dependent binary. Therefore, once
4865 installed, dynamic loader may eventually fail to locate the library for
4866 the binary.
4867
4868 NO_SYSTEM_FROM_IMPORTED
4869 Do not treat include directories from the interfaces of consumed
4870 imported targets as SYSTEM.
4871
4872 The contents of the INTERFACE_INCLUDE_DIRECTORIES target property of
4873 imported targets are treated as SYSTEM includes by default. If this
4874 property is enabled on a target, compilation of sources in that target
4875 will not treat the contents of the INTERFACE_INCLUDE_DIRECTORIES of
4876 consumed imported targets as system includes.
4877
4878 This property is initialized by the value of the CMAKE_NO_SYS‐
4879 TEM_FROM_IMPORTED variable if it is set when a target is created.
4880
4881 OBJC_EXTENSIONS
4882 New in version 3.16.
4883
4884
4885 Boolean specifying whether compiler specific extensions are requested.
4886
4887 This property specifies whether compiler specific extensions should be
4888 used. For some compilers, this results in adding a flag such as
4889 -std=gnu11 instead of -std=c11 to the compile line. This property is
4890 ON by default. The basic OBJC standard level is controlled by the
4891 OBJC_STANDARD target property.
4892
4893 If the property is not set, and the project has set the C_EXTENSIONS,
4894 the value of C_EXTENSIONS is set for OBJC_EXTENSIONS.
4895
4896 See the cmake-compile-features(7) manual for information on compile
4897 features and a list of supported compilers.
4898
4899 This property is initialized by the value of the CMAKE_OBJC_EXTENSIONS
4900 variable if it is set when a target is created.
4901
4902 OBJC_STANDARD
4903 New in version 3.16.
4904
4905
4906 The OBJC standard whose features are requested to build this target.
4907
4908 This property specifies the OBJC standard whose features are requested
4909 to build this target. For some compilers, this results in adding a
4910 flag such as -std=gnu11 to the compile line.
4911
4912 Supported values are 90, 99 and 11.
4913
4914 If the value requested does not result in a compile flag being added
4915 for the compiler in use, a previous standard flag will be added
4916 instead. This means that using:
4917
4918 set_property(TARGET tgt PROPERTY OBJC_STANDARD 11)
4919
4920 with a compiler which does not support -std=gnu11 or an equivalent flag
4921 will not result in an error or warning, but will instead add the
4922 -std=gnu99 or -std=gnu90 flag if supported. This “decay” behavior may
4923 be controlled with the OBJC_STANDARD_REQUIRED target property. Addi‐
4924 tionally, the OBJC_EXTENSIONS target property may be used to control
4925 whether compiler-specific extensions are enabled on a per-target basis.
4926
4927 If the property is not set, and the project has set the C_STANDARD, the
4928 value of C_STANDARD is set for OBJC_STANDARD.
4929
4930 See the cmake-compile-features(7) manual for information on compile
4931 features and a list of supported compilers.
4932
4933 This property is initialized by the value of the CMAKE_OBJC_STANDARD
4934 variable if it is set when a target is created.
4935
4936 OBJC_STANDARD_REQUIRED
4937 New in version 3.16.
4938
4939
4940 Boolean describing whether the value of OBJC_STANDARD is a requirement.
4941
4942 If this property is set to ON, then the value of the OBJC_STANDARD tar‐
4943 get property is treated as a requirement. If this property is OFF or
4944 unset, the OBJC_STANDARD target property is treated as optional and may
4945 “decay” to a previous standard if the requested is not available.
4946
4947 If the property is not set, and the project has set the C_STAN‐
4948 DARD_REQUIRED, the value of C_STANDARD_REQUIRED is set for
4949 OBJC_STANDARD_REQUIRED.
4950
4951 See the cmake-compile-features(7) manual for information on compile
4952 features and a list of supported compilers.
4953
4954 This property is initialized by the value of the CMAKE_OBJC_STAN‐
4955 DARD_REQUIRED variable if it is set when a target is created.
4956
4957 OBJCXX_EXTENSIONS
4958 New in version 3.16.
4959
4960
4961 Boolean specifying whether compiler specific extensions are requested.
4962
4963 This property specifies whether compiler specific extensions should be
4964 used. For some compilers, this results in adding a flag such as
4965 -std=gnu++11 instead of -std=c++11 to the compile line. This property
4966 is ON by default. The basic ObjC++ standard level is controlled by the
4967 OBJCXX_STANDARD target property.
4968
4969 See the cmake-compile-features(7) manual for information on compile
4970 features and a list of supported compilers.
4971
4972 If the property is not set, and the project has set the CXX_EXTENSIONS,
4973 the value of CXX_EXTENSIONS is set for OBJCXX_EXTENSIONS.
4974
4975 This property is initialized by the value of the CMAKE_OBJCXX_EXTEN‐
4976 SIONS variable if it is set when a target is created.
4977
4978 OBJCXX_STANDARD
4979 New in version 3.16.
4980
4981
4982 The ObjC++ standard whose features are requested to build this target.
4983
4984 This property specifies the ObjC++ standard whose features are
4985 requested to build this target. For some compilers, this results in
4986 adding a flag such as -std=gnu++11 to the compile line.
4987
4988 Supported values are 98, 11, 14, 17, and 20.
4989
4990 If the value requested does not result in a compile flag being added
4991 for the compiler in use, a previous standard flag will be added
4992 instead. This means that using:
4993
4994 set_property(TARGET tgt PROPERTY OBJCXX_STANDARD 11)
4995
4996 with a compiler which does not support -std=gnu++11 or an equivalent
4997 flag will not result in an error or warning, but will instead add the
4998 -std=gnu++98 flag if supported. This “decay” behavior may be con‐
4999 trolled with the OBJCXX_STANDARD_REQUIRED target property. Addition‐
5000 ally, the OBJCXX_EXTENSIONS target property may be used to control
5001 whether compiler-specific extensions are enabled on a per-target basis.
5002
5003 If the property is not set, and the project has set the CXX_STANDARD,
5004 the value of CXX_STANDARD is set for OBJCXX_STANDARD.
5005
5006 See the cmake-compile-features(7) manual for information on compile
5007 features and a list of supported compilers.
5008
5009 This property is initialized by the value of the CMAKE_OBJCXX_STANDARD
5010 variable if it is set when a target is created.
5011
5012 OBJCXX_STANDARD_REQUIRED
5013 New in version 3.16.
5014
5015
5016 Boolean describing whether the value of OBJCXX_STANDARD is a require‐
5017 ment.
5018
5019 If this property is set to ON, then the value of the OBJCXX_STANDARD
5020 target property is treated as a requirement. If this property is OFF
5021 or unset, the OBJCXX_STANDARD target property is treated as optional
5022 and may “decay” to a previous standard if the requested is not avail‐
5023 able.
5024
5025 If the property is not set, and the project has set the CXX_STAN‐
5026 DARD_REQUIRED, the value of CXX_STANDARD_REQUIRED is set for
5027 OBJCXX_STANDARD_REQUIRED.
5028
5029 See the cmake-compile-features(7) manual for information on compile
5030 features and a list of supported compilers.
5031
5032 This property is initialized by the value of the CMAKE_OBJCXX_STAN‐
5033 DARD_REQUIRED variable if it is set when a target is created.
5034
5035 OPTIMIZE_DEPENDENCIES
5036 New in version 3.19.
5037
5038
5039 Activates dependency optimization of static and object libraries.
5040
5041 When this property is set to true, some dependencies for a static or
5042 object library may be removed at generation time if they are not neces‐
5043 sary to build the library, since static and object libraries don’t
5044 actually link against anything.
5045
5046 If a static or object library has dependency optimization enabled, it
5047 first discards all dependencies. Then, it looks through all of the
5048 direct and indirect dependencies that it initially had, and adds them
5049 back if they meet any of the following criteria:
5050
5051 · The dependency was added to the library by add_dependencies().
5052
5053 · The dependency was added to the library through a source file in the
5054 library generated by a custom command that uses the dependency.
5055
5056 · The dependency has any PRE_BUILD, PRE_LINK, or POST_BUILD custom com‐
5057 mands associated with it.
5058
5059 · The dependency contains any source files that were generated by a
5060 custom command.
5061
5062 · The dependency contains any languages which produce side effects that
5063 are relevant to the library. Currently, all languages except C, C++,
5064 Objective-C, Objective-C++, assembly, and CUDA are assumed to produce
5065 side effects. However, side effects from one language are assumed
5066 not to be relevant to another (for example, a Fortran library is
5067 assumed to not have any side effects that are relevant for a Swift
5068 library.)
5069
5070 As an example, assume you have a static Fortran library which depends
5071 on a static C library, which in turn depends on a static Fortran
5072 library. The top-level Fortran library has optimization enabled, but
5073 the middle C library does not. If you build the top Fortran library,
5074 the bottom Fortran library will also build, but not the middle C
5075 library, since the C library does not have any side effects that are
5076 relevant for the Fortran library. However, if you build the middle C
5077 library, the bottom Fortran library will also build, even though it
5078 does not have any side effects that are relevant to the C library,
5079 since the C library does not have optimization enabled.
5080
5081 This property is initialized by the value of the CMAKE_OPTIMIZE_DEPEN‐
5082 DENCIES variable when the target is created.
5083
5084 OSX_ARCHITECTURES
5085 Target specific architectures for macOS.
5086
5087 The OSX_ARCHITECTURES property sets the target binary architecture for
5088 targets on macOS (-arch). This property is initialized by the value of
5089 the variable CMAKE_OSX_ARCHITECTURES if it is set when a target is cre‐
5090 ated. Use OSX_ARCHITECTURES_<CONFIG> to set the binary architectures
5091 on a per-configuration basis, where <CONFIG> is an upper-case name
5092 (e.g. OSX_ARCHITECTURES_DEBUG).
5093
5094 OSX_ARCHITECTURES_<CONFIG>
5095 Per-configuration macOS and iOS binary architectures for a target.
5096
5097 This property is the configuration-specific version of OSX_ARCHITEC‐
5098 TURES.
5099
5100 OUTPUT_NAME
5101 Output name for target files.
5102
5103 This sets the base name for output files created for an executable or
5104 library target. If not set, the logical target name is used by default
5105 during generation. The value is not set by default during configura‐
5106 tion.
5107
5108 Contents of OUTPUT_NAME and the variants listed below may use generator
5109 expressions.
5110
5111 See also the variants:
5112
5113 · OUTPUT_NAME_<CONFIG>
5114
5115 · ARCHIVE_OUTPUT_NAME_<CONFIG>
5116
5117 · ARCHIVE_OUTPUT_NAME
5118
5119 · LIBRARY_OUTPUT_NAME_<CONFIG>
5120
5121 · LIBRARY_OUTPUT_NAME
5122
5123 · RUNTIME_OUTPUT_NAME_<CONFIG>
5124
5125 · RUNTIME_OUTPUT_NAME
5126
5127 OUTPUT_NAME_<CONFIG>
5128 Per-configuration target file base name.
5129
5130 This is the configuration-specific version of the OUTPUT_NAME target
5131 property.
5132
5133 PCH_WARN_INVALID
5134 New in version 3.18.
5135
5136
5137 When this property is set to true, the precompile header compiler
5138 options will contain a compiler flag which should warn about invalid
5139 precompiled headers e.g. -Winvalid-pch for GNU compiler.
5140
5141 This property is initialized by the value of the CMAKE_PCH_WARN_INVALID
5142 variable if it is set when a target is created. If that variable is
5143 not set, the property defaults to ON.
5144
5145 PCH_INSTANTIATE_TEMPLATES
5146 New in version 3.19.
5147
5148
5149 When this property is set to true, the precompiled header compiler
5150 options will contain a flag to instantiate templates during the genera‐
5151 tion of the PCH if supported. This can significantly improve compile
5152 times. Supported in Clang since version 11.
5153
5154 This property is initialized by the value of the CMAKE_PCH_INSTANTI‐
5155 ATE_TEMPLATES variable if it is set when a target is created. If that
5156 variable is not set, the property defaults to ON.
5157
5158 PDB_NAME
5159 Output name for the MS debug symbol .pdb file generated by the linker
5160 for an executable or shared library target.
5161
5162 This property specifies the base name for the debug symbols file. If
5163 not set, the OUTPUT_NAME target property value or logical target name
5164 is used by default.
5165
5166 NOTE:
5167 This property does not apply to STATIC library targets because no
5168 linker is invoked to produce them so they have no linker-generated
5169 .pdb file containing debug symbols.
5170
5171 The linker-generated program database files are specified by the
5172 /pdb linker flag and are not the same as compiler-generated program
5173 database files specified by the /Fd compiler flag. Use the COM‐
5174 PILE_PDB_NAME property to specify the latter.
5175
5176 PDB_NAME_<CONFIG>
5177 Per-configuration output name for the MS debug symbol .pdb file gener‐
5178 ated by the linker for an executable or shared library target.
5179
5180 This is the configuration-specific version of PDB_NAME.
5181
5182 NOTE:
5183 This property does not apply to STATIC library targets because no
5184 linker is invoked to produce them so they have no linker-generated
5185 .pdb file containing debug symbols.
5186
5187 The linker-generated program database files are specified by the
5188 /pdb linker flag and are not the same as compiler-generated program
5189 database files specified by the /Fd compiler flag. Use the COM‐
5190 PILE_PDB_NAME_<CONFIG> property to specify the latter.
5191
5192 PDB_OUTPUT_DIRECTORY
5193 Output directory for the MS debug symbols .pdb file generated by the
5194 linker for an executable or shared library target.
5195
5196 This property specifies the directory into which the MS debug symbols
5197 will be placed by the linker. The property value may use generator
5198 expressions. Multi-configuration generators append a per-configuration
5199 subdirectory to the specified directory unless a generator expression
5200 is used.
5201
5202 This property is initialized by the value of the CMAKE_PDB_OUT‐
5203 PUT_DIRECTORY variable if it is set when a target is created.
5204
5205 NOTE:
5206 This property does not apply to STATIC library targets because no
5207 linker is invoked to produce them so they have no linker-generated
5208 .pdb file containing debug symbols.
5209
5210 The linker-generated program database files are specified by the
5211 /pdb linker flag and are not the same as compiler-generated program
5212 database files specified by the /Fd compiler flag. Use the COM‐
5213 PILE_PDB_OUTPUT_DIRECTORY property to specify the latter.
5214
5215 PDB_OUTPUT_DIRECTORY_<CONFIG>
5216 Per-configuration output directory for the MS debug symbol .pdb file
5217 generated by the linker for an executable or shared library target.
5218
5219 This is a per-configuration version of PDB_OUTPUT_DIRECTORY, but
5220 multi-configuration generators (Visual Studio Generators, Xcode) do NOT
5221 append a per-configuration subdirectory to the specified directory.
5222 This property is initialized by the value of the CMAKE_PDB_OUT‐
5223 PUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.
5224
5225 Contents of PDB_OUTPUT_DIRECTORY_<CONFIG> may use generator expres‐
5226 sions.
5227
5228 NOTE:
5229 This property does not apply to STATIC library targets because no
5230 linker is invoked to produce them so they have no linker-generated
5231 .pdb file containing debug symbols.
5232
5233 The linker-generated program database files are specified by the
5234 /pdb linker flag and are not the same as compiler-generated program
5235 database files specified by the /Fd compiler flag. Use the COM‐
5236 PILE_PDB_OUTPUT_DIRECTORY_<CONFIG> property to specify the latter.
5237
5238 POSITION_INDEPENDENT_CODE
5239 Whether to create a position-independent target
5240
5241 The POSITION_INDEPENDENT_CODE property determines whether position
5242 independent executables or shared libraries will be created. This
5243 property is True by default for SHARED and MODULE library targets and
5244 False otherwise. This property is initialized by the value of the
5245 CMAKE_POSITION_INDEPENDENT_CODE variable if it is set when a target is
5246 created.
5247
5248 NOTE:
5249 For executable targets, the link step is controlled by the CMP0083
5250 policy and the CheckPIESupported module.
5251
5252 PRECOMPILE_HEADERS
5253 New in version 3.16.
5254
5255
5256 List of header files to precompile.
5257
5258 This property holds a semicolon-separated list of header files to pre‐
5259 compile specified so far for its target. Use the target_precom‐
5260 pile_headers() command to append more header files.
5261
5262 This property supports generator expressions.
5263
5264 PRECOMPILE_HEADERS_REUSE_FROM
5265 New in version 3.16.
5266
5267
5268 Target from which to reuse the precompiled headers build artifact.
5269
5270 See the second signature of target_precompile_headers() command for
5271 more detailed information.
5272
5273 PREFIX
5274 What comes before the library name.
5275
5276 A target property that can be set to override the prefix (such as lib)
5277 on a library name.
5278
5279 PRIVATE_HEADER
5280 Specify private header files in a FRAMEWORK shared library target.
5281
5282 Shared library targets marked with the FRAMEWORK property generate
5283 frameworks on macOS, iOS and normal shared libraries on other plat‐
5284 forms. This property may be set to a list of header files to be placed
5285 in the PrivateHeaders directory inside the framework folder. On
5286 non-Apple platforms these headers may be installed using the PRI‐
5287 VATE_HEADER option to the install(TARGETS) command.
5288
5289 PROJECT_LABEL
5290 Change the name of a target in an IDE.
5291
5292 Can be used to change the name of the target in an IDE like Visual Stu‐
5293 dio.
5294
5295 PUBLIC_HEADER
5296 Specify public header files in a FRAMEWORK shared library target.
5297
5298 Shared library targets marked with the FRAMEWORK property generate
5299 frameworks on macOS, iOS and normal shared libraries on other plat‐
5300 forms. This property may be set to a list of header files to be placed
5301 in the Headers directory inside the framework folder. On non-Apple
5302 platforms these headers may be installed using the PUBLIC_HEADER option
5303 to the install(TARGETS) command.
5304
5305 RESOURCE
5306 Specify resource files in a FRAMEWORK or BUNDLE.
5307
5308 Target marked with the FRAMEWORK or BUNDLE property generate framework
5309 or application bundle (both macOS and iOS is supported) or normal
5310 shared libraries on other platforms. This property may be set to a
5311 list of files to be placed in the corresponding directory (eg.
5312 Resources directory for macOS) inside the bundle. On non-Apple plat‐
5313 forms these files may be installed using the RESOURCE option to the
5314 install(TARGETS) command.
5315
5316 Following example of Application Bundle:
5317
5318 add_executable(ExecutableTarget
5319 addDemo.c
5320 resourcefile.txt
5321 appresourcedir/appres.txt)
5322
5323 target_link_libraries(ExecutableTarget heymath mul)
5324
5325 set(RESOURCE_FILES
5326 resourcefile.txt
5327 appresourcedir/appres.txt)
5328
5329 set_target_properties(ExecutableTarget PROPERTIES
5330 MACOSX_BUNDLE TRUE
5331 MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
5332 RESOURCE "${RESOURCE_FILES}")
5333
5334 will produce flat structure for iOS systems:
5335
5336 ExecutableTarget.app
5337 appres.txt
5338 ExecutableTarget
5339 Info.plist
5340 resourcefile.txt
5341
5342 For macOS systems it will produce following directory structure:
5343
5344 ExecutableTarget.app/
5345 Contents
5346 Info.plist
5347 MacOS
5348 ExecutableTarget
5349 Resources
5350 appres.txt
5351 resourcefile.txt
5352
5353 For Linux, such CMake script produce following files:
5354
5355 ExecutableTarget
5356 Resources
5357 appres.txt
5358 resourcefile.txt
5359
5360 RULE_LAUNCH_COMPILE
5361 Specify a launcher for compile rules.
5362
5363 See the global property of the same name for details. This overrides
5364 the global and directory property for a target.
5365
5366 RULE_LAUNCH_CUSTOM
5367 Specify a launcher for custom rules.
5368
5369 See the global property of the same name for details. This overrides
5370 the global and directory property for a target.
5371
5372 RULE_LAUNCH_LINK
5373 Specify a launcher for link rules.
5374
5375 See the global property of the same name for details. This overrides
5376 the global and directory property for a target.
5377
5378 RUNTIME_OUTPUT_DIRECTORY
5379 Output directory in which to build RUNTIME target files.
5380
5381 This property specifies the directory into which runtime target files
5382 should be built. The property value may use generator expressions.
5383 Multi-configuration generators (VS, Xcode) append a per-configuration
5384 subdirectory to the specified directory unless a generator expression
5385 is used.
5386
5387 This property is initialized by the value of the variable CMAKE_RUN‐
5388 TIME_OUTPUT_DIRECTORY if it is set when a target is created.
5389
5390 See also the RUNTIME_OUTPUT_DIRECTORY_<CONFIG> target property.
5391
5392 RUNTIME_OUTPUT_DIRECTORY_<CONFIG>
5393 Per-configuration output directory for RUNTIME target files.
5394
5395 This is a per-configuration version of the RUNTIME_OUTPUT_DIRECTORY
5396 target property, but multi-configuration generators (Visual Studio Gen‐
5397 erators, Xcode) do NOT append a per-configuration subdirectory to the
5398 specified directory. This property is initialized by the value of the
5399 CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a
5400 target is created.
5401
5402 Contents of RUNTIME_OUTPUT_DIRECTORY_<CONFIG> may use generator expres‐
5403 sions.
5404
5405 RUNTIME_OUTPUT_NAME
5406 Output name for RUNTIME target files.
5407
5408 This property specifies the base name for runtime target files. It
5409 overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties.
5410
5411 See also the RUNTIME_OUTPUT_NAME_<CONFIG> target property.
5412
5413 RUNTIME_OUTPUT_NAME_<CONFIG>
5414 Per-configuration output name for RUNTIME target files.
5415
5416 This is the configuration-specific version of the RUNTIME_OUTPUT_NAME
5417 target property.
5418
5419 SKIP_BUILD_RPATH
5420 Should rpaths be used for the build tree.
5421
5422 SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic gen‐
5423 eration of an rpath allowing the target to run from the build tree.
5424 This property is initialized by the value of the variable
5425 CMAKE_SKIP_BUILD_RPATH if it is set when a target is created.
5426
5427 SOURCE_DIR
5428 New in version 3.4.
5429
5430
5431 This read-only property reports the value of the CMAKE_CUR‐
5432 RENT_SOURCE_DIR variable in the directory in which the target was
5433 defined.
5434
5435 SOURCES
5436 Source names specified for a target.
5437
5438 List of sources specified for a target.
5439
5440 SOVERSION
5441 What version number is this target.
5442
5443 For shared libraries VERSION and SOVERSION can be used to specify the
5444 build version and API version respectively. When building or
5445 installing appropriate symlinks are created if the platform supports
5446 symlinks and the linker supports so-names. If only one of both is
5447 specified the missing is assumed to have the same version number.
5448 SOVERSION is ignored if NO_SONAME property is set.
5449
5450 Windows Versions
5451 For shared libraries and executables on Windows the VERSION attribute
5452 is parsed to extract a <major>.<minor> version number. These numbers
5453 are used as the image version of the binary.
5454
5455 Mach-O Versions
5456 For shared libraries and executables on Mach-O systems (e.g. macOS,
5457 iOS), the SOVERSION property corresponds to the compatibility version
5458 and VERSION corresponds to the current version (unless Mach-O specific
5459 overrides are provided, as discussed below). See the FRAMEWORK target
5460 property for an example.
5461
5462 For shared libraries, the MACHO_COMPATIBILITY_VERSION and MACHO_CUR‐
5463 RENT_VERSION properties can be used to override the compatibility ver‐
5464 sion and current version respectively. Note that SOVERSION will still
5465 be used to form the install_name and both SOVERSION and VERSION may
5466 also affect the file and symlink names.
5467
5468 Versions of Mach-O binaries may be checked with the otool -L <binary>
5469 command.
5470
5471 STATIC_LIBRARY_FLAGS
5472 Archiver (or MSVC librarian) flags for a static library target. Tar‐
5473 gets that are shared libraries, modules, or executables need to use the
5474 LINK_OPTIONS or LINK_FLAGS target properties.
5475
5476 The STATIC_LIBRARY_FLAGS property, managed as a string, can be used to
5477 add extra flags to the link step of a static library target.
5478 STATIC_LIBRARY_FLAGS_<CONFIG> will add to the configuration <CONFIG>,
5479 for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO, …
5480
5481 NOTE:
5482 This property has been superseded by STATIC_LIBRARY_OPTIONS prop‐
5483 erty.
5484
5485 STATIC_LIBRARY_FLAGS_<CONFIG>
5486 Per-configuration archiver (or MSVC librarian) flags for a static
5487 library target.
5488
5489 This is the configuration-specific version of STATIC_LIBRARY_FLAGS.
5490
5491 NOTE:
5492 This property has been superseded by STATIC_LIBRARY_OPTIONS prop‐
5493 erty.
5494
5495 STATIC_LIBRARY_OPTIONS
5496 New in version 3.13.
5497
5498
5499 Archiver (or MSVC librarian) flags for a static library target. Tar‐
5500 gets that are shared libraries, modules, or executables need to use the
5501 LINK_OPTIONS target property.
5502
5503 This property holds a semicolon-separated list of options specified so
5504 far for its target. Use set_target_properties() or set_property() com‐
5505 mands to set its content.
5506
5507 Contents of STATIC_LIBRARY_OPTIONS may use “generator expressions” with
5508 the syntax $<...>. See the cmake-generator-expressions(7) manual for
5509 available expressions. See the cmake-buildsystem(7) manual for more on
5510 defining buildsystem properties.
5511
5512 NOTE:
5513 This property must be used in preference to STATIC_LIBRARY_FLAGS
5514 property.
5515
5516 SUFFIX
5517 What comes after the target name.
5518
5519 A target property that can be set to override the suffix (such as .so
5520 or .exe) on the name of a library, module or executable.
5521
5522 Swift_DEPENDENCIES_FILE
5523 New in version 3.15.
5524
5525
5526 This property sets the path for the Swift dependency file (swiftdep)
5527 for the target. If one is not specified, it will default to <TAR‐
5528 GET>.swiftdeps.
5529
5530 Swift_LANGUAGE_VERSION
5531 New in version 3.16.
5532
5533
5534 This property sets the language version for the Swift sources in the
5535 target. If one is not specified, it will default to <CMAKE_Swift_LAN‐
5536 GUAGE_VERSION> if specified, otherwise it is the latest version sup‐
5537 ported by the compiler.
5538
5539 Swift_MODULE_DIRECTORY
5540 New in version 3.15.
5541
5542
5543 Specify output directory for Swift modules provided by the target.
5544
5545 If the target contains Swift source files, this specifies the directory
5546 in which the modules will be placed. When this property is not set,
5547 the modules will be placed in the build directory corresponding to the
5548 target’s source directory. If the variable CMAKE_Swift_MODULE_DIREC‐
5549 TORY is set when a target is created its value is used to initialise
5550 this property.
5551
5552 Swift_MODULE_NAME
5553 New in version 3.15.
5554
5555
5556 This property specifies the name of the Swift module. It is defaulted
5557 to the name of the target.
5558
5559 TYPE
5560 The type of the target.
5561
5562 This read-only property can be used to test the type of the given tar‐
5563 get. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, SHARED_LIBRARY,
5564 OBJECT_LIBRARY, INTERFACE_LIBRARY, EXECUTABLE or one of the internal
5565 target types.
5566
5567 UNITY_BUILD
5568 New in version 3.16.
5569
5570
5571 When this property is set to true, the target source files will be com‐
5572 bined into batches for faster compilation. This is done by creating a
5573 (set of) unity sources which #include the original sources, then com‐
5574 piling these unity sources instead of the originals. This is known as
5575 a Unity or Jumbo build.
5576
5577 CMake provides different algorithms for selecting which sources are
5578 grouped together into a bucket. Algorithm selection is decided by the
5579 UNITY_BUILD_MODE target property, which has the following acceptable
5580 values:
5581
5582 · BATCH When in this mode CMake determines which files are grouped
5583 together. The UNITY_BUILD_BATCH_SIZE property controls the upper
5584 limit on how many sources can be combined per unity source file.
5585
5586 · GROUP When in this mode each target explicitly specifies how to group
5587 source files. Each source file that has the same UNITY_GROUP value
5588 will be grouped together. Any sources that don’t have this property
5589 will be compiled individually. The UNITY_BUILD_BATCH_SIZE property is
5590 ignored when using this mode.
5591
5592 If no explicit UNITY_BUILD_MODE has been specified, CMake will default
5593 to BATCH.
5594
5595 Unity builds are not currently supported for all languages. CMake ver‐
5596 sion 3.19.7 supports combining C and CXX source files. For targets
5597 that mix source files from more than one language, CMake will separate
5598 the languages such that each generated unity source file only contains
5599 sources for a single language.
5600
5601 This property is initialized by the value of the CMAKE_UNITY_BUILD
5602 variable when a target is created.
5603
5604 NOTE:
5605 Projects should not directly set the UNITY_BUILD property or its
5606 associated CMAKE_UNITY_BUILD variable to true. Depending on the
5607 capabilities of the build machine and compiler used, it might or
5608 might not be appropriate to enable unity builds. Therefore, this
5609 feature should be under developer control, which would normally be
5610 through the developer choosing whether or not to set the
5611 CMAKE_UNITY_BUILD variable on the cmake(1) command line or some
5612 other equivalent method. However, it IS recommended to set the
5613 UNITY_BUILD target property to false if it is known that enabling
5614 unity builds for the target can lead to problems.
5615
5616 ODR (One definition rule) errors
5617 When multiple source files are included into one source file, as is
5618 done for unity builds, it can potentially lead to ODR errors. CMake
5619 provides a number of measures to help address such problems:
5620
5621 · Any source file that has a non-empty COMPILE_OPTIONS, COMPILE_DEFINI‐
5622 TIONS, COMPILE_FLAGS, or INCLUDE_DIRECTORIES source property will not
5623 be combined into a unity source.
5624
5625 · Projects can prevent an individual source file from being combined
5626 into a unity source by setting its SKIP_UNITY_BUILD_INCLUSION source
5627 property to true. This can be a more effective way to prevent prob‐
5628 lems with specific files than disabling unity builds for an entire
5629 target.
5630
5631 · The UNITY_BUILD_CODE_BEFORE_INCLUDE and
5632 UNITY_BUILD_CODE_AFTER_INCLUDE target properties can be used to
5633 inject code into the unity source files before and after every
5634 #include statement.
5635
5636 · The order of source files added to the target via commands like
5637 add_library(), add_executable() or target_sources() will be preserved
5638 in the generated unity source files. This can be used to manually
5639 enforce a specific grouping based on the UNITY_BUILD_BATCH_SIZE tar‐
5640 get property.
5641
5642 UNITY_BUILD_BATCH_SIZE
5643 New in version 3.16.
5644
5645
5646 Specifies the maximum number of source files that can be combined into
5647 any one unity source file when unity builds are enabled by the
5648 UNITY_BUILD target property. The original source files will be dis‐
5649 tributed across as many unity source files as necessary to honor this
5650 limit.
5651
5652 The initial value for this property is taken from the
5653 CMAKE_UNITY_BUILD_BATCH_SIZE variable when the target is created. If
5654 that variable has not been set, the initial value will be 8.
5655
5656 The batch size needs to be selected carefully. If set too high, the
5657 size of the combined source files could result in the compiler using
5658 excessive memory or hitting other similar limits. In extreme cases,
5659 this can even result in build failure. On the other hand, if the batch
5660 size is too low, there will be little gain in build performance.
5661
5662 Although strongly discouraged, the batch size may be set to a value of
5663 0 to combine all the sources for the target into a single unity file,
5664 regardless of how many sources are involved. This runs the risk of
5665 creating an excessively large unity source file and negatively impact‐
5666 ing the build performance, so a value of 0 is not generally recom‐
5667 mended.
5668
5669 UNITY_BUILD_CODE_AFTER_INCLUDE
5670 New in version 3.16.
5671
5672
5673 Code snippet which is included verbatim by the UNITY_BUILD feature just
5674 after every #include statement in the generated unity source files.
5675 For example:
5676
5677 set(after [[
5678 #if defined(NOMINMAX)
5679 #undef NOMINMAX
5680 #endif
5681 ]])
5682 set_target_properties(myTarget PROPERTIES
5683 UNITY_BUILD_CODE_AFTER_INCLUDE "${after}"
5684 )
5685
5686 See also UNITY_BUILD_CODE_BEFORE_INCLUDE.
5687
5688 UNITY_BUILD_CODE_BEFORE_INCLUDE
5689 New in version 3.16.
5690
5691
5692 Code snippet which is included verbatim by the UNITY_BUILD feature just
5693 before every #include statement in the generated unity source files.
5694 For example:
5695
5696 set(before [[
5697 #if !defined(NOMINMAX)
5698 #define NOMINMAX
5699 #endif
5700 ]])
5701 set_target_properties(myTarget PROPERTIES
5702 UNITY_BUILD_CODE_BEFORE_INCLUDE "${before}"
5703 )
5704
5705 See also UNITY_BUILD_CODE_AFTER_INCLUDE.
5706
5707 UNITY_BUILD_MODE
5708 New in version 3.18.
5709
5710
5711 CMake provides different algorithms for selecting which sources are
5712 grouped together into a bucket. Selection is decided by this property,
5713 which has the following acceptable values:
5714
5715 BATCH When in this mode CMake determines which files are grouped
5716 together. The UNITY_BUILD_BATCH_SIZE property controls the
5717 upper limit on how many sources can be combined per unity source
5718 file.
5719
5720 Example usage:
5721
5722 add_library(example_library
5723 source1.cxx
5724 source2.cxx
5725 source3.cxx
5726 source4.cxx)
5727
5728 set_target_properties(example_library PROPERTIES
5729 UNITY_BUILD_MODE BATCH
5730 UNITY_BUILD_BATCH_SIZE 2
5731 )
5732
5733 GROUP When in this mode each target explicitly specifies how to group
5734 source files. Each source file that has the same UNITY_GROUP
5735 value will be grouped together. Any sources that don’t have this
5736 property will be compiled individually. The
5737 UNITY_BUILD_BATCH_SIZE property is ignored when using this mode.
5738
5739 Example usage:
5740
5741 add_library(example_library
5742 source1.cxx
5743 source2.cxx
5744 source3.cxx
5745 source4.cxx)
5746
5747 set_target_properties(example_library PROPERTIES
5748 UNITY_BUILD_MODE GROUP
5749 )
5750
5751 set_source_files_properties(source1.cxx source2.cxx source3.cxx
5752 PROPERTIES UNITY_GROUP "bucket1"
5753 )
5754 set_source_files_properties(source4.cxx
5755 PROPERTIES UNITY_GROUP "bucket2"
5756 )
5757
5758 If no explicit UNITY_BUILD_MODE has been specified, CMake will default
5759 to BATCH.
5760
5761 VERSION
5762 What version number is this target.
5763
5764 For shared libraries VERSION and SOVERSION can be used to specify the
5765 build version and API version respectively. When building or
5766 installing appropriate symlinks are created if the platform supports
5767 symlinks and the linker supports so-names. If only one of both is
5768 specified the missing is assumed to have the same version number. For
5769 executables VERSION can be used to specify the build version. When
5770 building or installing appropriate symlinks are created if the platform
5771 supports symlinks.
5772
5773 Windows Versions
5774 For shared libraries and executables on Windows the VERSION attribute
5775 is parsed to extract a <major>.<minor> version number. These numbers
5776 are used as the image version of the binary.
5777
5778 Mach-O Versions
5779 For shared libraries and executables on Mach-O systems (e.g. macOS,
5780 iOS), the SOVERSION property corresponds to the compatibility version
5781 and VERSION corresponds to the current version (unless Mach-O specific
5782 overrides are provided, as discussed below). See the FRAMEWORK target
5783 property for an example.
5784
5785 For shared libraries, the MACHO_COMPATIBILITY_VERSION and MACHO_CUR‐
5786 RENT_VERSION properties can be used to override the compatibility ver‐
5787 sion and current version respectively. Note that SOVERSION will still
5788 be used to form the install_name and both SOVERSION and VERSION may
5789 also affect the file and symlink names.
5790
5791 Versions of Mach-O binaries may be checked with the otool -L <binary>
5792 command.
5793
5794 VISIBILITY_INLINES_HIDDEN
5795 Whether to add a compile flag to hide symbols of inline functions
5796
5797 The VISIBILITY_INLINES_HIDDEN property determines whether a flag for
5798 hiding symbols for inline functions, such as -fvisibility-inlines-hid‐
5799 den, should be used when invoking the compiler. This property affects
5800 compilation in sources of all types of targets (subject to policy
5801 CMP0063).
5802
5803 This property is initialized by the value of the CMAKE_VISIBIL‐
5804 ITY_INLINES_HIDDEN variable if it is set when a target is created.
5805
5806 VS_CONFIGURATION_TYPE
5807 New in version 3.6.
5808
5809
5810 Visual Studio project configuration type.
5811
5812 Sets the ConfigurationType attribute for a generated Visual Studio
5813 project. The property value may use generator expressions. If this
5814 property is set, it overrides the default setting that is based on the
5815 target type (e.g. StaticLibrary, Application, …).
5816
5817 Supported on Visual Studio Generators for VS 2010 and higher.
5818
5819 VS_DEBUGGER_COMMAND
5820 New in version 3.12.
5821
5822
5823 Sets the local debugger command for Visual Studio C++ targets. The
5824 property value may use generator expressions. This is defined in
5825 <LocalDebuggerCommand> in the Visual Studio project file.
5826
5827 This property only works for Visual Studio 2010 and above; it is
5828 ignored on other generators.
5829
5830 VS_DEBUGGER_COMMAND_ARGUMENTS
5831 New in version 3.13.
5832
5833
5834 Sets the local debugger command line arguments for Visual Studio C++
5835 targets. The property value may use generator expressions. This is
5836 defined in <LocalDebuggerCommandArguments> in the Visual Studio project
5837 file.
5838
5839 This property only works for Visual Studio 2010 and above; it is
5840 ignored on other generators.
5841
5842 VS_DEBUGGER_ENVIRONMENT
5843 New in version 3.13.
5844
5845
5846 Sets the local debugger environment for Visual Studio C++ targets. The
5847 property value may use generator expressions. This is defined in
5848 <LocalDebuggerEnvironment> in the Visual Studio project file.
5849
5850 This property only works for Visual Studio 2010 and above; it is
5851 ignored on other generators.
5852
5853 VS_DEBUGGER_WORKING_DIRECTORY
5854 New in version 3.8.
5855
5856
5857 Sets the local debugger working directory for Visual Studio C++ tar‐
5858 gets. The property value may use generator expressions. This is
5859 defined in <LocalDebuggerWorkingDirectory> in the Visual Studio project
5860 file.
5861
5862 This property only works for Visual Studio 2010 and above; it is
5863 ignored on other generators.
5864
5865 VS_DESKTOP_EXTENSIONS_VERSION
5866 New in version 3.4.
5867
5868
5869 Visual Studio Windows 10 Desktop Extensions Version
5870
5871 Specifies the version of the Desktop Extensions that should be included
5872 in the target. For example 10.0.10240.0. If the value is not specified,
5873 the Desktop Extensions will not be included. To use the same version of
5874 the extensions as the Windows 10 SDK that is being used, you can use
5875 the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.
5876
5877 VS_DOTNET_DOCUMENTATION_FILE
5878 New in version 3.17.
5879
5880
5881 Visual Studio managed project .NET documentation output
5882
5883 Sets the target XML documentation file output.
5884
5885 VS_DOTNET_REFERENCE_<refname>
5886 New in version 3.8.
5887
5888
5889 Visual Studio managed project .NET reference with name <refname> and
5890 hint path.
5891
5892 Adds one .NET reference to generated Visual Studio project. The refer‐
5893 ence will have the name <refname> and will point to the assembly given
5894 as value of the property.
5895
5896 See also VS_DOTNET_REFERENCES and VS_DOTNET_REFERENCES_COPY_LOCAL
5897
5898 VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
5899 New in version 3.10.
5900
5901
5902 Defines an XML property <tagname> for a .NET reference <refname>.
5903
5904 Reference properties can be set for .NET references which are defined
5905 by the target properties VS_DOTNET_REFERENCES, VS_DOTNET_REFER‐
5906 ENCE_<refname> and also for project references to other C# targets
5907 which are established by target_link_libraries().
5908
5909 This property is only applicable to C# targets and Visual Studio gener‐
5910 ators 2010 and later.
5911
5912 VS_DOTNET_REFERENCES
5913 Visual Studio managed project .NET references
5914
5915 Adds one or more semicolon-delimited .NET references to a generated
5916 Visual Studio project. For example, “System;System.Windows.Forms”.
5917
5918 VS_DOTNET_REFERENCES_COPY_LOCAL
5919 New in version 3.8.
5920
5921
5922 Sets the Copy Local property for all .NET hint references in the target
5923
5924 Boolean property to enable/disable copying of .NET hint references to
5925 output directory. The default is ON.
5926
5927 VS_DOTNET_TARGET_FRAMEWORK_VERSION
5928 Specify the .NET target framework version.
5929
5930 Used to specify the .NET target framework version for C++/CLI. For
5931 example, “v4.5”.
5932
5933 This property is deprecated and should not be used anymore. Use DOT‐
5934 NET_TARGET_FRAMEWORK or DOTNET_TARGET_FRAMEWORK_VERSION instead.
5935
5936 VS_DPI_AWARE
5937 New in version 3.16.
5938
5939
5940 Set the Manifest Tool -> Input and Output -> DPI Awareness in the Vis‐
5941 ual Studio target project properties.
5942
5943 Valid values are PerMonitor, ON, or OFF.
5944
5945 For example:
5946
5947 add_executable(myproject myproject.cpp)
5948 set_property(TARGET myproject PROPERTY VS_DPI_AWARE "PerMonitor")
5949
5950 VS_GLOBAL_KEYWORD
5951 Visual Studio project keyword for VS 10 (2010) and newer.
5952
5953 Sets the “keyword” attribute for a generated Visual Studio project.
5954 Defaults to “Win32Proj”. You may wish to override this value with
5955 “ManagedCProj”, for example, in a Visual Studio managed C++ unit test
5956 project.
5957
5958 Use the VS_KEYWORD target property to set the keyword for Visual Studio
5959 9 (2008) and older.
5960
5961 VS_GLOBAL_PROJECT_TYPES
5962 Visual Studio project type(s).
5963
5964 Can be set to one or more UUIDs recognized by Visual Studio to indicate
5965 the type of project. This value is copied verbatim into the generated
5966 project file. Example for a managed C++ unit testing project:
5967
5968 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
5969
5970 UUIDs are semicolon-delimited.
5971
5972 VS_GLOBAL_ROOTNAMESPACE
5973 Visual Studio project root namespace.
5974
5975 Sets the “RootNamespace” attribute for a generated Visual Studio
5976 project. The attribute will be generated only if this is set.
5977
5978 VS_GLOBAL_<variable>
5979 Visual Studio project-specific global variable.
5980
5981 Tell the Visual Studio generator to set the global variable ‘<vari‐
5982 able>’ to a given value in the generated Visual Studio project.
5983 Ignored on other generators. Qt integration works better if
5984 VS_GLOBAL_QtVersion is set to the version FindQt4.cmake found. For
5985 example, “4.7.3”
5986
5987 VS_IOT_EXTENSIONS_VERSION
5988 New in version 3.4.
5989
5990
5991 Visual Studio Windows 10 IoT Extensions Version
5992
5993 Specifies the version of the IoT Extensions that should be included in
5994 the target. For example 10.0.10240.0. If the value is not specified,
5995 the IoT Extensions will not be included. To use the same version of the
5996 extensions as the Windows 10 SDK that is being used, you can use the
5997 CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.
5998
5999 VS_IOT_STARTUP_TASK
6000 New in version 3.4.
6001
6002
6003 Visual Studio Windows 10 IoT Continuous Background Task
6004
6005 Specifies that the target should be compiled as a Continuous Background
6006 Task library.
6007
6008 VS_JUST_MY_CODE_DEBUGGING
6009 New in version 3.15.
6010
6011
6012 Enable Just My Code with Visual Studio debugger.
6013
6014 Supported on Visual Studio Generators for VS 2010 and higher, Makefile
6015 Generators and the Ninja generators.
6016
6017 This property is initialized by the CMAKE_VS_JUST_MY_CODE_DEBUGGING
6018 variable if it is set when a target is created.
6019
6020 VS_KEYWORD
6021 Visual Studio project keyword for VS 9 (2008) and older.
6022
6023 Can be set to change the visual studio keyword, for example Qt integra‐
6024 tion works better if this is set to Qt4VSv1.0.
6025
6026 Use the VS_GLOBAL_KEYWORD target property to set the keyword for Visual
6027 Studio 10 (2010) and newer.
6028
6029 VS_MOBILE_EXTENSIONS_VERSION
6030 New in version 3.4.
6031
6032
6033 Visual Studio Windows 10 Mobile Extensions Version
6034
6035 Specifies the version of the Mobile Extensions that should be included
6036 in the target. For example 10.0.10240.0. If the value is not specified,
6037 the Mobile Extensions will not be included. To use the same version of
6038 the extensions as the Windows 10 SDK that is being used, you can use
6039 the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.
6040
6041 VS_NO_SOLUTION_DEPLOY
6042 New in version 3.15.
6043
6044
6045 Specify that the target should not be marked for deployment to a Win‐
6046 dows CE or Windows Phone device in the generated Visual Studio solu‐
6047 tion.
6048
6049 Be default, all EXE and shared library (DLL) targets are marked to
6050 deploy to the target device in the generated Visual Studio solution.
6051
6052 Generator expressions are supported.
6053
6054 There are reasons one might want to exclude a target / generated
6055 project from deployment:
6056
6057 · The library or executable may not be necessary in the primary
6058 deploy/debug scenario, and excluding from deployment saves time in
6059 the develop/download/debug cycle.
6060
6061 · There may be insufficient space on the target device to accommodate
6062 all of the build products.
6063
6064 · Visual Studio 2013 requires a target device IP address be entered for
6065 each target marked for deployment. For large numbers of targets,
6066 this can be tedious. NOTE: Visual Studio will deploy all project
6067 dependencies of a project tagged for deployment to the IP address
6068 configured for that project even if those dependencies are not tagged
6069 for deployment.
6070
6071 Example 1
6072 This shows setting the variable for the target foo.
6073
6074 add_library(foo SHARED foo.cpp)
6075 set_property(TARGET foo PROPERTY VS_NO_SOLUTION_DEPLOY ON)
6076
6077 Example 2
6078 This shows setting the variable for the Release configuration only.
6079
6080 add_library(foo SHARED foo.cpp)
6081 set_property(TARGET foo PROPERTY VS_NO_SOLUTION_DEPLOY "$<CONFIG:Release>")
6082
6083 VS_PACKAGE_REFERENCES
6084 New in version 3.15.
6085
6086
6087 Visual Studio package references for nuget.
6088
6089 Adds one or more semicolon-delimited package references to a generated
6090 Visual Studio project. The version of the package will be underscore
6091 delimited. For example, boost_1.7.0;nunit_3.12.*.
6092
6093 set_property(TARGET ${TARGET_NAME} PROPERTY
6094 VS_PACKAGE_REFERENCES "boost_1.7.0")
6095
6096 VS_PLATFORM_TOOLSET
6097 New in version 3.18.
6098
6099
6100 Overrides the platform toolset used to build a target.
6101
6102 Only supported when the compiler used by the given toolset is the same
6103 as the compiler used to build the whole source tree.
6104
6105 This is especially useful to create driver projects with the toolsets
6106 “WindowsUserModeDriver10.0” or “WindowsKernelModeDriver10.0”.
6107
6108 VS_PROJECT_IMPORT
6109 New in version 3.15.
6110
6111
6112 Visual Studio managed project imports
6113
6114 Adds to a generated Visual Studio project one or more semicolon-delim‐
6115 ited paths to .props files needed when building projects from some
6116 NuGet packages. For example, my_packages_path/MyPack‐
6117 age.1.0.0/build/MyPackage.props.
6118
6119 VS_SCC_AUXPATH
6120 Visual Studio Source Code Control Aux Path.
6121
6122 Can be set to change the visual studio source code control auxpath
6123 property.
6124
6125 VS_SCC_LOCALPATH
6126 Visual Studio Source Code Control Local Path.
6127
6128 Can be set to change the visual studio source code control local path
6129 property.
6130
6131 VS_SCC_PROJECTNAME
6132 Visual Studio Source Code Control Project.
6133
6134 Can be set to change the visual studio source code control project name
6135 property.
6136
6137 VS_SCC_PROVIDER
6138 Visual Studio Source Code Control Provider.
6139
6140 Can be set to change the visual studio source code control provider
6141 property.
6142
6143 VS_SDK_REFERENCES
6144 New in version 3.7.
6145
6146
6147 Visual Studio project SDK references. Specify a semicolon-separated
6148 list of SDK references to be added to a generated Visual Studio
6149 project, e.g. Microsoft.AdMediatorWindows81, Version=1.0.
6150
6151 VS_SOLUTION_DEPLOY
6152 New in version 3.18.
6153
6154
6155 Specify that the target should be marked for deployment when not tar‐
6156 geting Windows CE, Windows Phone or a Windows Store application.
6157
6158 If the target platform doesn’t support deployment, this property won’t
6159 have any effect.
6160
6161 Generator expressions are supported.
6162
6163 Examples
6164 Always deploy target foo:
6165
6166 add_executable(foo SHARED foo.cpp)
6167 set_property(TARGET foo PROPERTY VS_SOLUTION_DEPLOY ON)
6168
6169 Deploy target foo for all configurations except Release:
6170
6171 add_executable(foo SHARED foo.cpp)
6172 set_property(TARGET foo PROPERTY VS_SOLUTION_DEPLOY "$<NOT:$<CONFIG:Release>>")
6173
6174 VS_SOURCE_SETTINGS_<tool>
6175 New in version 3.18.
6176
6177
6178 Set any item metadata on all non-built files that use <tool>.
6179
6180 Takes a list of Key=Value pairs. Tells the Visual Studio generator to
6181 set Key to Value as item metadata on all non-built files that use
6182 <tool>.
6183
6184 For example:
6185
6186 set_property(TARGET main PROPERTY VS_SOURCE_SETTINGS_FXCompile "Key=Value" "Key2=Value2")
6187
6188 will set Key to Value and Key2 to Value2 for all non-built files that
6189 use FXCompile.
6190
6191 Generator expressions are supported.
6192
6193 VS_USER_PROPS
6194 New in version 3.8.
6195
6196
6197 Sets the user props file to be included in the visual studio C++
6198 project file. The standard path is $(UserRootDir)\\Micro‐
6199 soft.Cpp.$(Platform).user.props, which is in most cases the same as
6200 %LOCALAPPDATA%\\Microsoft\\MSBuild\\v4.0\\Micro‐
6201 soft.Cpp.Win32.user.props or %LOCALAPPDATA%\\Micro‐
6202 soft\\MSBuild\\v4.0\\Microsoft.Cpp.x64.user.props.
6203
6204 The *.user.props files can be used for Visual Studio wide configuration
6205 which is independent from cmake.
6206
6207 VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
6208 New in version 3.4.
6209
6210
6211 Visual Studio Windows Target Platform Minimum Version
6212
6213 For Windows 10. Specifies the minimum version of the OS that is being
6214 targeted. For example 10.0.10240.0. If the value is not specified, the
6215 value of CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION will be used on Win‐
6216 dowsStore projects otherwise the target platform minimum version will
6217 not be specified for the project.
6218
6219 VS_WINRT_COMPONENT
6220 New in version 3.1.
6221
6222
6223 Mark a target as a Windows Runtime component for the Visual Studio gen‐
6224 erator. Compile the target with C++/CX language extensions for Windows
6225 Runtime. For SHARED and MODULE libraries, this also defines the
6226 _WINRT_DLL preprocessor macro.
6227
6228 NOTE:
6229 Currently this is implemented only by Visual Studio generators.
6230 Support may be added to other generators in the future.
6231
6232 VS_WINRT_EXTENSIONS
6233 Deprecated. Use VS_WINRT_COMPONENT instead. This property was an
6234 experimental partial implementation of that one.
6235
6236 VS_WINRT_REFERENCES
6237 Visual Studio project Windows Runtime Metadata references
6238
6239 Adds one or more semicolon-delimited WinRT references to a generated
6240 Visual Studio project. For example, “Windows;Windows.UI.Core”.
6241
6242 WIN32_EXECUTABLE
6243 Build an executable with a WinMain entry point on windows.
6244
6245 When this property is set to true the executable when linked on Windows
6246 will be created with a WinMain() entry point instead of just main().
6247 This makes it a GUI executable instead of a console application. See
6248 the CMAKE_MFC_FLAG variable documentation to configure use of the Mi‐
6249 crosoft Foundation Classes (MFC) for WinMain executables. This prop‐
6250 erty is initialized by the value of the CMAKE_WIN32_EXECUTABLE variable
6251 if it is set when a target is created.
6252
6253 This property supports generator expressions, except if the target is
6254 managed (contains C# code.)
6255
6256 WINDOWS_EXPORT_ALL_SYMBOLS
6257 New in version 3.4.
6258
6259
6260 This property is implemented only for MS-compatible tools on Windows.
6261
6262 Enable this boolean property to automatically create a module defini‐
6263 tion (.def) file with all global symbols found in the input .obj files
6264 for a SHARED library (or executable with ENABLE_EXPORTS) on Windows.
6265 The module definition file will be passed to the linker causing all
6266 symbols to be exported from the .dll. For global data symbols,
6267 __declspec(dllimport) must still be used when compiling against the
6268 code in the .dll. All other function symbols will be automatically
6269 exported and imported by callers. This simplifies porting projects to
6270 Windows by reducing the need for explicit dllexport markup, even in C++
6271 classes.
6272
6273 When this property is enabled, zero or more .def files may also be
6274 specified as source files of the target. The exports named by these
6275 files will be merged with those detected from the object files to gen‐
6276 erate a single module definition file to be passed to the linker. This
6277 can be used to export symbols from a .dll that are not in any of its
6278 object files but are added by the linker from dependencies (e.g.
6279 msvcrt.lib).
6280
6281 This property is initialized by the value of the CMAKE_WIN‐
6282 DOWS_EXPORT_ALL_SYMBOLS variable if it is set when a target is created.
6283
6284 XCODE_ATTRIBUTE_<an-attribute>
6285 Set Xcode target attributes directly.
6286
6287 Tell the Xcode generator to set ‘<an-attribute>’ to a given value in
6288 the generated Xcode project. Ignored on other generators.
6289
6290 See the CMAKE_XCODE_ATTRIBUTE_<an-attribute> variable to set attributes
6291 on all targets in a directory tree.
6292
6293 Contents of XCODE_ATTRIBUTE_<an-attribute> may use “generator expres‐
6294 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
6295 manual for available expressions. See the cmake-buildsystem(7) manual
6296 for more on defining buildsystem properties.
6297
6298 XCODE_EXPLICIT_FILE_TYPE
6299 New in version 3.8.
6300
6301
6302 Set the Xcode explicitFileType attribute on its reference to a target.
6303 CMake computes a default based on target type but can be told explic‐
6304 itly with this property.
6305
6306 See also XCODE_PRODUCT_TYPE.
6307
6308 XCODE_GENERATE_SCHEME
6309 New in version 3.15.
6310
6311
6312 If enabled, the Xcode generator will generate schema files. These are
6313 useful to invoke analyze, archive, build-for-testing and test actions
6314 from the command line.
6315
6316 This property is initialized by the value of the variable
6317 CMAKE_XCODE_GENERATE_SCHEME if it is set when a target is created.
6318
6319 The following target properties overwrite the default of the corre‐
6320 sponding settings on the “Diagnostic” tab for each schema file. Each
6321 of those is initialized by the respective CMAKE_ variable at target
6322 creation time.
6323
6324 · XCODE_SCHEME_ADDRESS_SANITIZER
6325
6326 · XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
6327
6328 · XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
6329
6330 · XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
6331
6332 · XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
6333
6334 · XCODE_SCHEME_GUARD_MALLOC
6335
6336 · XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
6337
6338 · XCODE_SCHEME_MALLOC_GUARD_EDGES
6339
6340 · XCODE_SCHEME_MALLOC_SCRIBBLE
6341
6342 · XCODE_SCHEME_MALLOC_STACK
6343
6344 · XCODE_SCHEME_THREAD_SANITIZER
6345
6346 · XCODE_SCHEME_THREAD_SANITIZER_STOP
6347
6348 · XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
6349
6350 · XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
6351
6352 · XCODE_SCHEME_ZOMBIE_OBJECTS
6353
6354 The following target properties will be applied on the “Info”, “Argu‐
6355 ments”, and “Options” tab:
6356
6357 · XCODE_SCHEME_ARGUMENTS
6358
6359 · XCODE_SCHEME_DEBUG_AS_ROOT
6360
6361 · XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
6362
6363 · XCODE_SCHEME_ENVIRONMENT
6364
6365 · XCODE_SCHEME_EXECUTABLE
6366
6367 · XCODE_SCHEME_WORKING_DIRECTORY
6368
6369 XCODE_LINK_BUILD_PHASE_MODE
6370 New in version 3.19.
6371
6372
6373 When using the Xcode generator, libraries to be linked will be speci‐
6374 fied in the Xcode project file using either the “Link Binary With
6375 Libraries” build phase or directly as linker flags. The former allows
6376 Xcode to manage build paths, which may be necessary when creating Xcode
6377 archives because it may use different build paths to a regular build.
6378
6379 This property controls usage of “Link Binary With Libraries” build
6380 phase for a target that is an app bundle, executable, shared library,
6381 shared framework or a module library.
6382
6383 Possible values are:
6384
6385 · NONE The libraries will be linked by specifying the linker flags
6386 directly.
6387
6388 · BUILT_ONLY The “Link Binary With Libraries” build phase will be used
6389 to link to another target under the following conditions:
6390
6391 · The target to be linked to is a regular non-imported, non-interface
6392 library target.
6393
6394 · The output directory of the target being built has not been changed
6395 from its default (see RUNTIME_OUTPUT_DIRECTORY and LIBRARY_OUT‐
6396 PUT_DIRECTORY).
6397
6398 · KNOWN_LOCATION The “Link Binary With Libraries” build phase will be
6399 used to link to another target under the same conditions as with
6400 BUILT_ONLY and also:
6401
6402 · Imported library targets except those of type UNKNOWN.
6403
6404 · Any non-target library specified directly with a path.
6405
6406 For all other cases, the libraries will be linked by specifying the
6407 linker flags directly.
6408
6409 WARNING:
6410 Libraries linked using “Link Binary With Libraries” are linked after
6411 the ones linked through regular linker flags. This order should be
6412 taken into account when different static libraries contain symbols
6413 with the same name, as the former ones will take precedence over the
6414 latter.
6415
6416 WARNING:
6417 If two or more directories contain libraries with identical file
6418 names and some libraries are linked from those directories, the
6419 library search path lookup will end up linking libraries from the
6420 first directory. This is a known limitation of Xcode.
6421
6422 This property is initialized by the value of the
6423 CMAKE_XCODE_LINK_BUILD_PHASE_MODE variable if it is set when a target
6424 is created.
6425
6426 XCODE_PRODUCT_TYPE
6427 New in version 3.8.
6428
6429
6430 Set the Xcode productType attribute on its reference to a target.
6431 CMake computes a default based on target type but can be told explic‐
6432 itly with this property.
6433
6434 See also XCODE_EXPLICIT_FILE_TYPE.
6435
6436 XCODE_SCHEME_ADDRESS_SANITIZER
6437 New in version 3.13.
6438
6439
6440 Whether to enable Address Sanitizer in the Diagnostics section of the
6441 generated Xcode scheme.
6442
6443 This property is initialized by the value of the variable
6444 CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER if it is set when a target is cre‐
6445 ated.
6446
6447 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6448 to see all Xcode schema related properties.
6449
6450 XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
6451 New in version 3.13.
6452
6453
6454 Whether to enable Detect use of stack after return in the Diagnostics
6455 section of the generated Xcode scheme.
6456
6457 This property is initialized by the value of the variable
6458 CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN if it is set when
6459 a target is created.
6460
6461 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6462 to see all Xcode schema related properties.
6463
6464 XCODE_SCHEME_ARGUMENTS
6465 New in version 3.13.
6466
6467
6468 Specify command line arguments that should be added to the Arguments
6469 section of the generated Xcode scheme.
6470
6471 If set to a list of arguments those will be added to the scheme.
6472
6473 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6474 to see all Xcode schema related properties.
6475
6476 XCODE_SCHEME_DEBUG_AS_ROOT
6477 New in version 3.15.
6478
6479
6480 Whether to debug the target as ‘root’.
6481
6482 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6483 to see all Xcode schema related properties.
6484
6485 XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
6486 New in version 3.16.
6487
6488
6489 Whether to enable Allow debugging when using document Versions Browser
6490 in the Options section of the generated Xcode scheme.
6491
6492 This property is initialized by the value of the variable
6493 CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING if it is set when a target
6494 is created.
6495
6496 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6497 to see all Xcode schema related properties.
6498
6499 XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
6500 New in version 3.13.
6501
6502
6503 Whether to disable the Main Thread Checker in the Diagnostics section
6504 of the generated Xcode scheme.
6505
6506 This property is initialized by the value of the variable
6507 CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER if it is set when a tar‐
6508 get is created.
6509
6510 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6511 to see all Xcode schema related properties.
6512
6513 XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
6514 New in version 3.13.
6515
6516
6517 Whether to enable Dynamic Library Loads in the Diagnostics section of
6518 the generated Xcode scheme.
6519
6520 This property is initialized by the value of the variable
6521 CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS if it is set when a target is
6522 created.
6523
6524 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6525 to see all Xcode schema related properties.
6526
6527 XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
6528 New in version 3.13.
6529
6530
6531 Whether to enable Dynamic Linker API usage in the Diagnostics section
6532 of the generated Xcode scheme.
6533
6534 This property is initialized by the value of the variable
6535 CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE if it is set when a target
6536 is created.
6537
6538 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6539 to see all Xcode schema related properties.
6540
6541 XCODE_SCHEME_ENVIRONMENT
6542 New in version 3.13.
6543
6544
6545 Specify environment variables that should be added to the Arguments
6546 section of the generated Xcode scheme.
6547
6548 If set to a list of environment variables and values of the form
6549 MYVAR=value those environment variables will be added to the scheme.
6550
6551 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6552 to see all Xcode schema related properties.
6553
6554 XCODE_SCHEME_EXECUTABLE
6555 New in version 3.13.
6556
6557
6558 Specify path to executable in the Info section of the generated Xcode
6559 scheme. If not set the schema generator will select the current target
6560 if it is actually executable.
6561
6562 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6563 to see all Xcode schema related properties.
6564
6565 XCODE_SCHEME_GUARD_MALLOC
6566 New in version 3.13.
6567
6568
6569 Whether to enable Guard Malloc in the Diagnostics section of the gener‐
6570 ated Xcode scheme.
6571
6572 This property is initialized by the value of the variable
6573 CMAKE_XCODE_SCHEME_GUARD_MALLOC if it is set when a target is created.
6574
6575 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6576 to see all Xcode schema related properties.
6577
6578 XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
6579 New in version 3.13.
6580
6581
6582 Whether to enable the Main Thread Checker option Pause on issues in the
6583 Diagnostics section of the generated Xcode scheme.
6584
6585 This property is initialized by the value of the variable
6586 CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP if it is set when a target
6587 is created.
6588
6589 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6590 to see all Xcode schema related properties.
6591
6592 XCODE_SCHEME_MALLOC_GUARD_EDGES
6593 New in version 3.13.
6594
6595
6596 Whether to enable Malloc Guard Edges in the Diagnostics section of the
6597 generated Xcode scheme.
6598
6599 This property is initialized by the value of the variable
6600 CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES if it is set when a target is
6601 created.
6602
6603 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6604 to see all Xcode schema related properties.
6605
6606 XCODE_SCHEME_MALLOC_SCRIBBLE
6607 New in version 3.13.
6608
6609
6610 Whether to enable Malloc Scribble in the Diagnostics section of the
6611 generated Xcode scheme.
6612
6613 This property is initialized by the value of the variable
6614 CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE if it is set when a target is cre‐
6615 ated.
6616
6617 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6618 to see all Xcode schema related properties.
6619
6620 XCODE_SCHEME_MALLOC_STACK
6621 New in version 3.13.
6622
6623
6624 Whether to enable Malloc Stack in the Diagnostics section of the gener‐
6625 ated Xcode scheme.
6626
6627 This property is initialized by the value of the variable
6628 CMAKE_XCODE_SCHEME_MALLOC_STACK if it is set when a target is created.
6629
6630 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6631 to see all Xcode schema related properties.
6632
6633 XCODE_SCHEME_THREAD_SANITIZER
6634 New in version 3.13.
6635
6636
6637 Whether to enable Thread Sanitizer in the Diagnostics section of the
6638 generated Xcode scheme.
6639
6640 This property is initialized by the value of the variable
6641 CMAKE_XCODE_SCHEME_THREAD_SANITIZER if it is set when a target is cre‐
6642 ated.
6643
6644 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6645 to see all Xcode schema related properties.
6646
6647 XCODE_SCHEME_THREAD_SANITIZER_STOP
6648 New in version 3.13.
6649
6650
6651 Whether to enable Thread Sanitizer - Pause on issues in the Diagnostics
6652 section of the generated Xcode scheme.
6653
6654 This property is initialized by the value of the variable
6655 CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP if it is set when a target is
6656 created.
6657
6658 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6659 to see all Xcode schema related properties.
6660
6661 XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
6662 New in version 3.13.
6663
6664
6665 Whether to enable Undefined Behavior Sanitizer in the Diagnostics sec‐
6666 tion of the generated Xcode scheme.
6667
6668 This property is initialized by the value of the variable
6669 CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER if it is set when a
6670 target is created.
6671
6672 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6673 to see all Xcode schema related properties.
6674
6675 XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
6676 New in version 3.13.
6677
6678
6679 Whether to enable Undefined Behavior Sanitizer option Pause on issues
6680 in the Diagnostics section of the generated Xcode scheme.
6681
6682 This property is initialized by the value of the variable
6683 CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP if it is set when
6684 a target is created.
6685
6686 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6687 to see all Xcode schema related properties.
6688
6689 XCODE_SCHEME_WORKING_DIRECTORY
6690 New in version 3.17.
6691
6692
6693 Specify the Working Directory of the Run and Profile actions in the
6694 generated Xcode scheme. In case the value contains generator expres‐
6695 sions those are evaluated.
6696
6697 This property is initialized by the value of the variable
6698 CMAKE_XCODE_SCHEME_WORKING_DIRECTORY if it is set when a target is cre‐
6699 ated.
6700
6701 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6702 to see all Xcode schema related properties.
6703
6704 XCODE_SCHEME_ZOMBIE_OBJECTS
6705 New in version 3.13.
6706
6707
6708 Whether to enable Zombie Objects in the Diagnostics section of the gen‐
6709 erated Xcode scheme.
6710
6711 This property is initialized by the value of the variable
6712 CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS if it is set when a target is cre‐
6713 ated.
6714
6715 Please refer to the XCODE_GENERATE_SCHEME target property documentation
6716 to see all Xcode schema related properties.
6717
6718 XCTEST
6719 New in version 3.3.
6720
6721
6722 This target is a XCTest CFBundle on the Mac.
6723
6724 This property will usually get set via the xctest_add_bundle() macro in
6725 FindXCTest module.
6726
6727 If a module library target has this property set to true it will be
6728 built as a CFBundle when built on the Mac. It will have the directory
6729 structure required for a CFBundle.
6730
6731 This property depends on BUNDLE to be effective.
6732
6734 ATTACHED_FILES
6735 Attach a list of files to a dashboard submission.
6736
6737 Set this property to a list of files that will be encoded and submitted
6738 to the dashboard as an addition to the test result.
6739
6740 ATTACHED_FILES_ON_FAIL
6741 Attach a list of files to a dashboard submission if the test fails.
6742
6743 Same as ATTACHED_FILES, but these files will only be included if the
6744 test does not pass.
6745
6746 COST
6747 This property describes the cost of a test. When parallel testing is
6748 enabled, tests in the test set will be run in descending order of cost.
6749 Projects can explicitly define the cost of a test by setting this prop‐
6750 erty to a floating point value.
6751
6752 When the cost of a test is not defined by the project, ctest will ini‐
6753 tially use a default cost of 0. It computes a weighted average of the
6754 cost each time a test is run and uses that as an improved estimate of
6755 the cost for the next run. The more a test is re-run in the same build
6756 directory, the more representative the cost should become.
6757
6758 DEPENDS
6759 Specifies that this test should only be run after the specified list of
6760 tests.
6761
6762 Set this to a list of tests that must finish before this test is run.
6763 The results of those tests are not considered, the dependency relation‐
6764 ship is purely for order of execution (i.e. it is really just a run
6765 after relationship). Consider using test fixtures with setup tests if a
6766 dependency with successful completion is required (see FIX‐
6767 TURES_REQUIRED).
6768
6769 Examples
6770 add_test(NAME baseTest1 ...)
6771 add_test(NAME baseTest2 ...)
6772 add_test(NAME dependsTest12 ...)
6773
6774 set_tests_properties(dependsTest12 PROPERTIES DEPENDS "baseTest1;baseTest2")
6775 # dependsTest12 runs after baseTest1 and baseTest2, even if they fail
6776
6777 DISABLED
6778 New in version 3.9.
6779
6780
6781 If set to True, the test will be skipped and its status will be ‘Not
6782 Run’. A DISABLED test will not be counted in the total number of tests
6783 and its completion status will be reported to CDash as Disabled.
6784
6785 A DISABLED test does not participate in test fixture dependency resolu‐
6786 tion. If a DISABLED test has fixture requirements defined in its FIX‐
6787 TURES_REQUIRED property, it will not cause setup or cleanup tests for
6788 those fixtures to be added to the test set.
6789
6790 If a test with the FIXTURES_SETUP property set is DISABLED, the fixture
6791 behavior will be as though that setup test was passing and any test
6792 case requiring that fixture will still run.
6793
6794 ENVIRONMENT
6795 Specify environment variables that should be defined for running a
6796 test.
6797
6798 If set to a list of environment variables and values of the form
6799 MYVAR=value those environment variables will be defined while running
6800 the test. The environment is restored to its previous state after the
6801 test is done.
6802
6803 FAIL_REGULAR_EXPRESSION
6804 If the output matches this regular expression the test will fail.
6805
6806 If set, if the output matches one of specified regular expressions, the
6807 test will fail. Example:
6808
6809 set_tests_properties(mytest PROPERTIES
6810 FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
6811 )
6812
6813 FAIL_REGULAR_EXPRESSION expects a list of regular expressions.
6814
6815 FIXTURES_CLEANUP
6816 New in version 3.7.
6817
6818
6819 Specifies a list of fixtures for which the test is to be treated as a
6820 cleanup test. These fixture names are distinct from test case names and
6821 are not required to have any similarity to the names of tests associ‐
6822 ated with them.
6823
6824 Fixture cleanup tests are ordinary tests with all of the usual test
6825 functionality. Setting the FIXTURES_CLEANUP property for a test has two
6826 primary effects:
6827
6828 · CTest will ensure the test executes after all other tests which list
6829 any of the fixtures in its FIXTURES_REQUIRED property.
6830
6831 · If CTest is asked to run only a subset of tests (e.g. using regular
6832 expressions or the --rerun-failed option) and the cleanup test is not
6833 in the set of tests to run, it will automatically be added if any
6834 tests in the set require any fixture listed in FIXTURES_CLEANUP.
6835
6836 A cleanup test can have multiple fixtures listed in its FIX‐
6837 TURES_CLEANUP property. It will execute only once for the whole CTest
6838 run, not once for each fixture. A fixture can also have more than one
6839 cleanup test defined. If there are multiple cleanup tests for a fix‐
6840 ture, projects can control their order with the usual DEPENDS test
6841 property if necessary.
6842
6843 A cleanup test is allowed to require other fixtures, but not any fix‐
6844 ture listed in its FIXTURES_CLEANUP property. For example:
6845
6846 # Ok: Dependent fixture is different to cleanup
6847 set_tests_properties(cleanupFoo PROPERTIES
6848 FIXTURES_CLEANUP Foo
6849 FIXTURES_REQUIRED Bar
6850 )
6851
6852 # Error: cannot require same fixture as cleanup
6853 set_tests_properties(cleanupFoo PROPERTIES
6854 FIXTURES_CLEANUP Foo
6855 FIXTURES_REQUIRED Foo
6856 )
6857
6858 Cleanup tests will execute even if setup or regular tests for that fix‐
6859 ture fail or are skipped.
6860
6861 See FIXTURES_REQUIRED for a more complete discussion of how to use test
6862 fixtures.
6863
6864 FIXTURES_REQUIRED
6865 New in version 3.7.
6866
6867
6868 Specifies a list of fixtures the test requires. Fixture names are case
6869 sensitive and they are not required to have any similarity to test
6870 names.
6871
6872 Fixtures are a way to attach setup and cleanup tasks to a set of tests.
6873 If a test requires a given fixture, then all tests marked as setup
6874 tasks for that fixture will be executed first (once for the whole set
6875 of tests, not once per test requiring the fixture). After all tests
6876 requiring a particular fixture have completed, CTest will ensure all
6877 tests marked as cleanup tasks for that fixture are then executed. Tests
6878 are marked as setup tasks with the FIXTURES_SETUP property and as
6879 cleanup tasks with the FIXTURES_CLEANUP property. If any of a fixture’s
6880 setup tests fail, all tests listing that fixture in their FIX‐
6881 TURES_REQUIRED property will not be executed. The cleanup tests for the
6882 fixture will always be executed, even if some setup tests fail.
6883
6884 When CTest is asked to execute only a subset of tests (e.g. by the use
6885 of regular expressions or when run with the --rerun-failed command line
6886 option), it will automatically add any setup or cleanup tests for fix‐
6887 tures required by any of the tests that are in the execution set. This
6888 behavior can be overridden with the -FS, -FC and -FA command line
6889 options to ctest(1) if desired.
6890
6891 Since setup and cleanup tasks are also tests, they can have an ordering
6892 specified by the DEPENDS test property just like any other tests. This
6893 can be exploited to implement setup or cleanup using multiple tests for
6894 a single fixture to modularise setup or cleanup logic.
6895
6896 The concept of a fixture is different to that of a resource specified
6897 by RESOURCE_LOCK, but they may be used together. A fixture defines a
6898 set of tests which share setup and cleanup requirements, whereas a
6899 resource lock has the effect of ensuring a particular set of tests do
6900 not run in parallel. Some situations may need both, such as setting up
6901 a database, serialising test access to that database and deleting the
6902 database again at the end. For such cases, tests would populate both
6903 FIXTURES_REQUIRED and RESOURCE_LOCK to combine the two behaviours.
6904 Names used for RESOURCE_LOCK have no relationship with names of fix‐
6905 tures, so note that a resource lock does not imply a fixture and vice
6906 versa.
6907
6908 Consider the following example which represents a database test sce‐
6909 nario similar to that mentioned above:
6910
6911 add_test(NAME testsDone COMMAND emailResults)
6912 add_test(NAME fooOnly COMMAND testFoo)
6913 add_test(NAME dbOnly COMMAND testDb)
6914 add_test(NAME dbWithFoo COMMAND testDbWithFoo)
6915 add_test(NAME createDB COMMAND initDB)
6916 add_test(NAME setupUsers COMMAND userCreation)
6917 add_test(NAME cleanupDB COMMAND deleteDB)
6918 add_test(NAME cleanupFoo COMMAND removeFoos)
6919
6920 set_tests_properties(setupUsers PROPERTIES DEPENDS createDB)
6921
6922 set_tests_properties(createDB PROPERTIES FIXTURES_SETUP DB)
6923 set_tests_properties(setupUsers PROPERTIES FIXTURES_SETUP DB)
6924 set_tests_properties(cleanupDB PROPERTIES FIXTURES_CLEANUP DB)
6925 set_tests_properties(cleanupFoo PROPERTIES FIXTURES_CLEANUP Foo)
6926 set_tests_properties(testsDone PROPERTIES FIXTURES_CLEANUP "DB;Foo")
6927
6928 set_tests_properties(fooOnly PROPERTIES FIXTURES_REQUIRED Foo)
6929 set_tests_properties(dbOnly PROPERTIES FIXTURES_REQUIRED DB)
6930 set_tests_properties(dbWithFoo PROPERTIES FIXTURES_REQUIRED "DB;Foo")
6931
6932 set_tests_properties(dbOnly dbWithFoo createDB setupUsers cleanupDB
6933 PROPERTIES RESOURCE_LOCK DbAccess)
6934
6935 Key points from this example:
6936
6937 · Two fixtures are defined: DB and Foo. Tests can require a single fix‐
6938 ture as fooOnly and dbOnly do, or they can depend on multiple fix‐
6939 tures like dbWithFoo does.
6940
6941 · A DEPENDS relationship is set up to ensure setupUsers happens after
6942 createDB, both of which are setup tests for the DB fixture and will
6943 therefore be executed before the dbOnly and dbWithFoo tests automati‐
6944 cally.
6945
6946 · No explicit DEPENDS relationships were needed to make the setup tests
6947 run before or the cleanup tests run after the regular tests.
6948
6949 · The Foo fixture has no setup tests defined, only a single cleanup
6950 test.
6951
6952 · testsDone is a cleanup test for both the DB and Foo fixtures. There‐
6953 fore, it will only execute once regular tests for both fixtures have
6954 finished (i.e. after fooOnly, dbOnly and dbWithFoo). No DEPENDS rela‐
6955 tionship was specified for testsDone, so it is free to run before,
6956 after or concurrently with other cleanup tests for either fixture.
6957
6958 · The setup and cleanup tests never list the fixtures they are for in
6959 their own FIXTURES_REQUIRED property, as that would result in a
6960 dependency on themselves and be considered an error.
6961
6962 FIXTURES_SETUP
6963 New in version 3.7.
6964
6965
6966 Specifies a list of fixtures for which the test is to be treated as a
6967 setup test. These fixture names are distinct from test case names and
6968 are not required to have any similarity to the names of tests associ‐
6969 ated with them.
6970
6971 Fixture setup tests are ordinary tests with all of the usual test func‐
6972 tionality. Setting the FIXTURES_SETUP property for a test has two pri‐
6973 mary effects:
6974
6975 · CTest will ensure the test executes before any other test which lists
6976 the fixture name(s) in its FIXTURES_REQUIRED property.
6977
6978 · If CTest is asked to run only a subset of tests (e.g. using regular
6979 expressions or the --rerun-failed option) and the setup test is not
6980 in the set of tests to run, it will automatically be added if any
6981 tests in the set require any fixture listed in FIXTURES_SETUP.
6982
6983 A setup test can have multiple fixtures listed in its FIXTURES_SETUP
6984 property. It will execute only once for the whole CTest run, not once
6985 for each fixture. A fixture can also have more than one setup test
6986 defined. If there are multiple setup tests for a fixture, projects can
6987 control their order with the usual DEPENDS test property if necessary.
6988
6989 A setup test is allowed to require other fixtures, but not any fixture
6990 listed in its FIXTURES_SETUP property. For example:
6991
6992 # Ok: dependent fixture is different to setup
6993 set_tests_properties(setupFoo PROPERTIES
6994 FIXTURES_SETUP Foo
6995 FIXTURES_REQUIRED Bar
6996 )
6997
6998 # Error: cannot require same fixture as setup
6999 set_tests_properties(setupFoo PROPERTIES
7000 FIXTURES_SETUP Foo
7001 FIXTURES_REQUIRED Foo
7002 )
7003
7004 If any of a fixture’s setup tests fail, none of the tests listing that
7005 fixture in its FIXTURES_REQUIRED property will be run. Cleanup tests
7006 will, however, still be executed.
7007
7008 See FIXTURES_REQUIRED for a more complete discussion of how to use test
7009 fixtures.
7010
7011 LABELS
7012 Specify a list of text labels associated with a test.
7013
7014 The list is reported in dashboard submissions.
7015
7016 MEASUREMENT
7017 Specify a CDASH measurement and value to be reported for a test.
7018
7019 If set to a name then that name will be reported to CDASH as a named
7020 measurement with a value of 1. You may also specify a value by setting
7021 MEASUREMENT to measurement=value.
7022
7023 PASS_REGULAR_EXPRESSION
7024 The output must match this regular expression for the test to pass.
7025
7026 If set, the test output will be checked against the specified regular
7027 expressions and at least one of the regular expressions has to match,
7028 otherwise the test will fail. Example:
7029
7030 set_tests_properties(mytest PROPERTIES
7031 PASS_REGULAR_EXPRESSION "TestPassed;All ok"
7032 )
7033
7034 PASS_REGULAR_EXPRESSION expects a list of regular expressions.
7035
7036 PROCESSOR_AFFINITY
7037 New in version 3.12.
7038
7039
7040 Set to a true value to ask CTest to launch the test process with CPU
7041 affinity for a fixed set of processors. If enabled and supported for
7042 the current platform, CTest will choose a set of processors to place in
7043 the CPU affinity mask when launching the test process. The number of
7044 processors in the set is determined by the PROCESSORS test property or
7045 the number of processors available to CTest, whichever is smaller. The
7046 set of processors chosen will be disjoint from the processors assigned
7047 to other concurrently running tests that also have the PROCESSOR_AFFIN‐
7048 ITY property enabled.
7049
7050 PROCESSORS
7051 Set to specify how many process slots this test requires. If not set,
7052 the default is 1 processor.
7053
7054 Denotes the number of processors that this test will require. This is
7055 typically used for MPI tests, and should be used in conjunction with
7056 the ctest_test() PARALLEL_LEVEL option.
7057
7058 This will also be used to display a weighted test timing result in
7059 label and subproject summaries in the command line output of ctest(1).
7060 The wall clock time for the test run will be multiplied by this prop‐
7061 erty to give a better idea of how much cpu resource CTest allocated for
7062 the test.
7063
7064 See also the PROCESSOR_AFFINITY test property.
7065
7066 REQUIRED_FILES
7067 List of files required to run the test. The filenames are relative to
7068 the test WORKING_DIRECTORY unless an absolute path is specified.
7069
7070 If set to a list of files, the test will not be run unless all of the
7071 files exist.
7072
7073 Examples
7074 Suppose that test.txt is created by test baseTest and none.txt does not
7075 exist:
7076
7077 add_test(NAME baseTest ...) # Assumed to create test.txt
7078 add_test(NAME fileTest ...)
7079
7080 # The following ensures that if baseTest is successful, test.txt will
7081 # have been created before fileTest is run
7082 set_tests_properties(fileTest PROPERTIES
7083 DEPENDS baseTest
7084 REQUIRED_FILES test.txt
7085 )
7086
7087 add_test(NAME notRunTest ...)
7088
7089 # The following makes notRunTest depend on two files. Nothing creates
7090 # the none.txt file, so notRunTest will fail with status "Not Run".
7091 set_tests_properties(notRunTest PROPERTIES
7092 REQUIRED_FILES "test.txt;none.txt"
7093 )
7094
7095 The above example demonstrates how REQUIRED_FILES works, but it is not
7096 the most robust way to implement test ordering with failure detection.
7097 For that, test fixtures are a better alternative (see FIX‐
7098 TURES_REQUIRED).
7099
7100 RESOURCE_GROUPS
7101 New in version 3.16.
7102
7103
7104 Specify resources required by a test, grouped in a way that is meaning‐
7105 ful to the test. See resource allocation for more information on how
7106 this property integrates into the CTest resource allocation feature.
7107
7108 The RESOURCE_GROUPS property is a semicolon-separated list of group
7109 descriptions. Each entry consists of an optional number of groups using
7110 the description followed by a series of resource requirements for those
7111 groups. These requirements (and the number of groups) are separated by
7112 commas. The resource requirements consist of the name of a resource
7113 type, followed by a colon, followed by an unsigned integer specifying
7114 the number of slots required on one resource of the given type.
7115
7116 The RESOURCE_GROUPS property tells CTest what resources a test expects
7117 to use grouped in a way meaningful to the test. The test itself must
7118 read the environment variables to determine which resources have been
7119 allocated to each group. For example, each group may correspond to a
7120 process the test will spawn when executed.
7121
7122 Consider the following example:
7123
7124 add_test(NAME MyTest COMMAND MyExe)
7125 set_property(TEST MyTest PROPERTY RESOURCE_GROUPS
7126 "2,gpus:2"
7127 "gpus:4,crypto_chips:2")
7128
7129 In this example, there are two group descriptions (implicitly separated
7130 by a semicolon.) The content of the first description is 2,gpus:2. This
7131 description specifies 2 groups, each of which requires 2 slots from a
7132 single GPU. The content of the second description is
7133 gpus:4,crypto_chips:2. This description does not specify a group count,
7134 so a default of 1 is assumed. This single group requires 4 slots from
7135 a single GPU and 2 slots from a single cryptography chip. In total, 3
7136 resource groups are specified for this test, each with its own unique
7137 requirements.
7138
7139 Note that the number of slots following the resource type specifies
7140 slots from a single instance of the resource. If the resource group can
7141 tolerate receiving slots from different instances of the same resource,
7142 it can indicate this by splitting the specification into multiple
7143 requirements of one slot. For example:
7144
7145 add_test(NAME MyTest COMMAND MyExe)
7146 set_property(TEST MyTest PROPERTY RESOURCE_GROUPS
7147 "gpus:1,gpus:1,gpus:1,gpus:1")
7148
7149 In this case, the single resource group indicates that it needs four
7150 GPU slots, all of which may come from separate GPUs (though they don’t
7151 have to; CTest may still assign slots from the same GPU.)
7152
7153 When CTest sets the environment variables for a test, it assigns a
7154 group number based on the group description, starting at 0 on the left
7155 and the number of groups minus 1 on the right. For example, in the
7156 example above, the two groups in the first description would have IDs
7157 of 0 and 1, and the single group in the second description would have
7158 an ID of 2.
7159
7160 Both the RESOURCE_GROUPS and RESOURCE_LOCK properties serve similar
7161 purposes, but they are distinct and orthogonal. Resources specified by
7162 RESOURCE_GROUPS do not affect RESOURCE_LOCK, and vice versa. Whereas
7163 RESOURCE_LOCK is a simpler property that is used for locking one global
7164 resource, RESOURCE_GROUPS is a more advanced property that allows mul‐
7165 tiple tests to simultaneously use multiple resources of the same type,
7166 specifying their requirements in a fine-grained manner.
7167
7168 RESOURCE_LOCK
7169 Specify a list of resources that are locked by this test.
7170
7171 If multiple tests specify the same resource lock, they are guaranteed
7172 not to run concurrently.
7173
7174 See also FIXTURES_REQUIRED if the resource requires any setup or
7175 cleanup steps.
7176
7177 Both the RESOURCE_GROUPS and RESOURCE_LOCK properties serve similar
7178 purposes, but they are distinct and orthogonal. Resources specified by
7179 RESOURCE_GROUPS do not affect RESOURCE_LOCK, and vice versa. Whereas
7180 RESOURCE_LOCK is a simpler property that is used for locking one global
7181 resource, RESOURCE_GROUPS is a more advanced property that allows mul‐
7182 tiple tests to simultaneously use multiple resources of the same type,
7183 specifying their requirements in a fine-grained manner.
7184
7185 RUN_SERIAL
7186 Do not run this test in parallel with any other test.
7187
7188 Use this option in conjunction with the ctest_test PARALLEL_LEVEL
7189 option to specify that this test should not be run in parallel with any
7190 other tests.
7191
7192 SKIP_REGULAR_EXPRESSION
7193 New in version 3.16.
7194
7195
7196 If the output matches this regular expression the test will be marked
7197 as skipped.
7198
7199 If set, if the output matches one of specified regular expressions, the
7200 test will be marked as skipped. Example:
7201
7202 set_property(TEST mytest PROPERTY
7203 SKIP_REGULAR_EXPRESSION "[^a-z]Skip" "SKIP" "Skipped"
7204 )
7205
7206 SKIP_REGULAR_EXPRESSION expects a list of regular expressions.
7207
7208 See also the SKIP_RETURN_CODE property.
7209
7210 SKIP_RETURN_CODE
7211 Return code to mark a test as skipped.
7212
7213 Sometimes only a test itself can determine if all requirements for the
7214 test are met. If such a situation should not be considered a hard fail‐
7215 ure a return code of the process can be specified that will mark the
7216 test as Not Run if it is encountered. Valid values are in the range of
7217 0 to 255, inclusive.
7218
7219 See also the SKIP_REGULAR_EXPRESSION property.
7220
7221 TIMEOUT
7222 How many seconds to allow for this test.
7223
7224 This property if set will limit a test to not take more than the speci‐
7225 fied number of seconds to run. If it exceeds that the test process
7226 will be killed and ctest will move to the next test. This setting
7227 takes precedence over CTEST_TEST_TIMEOUT.
7228
7229 TIMEOUT_AFTER_MATCH
7230 New in version 3.6.
7231
7232
7233 Change a test’s timeout duration after a matching line is encountered
7234 in its output.
7235
7236 Usage
7237 add_test(mytest ...)
7238 set_property(TEST mytest PROPERTY TIMEOUT_AFTER_MATCH "${seconds}" "${regex}")
7239
7240 Description
7241 Allow a test seconds to complete after regex is encountered in its out‐
7242 put.
7243
7244 When the test outputs a line that matches regex its start time is reset
7245 to the current time and its timeout duration is changed to seconds.
7246 Prior to this, the timeout duration is determined by the TIMEOUT prop‐
7247 erty or the CTEST_TEST_TIMEOUT variable if either of these are set.
7248 Because the test’s start time is reset, its execution time will not
7249 include any time that was spent waiting for the matching output.
7250
7251 TIMEOUT_AFTER_MATCH is useful for avoiding spurious timeouts when your
7252 test must wait for some system resource to become available before it
7253 can execute. Set TIMEOUT to a longer duration that accounts for
7254 resource acquisition and use TIMEOUT_AFTER_MATCH to control how long
7255 the actual test is allowed to run.
7256
7257 If the required resource can be controlled by CTest you should use
7258 RESOURCE_LOCK instead of TIMEOUT_AFTER_MATCH. This property should be
7259 used when only the test itself can determine when its required
7260 resources are available.
7261
7262 WILL_FAIL
7263 If set to true, this will invert the pass/fail flag of the test.
7264
7265 This property can be used for tests that are expected to fail and
7266 return a non zero return code.
7267
7268 WORKING_DIRECTORY
7269 The directory from which the test executable will be called.
7270
7271 If this is not set, the test will be run with the working directory set
7272 to the binary directory associated with where the test was created
7273 (i.e. the CMAKE_CURRENT_BINARY_DIR for where add_test() was called).
7274
7276 ABSTRACT
7277 Is this source file an abstract class.
7278
7279 A property on a source file that indicates if the source file repre‐
7280 sents a class that is abstract. This only makes sense for languages
7281 that have a notion of an abstract class and it is only used by some
7282 tools that wrap classes into other languages.
7283
7284 AUTORCC_OPTIONS
7285 Additional options for rcc when using AUTORCC
7286
7287 This property holds additional command line options which will be used
7288 when rcc is executed during the build via AUTORCC, i.e. it is equiva‐
7289 lent to the optional OPTIONS argument of the qt4_add_resources() macro.
7290
7291 By default it is empty.
7292
7293 The options set on the .qrc source file may override AUTORCC_OPTIONS
7294 set on the target.
7295
7296 EXAMPLE
7297 # ...
7298 set_property(SOURCE resources.qrc PROPERTY AUTORCC_OPTIONS "--compress;9")
7299 # ...
7300
7301 AUTOUIC_OPTIONS
7302 Additional options for uic when using AUTOUIC
7303
7304 This property holds additional command line options which will be used
7305 when uic is executed during the build via AUTOUIC, i.e. it is equiva‐
7306 lent to the optional OPTIONS argument of the qt4_wrap_ui() macro.
7307
7308 By default it is empty.
7309
7310 The options set on the .ui source file may override AUTOUIC_OPTIONS set
7311 on the target.
7312
7313 EXAMPLE
7314 # ...
7315 set_property(SOURCE widget.ui PROPERTY AUTOUIC_OPTIONS "--no-protection")
7316 # ...
7317
7318 COMPILE_DEFINITIONS
7319 Preprocessor definitions for compiling a source file.
7320
7321 The COMPILE_DEFINITIONS property may be set to a semicolon-separated
7322 list of preprocessor definitions using the syntax VAR or VAR=value.
7323 Function-style definitions are not supported. CMake will automatically
7324 escape the value correctly for the native build system (note that CMake
7325 language syntax may require escapes to specify some values). This
7326 property may be set on a per-configuration basis using the name COM‐
7327 PILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case name (ex.
7328 COMPILE_DEFINITIONS_DEBUG).
7329
7330 CMake will automatically drop some definitions that are not supported
7331 by the native build tool. Xcode does not support per-configuration
7332 definitions on source files.
7333
7334 Disclaimer: Most native build tools have poor support for escaping cer‐
7335 tain values. CMake has work-arounds for many cases but some values may
7336 just not be possible to pass correctly. If a value does not seem to be
7337 escaped correctly, do not attempt to work-around the problem by adding
7338 escape sequences to the value. Your work-around may break in a future
7339 version of CMake that has improved escape support. Instead consider
7340 defining the macro in a (configured) header file. Then report the lim‐
7341 itation. Known limitations include:
7342
7343 # - broken almost everywhere
7344 ; - broken in VS IDE 7.0 and Borland Makefiles
7345 , - broken in VS IDE
7346 % - broken in some cases in NMake
7347 & | - broken in some cases on MinGW
7348 ^ < > \" - broken in most Make tools on Windows
7349
7350 CMake does not reject these values outright because they do work in
7351 some cases. Use with caution.
7352
7353 Contents of COMPILE_DEFINITIONS may use cmake-generator-expressions(7)
7354 with the syntax $<...>. See the cmake-generator-expressions(7) manual
7355 for available expressions. However, Xcode does not support per-config
7356 per-source settings, so expressions that depend on the build configura‐
7357 tion are not allowed with that generator.
7358
7359 Generator expressions should be preferred instead of setting the alter‐
7360 native per-configuration property.
7361
7362 COMPILE_FLAGS
7363 Additional flags to be added when compiling this source file.
7364
7365 The COMPILE_FLAGS property, managed as a string, sets additional com‐
7366 piler flags used to build source files. Use COMPILE_DEFINITIONS to
7367 pass additional preprocessor definitions.
7368
7369 Contents of COMPILE_FLAGS may use “generator expressions” with the syn‐
7370 tax $<...>. See the cmake-generator-expressions(7) manual for avail‐
7371 able expressions. However, Xcode does not support per-config
7372 per-source settings, so expressions that depend on the build configura‐
7373 tion are not allowed with that generator.
7374
7375 NOTE:
7376 This property has been superseded by the COMPILE_OPTIONS property.
7377
7378 COMPILE_OPTIONS
7379 New in version 3.11.
7380
7381
7382 List of additional options to pass to the compiler.
7383
7384 This property holds a semicolon-separated list of options and will be
7385 added to the list of compile flags when this source file builds.
7386
7387 Contents of COMPILE_OPTIONS may use “generator expressions” with the
7388 syntax $<...>. See the cmake-generator-expressions(7) manual for
7389 available expressions. However, Xcode does not support per-config
7390 per-source settings, so expressions that depend on the build configura‐
7391 tion are not allowed with that generator.
7392
7393 Usage example:
7394
7395 set_source_files_properties(foo.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
7396
7397 Related properties:
7398
7399 · Prefer this property over COMPILE_FLAGS.
7400
7401 · Use COMPILE_DEFINITIONS to pass additional preprocessor definitions.
7402
7403 · Use INCLUDE_DIRECTORIES to pass additional include directories.
7404
7405 Related commands:
7406
7407 · add_compile_options() for directory-wide settings
7408
7409 · target_compile_options() for target-specific settings
7410
7411 EXTERNAL_OBJECT
7412 If set to true then this is an object file.
7413
7414 If this property is set to True then the source file is really an
7415 object file and should not be compiled. It will still be linked into
7416 the target though.
7417
7418 Fortran_FORMAT
7419 Set to FIXED or FREE to indicate the Fortran source layout.
7420
7421 This property tells CMake whether a given Fortran source file uses
7422 fixed-format or free-format. CMake will pass the corresponding format
7423 flag to the compiler. Consider using the target-wide Fortran_FORMAT
7424 property if all source files in a target share the same format.
7425
7426 NOTE:
7427 For some compilers, NAG, PGI and Solaris Studio, setting this to OFF
7428 will have no effect.
7429
7430 Fortran_PREPROCESS
7431 New in version 3.18.
7432
7433
7434 Control whether the Fortran source file should be unconditionally pre‐
7435 processed.
7436
7437 If unset or empty, rely on the compiler to determine whether the file
7438 should be preprocessed. If explicitly set to OFF then the file does not
7439 need to be preprocessed. If explicitly set to ON, then the file does
7440 need to be preprocessed as part of the compilation step.
7441
7442 When using the Ninja generator, all source files are first preprocessed
7443 in order to generate module dependency information. Setting this prop‐
7444 erty to OFF will make Ninja skip this step.
7445
7446 Consider using the target-wide Fortran_PREPROCESS property if all
7447 source files in a target need to be preprocessed.
7448
7449 GENERATED
7450 Is this source file generated as part of the build or CMake process.
7451
7452 Tells the internal CMake engine that a source file is generated by an
7453 outside process such as another build step, or the execution of CMake
7454 itself. This information is then used to exempt the file from any
7455 existence or validity checks.
7456
7457 Any file that is
7458
7459 · created by the execution of commands such as add_custom_command() and
7460 file(GENERATE)
7461
7462 · listed as one of the BYPRODUCTS of an add_custom_command() or
7463 add_custom_target() command, or
7464
7465 · created by a CMake AUTOGEN operation such as AUTOMOC, AUTORCC, or
7466 AUTOUIC
7467
7468 will be marked with the GENERATED property.
7469
7470 When a generated file created as the OUTPUT of an add_custom_command()
7471 command is explicitly listed as a source file for any target in the
7472 same directory scope (which usually means the same CMakeLists.txt
7473 file), CMake will automatically create a dependency to make sure the
7474 file is generated before building that target.
7475
7476 The Makefile Generators will remove GENERATED files during make clean.
7477
7478 Generated sources may be hidden in some IDE tools, while in others they
7479 might be shown. For the special case of sources generated by CMake’s
7480 AUTOMOC or AUTORCC functionality, the AUTOGEN_SOURCE_GROUP, AUTO‐
7481 MOC_SOURCE_GROUP and AUTORCC_SOURCE_GROUP target properties may influ‐
7482 ence where the generated sources are grouped in the project’s file
7483 lists.
7484
7485 HEADER_FILE_ONLY
7486 Is this source file only a header file.
7487
7488 A property on a source file that indicates if the source file is a
7489 header file with no associated implementation. This is set automati‐
7490 cally based on the file extension and is used by CMake to determine if
7491 certain dependency information should be computed.
7492
7493 By setting this property to ON, you can disable compilation of the
7494 given source file, even if it should be compiled because it is part of
7495 the library’s/executable’s sources.
7496
7497 This is useful if you have some source files which you somehow
7498 pre-process, and then add these pre-processed sources via add_library()
7499 or add_executable(). Normally, in IDE, there would be no reference of
7500 the original sources, only of these pre-processed sources. So by set‐
7501 ting this property for all the original source files to ON, and then
7502 either calling add_library() or add_executable() while passing both the
7503 pre-processed sources and the original sources, or by using tar‐
7504 get_sources() to add original source files will do exactly what would
7505 one expect, i.e. the original source files would be visible in IDE,
7506 and will not be built.
7507
7508 INCLUDE_DIRECTORIES
7509 New in version 3.11.
7510
7511
7512 List of preprocessor include file search directories.
7513
7514 This property holds a semicolon-separated list of paths and will be
7515 added to the list of include directories when this source file builds.
7516 These directories will take precedence over directories defined at tar‐
7517 get level except for Xcode generator due to technical limitations.
7518
7519 Relative paths should not be added to this property directly.
7520
7521 Contents of INCLUDE_DIRECTORIES may use “generator expressions” with
7522 the syntax $<...>. See the cmake-generator-expressions(7) manual for
7523 available expressions. However, Xcode does not support per-config
7524 per-source settings, so expressions that depend on the build configura‐
7525 tion are not allowed with that generator.
7526
7527 KEEP_EXTENSION
7528 Make the output file have the same extension as the source file.
7529
7530 If this property is set then the file extension of the output file will
7531 be the same as that of the source file. Normally the output file
7532 extension is computed based on the language of the source file, for
7533 example .cxx will go to a .o extension.
7534
7535 LABELS
7536 Specify a list of text labels associated with a source file.
7537
7538 This property has meaning only when the source file is listed in a tar‐
7539 get whose LABELS property is also set. No other semantics are cur‐
7540 rently specified.
7541
7542 LANGUAGE
7543 What programming language is the file.
7544
7545 A property that can be set to indicate what programming language the
7546 source file is. If it is not set the language is determined based on
7547 the file extension. Typical values are CXX (i.e. C++), C, CSharp,
7548 CUDA, Fortran, ISPC, and ASM. Setting this property for a file means
7549 this file will be compiled. Do not set this for headers or files that
7550 should not be compiled.
7551
7552 LOCATION
7553 The full path to a source file.
7554
7555 A read only property on a SOURCE FILE that contains the full path to
7556 the source file.
7557
7558 MACOSX_PACKAGE_LOCATION
7559 Place a source file inside a Application Bundle (MACOSX_BUNDLE), Core
7560 Foundation Bundle (BUNDLE), or Framework Bundle (FRAMEWORK). It is
7561 applicable for macOS and iOS.
7562
7563 Executable targets with the MACOSX_BUNDLE property set are built as
7564 macOS or iOS application bundles on Apple platforms. Shared library
7565 targets with the FRAMEWORK property set are built as macOS or iOS
7566 frameworks on Apple platforms. Module library targets with the BUNDLE
7567 property set are built as macOS CFBundle bundles on Apple platforms.
7568 Source files listed in the target with this property set will be copied
7569 to a directory inside the bundle or framework content folder specified
7570 by the property value. For macOS Application Bundles the content
7571 folder is <name>.app/Contents. For macOS Frameworks the content folder
7572 is <name>.framework/Versions/<version>. For macOS CFBundles the con‐
7573 tent folder is <name>.bundle/Contents (unless the extension is
7574 changed). See the PUBLIC_HEADER, PRIVATE_HEADER, and RESOURCE target
7575 properties for specifying files meant for Headers, PrivateHeaders, or
7576 Resources directories.
7577
7578 If the specified location is equal to Resources, the resulting location
7579 will be the same as if the RESOURCE property had been used. If the
7580 specified location is a sub-folder of Resources, it will be placed into
7581 the respective sub-folder. Note: For iOS Apple uses a flat bundle lay‐
7582 out where no Resources folder exist. Therefore CMake strips the
7583 Resources folder name from the specified location.
7584
7585 OBJECT_DEPENDS
7586 Additional files on which a compiled object file depends.
7587
7588 Specifies a semicolon-separated list of full-paths to files on which
7589 any object files compiled from this source file depend. On Makefile
7590 Generators and the Ninja generator an object file will be recompiled if
7591 any of the named files is newer than it. Visual Studio Generators and
7592 the Xcode generator cannot implement such compilation dependencies.
7593
7594 This property need not be used to specify the dependency of a source
7595 file on a generated header file that it includes. Although the prop‐
7596 erty was originally introduced for this purpose, it is no longer neces‐
7597 sary. If the generated header file is created by a custom command in
7598 the same target as the source file, the automatic dependency scanning
7599 process will recognize the dependency. If the generated header file is
7600 created by another target, an inter-target dependency should be created
7601 with the add_dependencies() command (if one does not already exist due
7602 to linking relationships).
7603
7604 OBJECT_OUTPUTS
7605 Additional outputs for a Ninja or Makefile Generators rule.
7606
7607 Additional outputs created by compilation of this source file. If any
7608 of these outputs is missing the object will be recompiled. This is
7609 supported only on the Ninja and Makefile Generators and will be ignored
7610 on other generators.
7611
7612 This property supports generator expressions.
7613
7614 SKIP_AUTOGEN
7615 New in version 3.8.
7616
7617
7618 Exclude the source file from AUTOMOC, AUTOUIC and AUTORCC processing
7619 (for Qt projects).
7620
7621 For finer exclusion control see SKIP_AUTOMOC, SKIP_AUTOUIC and
7622 SKIP_AUTORCC.
7623
7624 EXAMPLE
7625 # ...
7626 set_property(SOURCE file.h PROPERTY SKIP_AUTOGEN ON)
7627 # ...
7628
7629 SKIP_AUTOMOC
7630 New in version 3.8.
7631
7632
7633 Exclude the source file from AUTOMOC processing (for Qt projects).
7634
7635 For broader exclusion control see SKIP_AUTOGEN.
7636
7637 EXAMPLE
7638 # ...
7639 set_property(SOURCE file.h PROPERTY SKIP_AUTOMOC ON)
7640 # ...
7641
7642 SKIP_AUTORCC
7643 New in version 3.8.
7644
7645
7646 Exclude the source file from AUTORCC processing (for Qt projects).
7647
7648 For broader exclusion control see SKIP_AUTOGEN.
7649
7650 EXAMPLE
7651 # ...
7652 set_property(SOURCE file.qrc PROPERTY SKIP_AUTORCC ON)
7653 # ...
7654
7655 SKIP_AUTOUIC
7656 New in version 3.8.
7657
7658
7659 Exclude the source file from AUTOUIC processing (for Qt projects).
7660
7661 SKIP_AUTOUIC can be set on C++ header and source files and on .ui
7662 files.
7663
7664 For broader exclusion control see SKIP_AUTOGEN.
7665
7666 EXAMPLE
7667 # ...
7668 set_property(SOURCE file.h PROPERTY SKIP_AUTOUIC ON)
7669 set_property(SOURCE file.cpp PROPERTY SKIP_AUTOUIC ON)
7670 set_property(SOURCE widget.ui PROPERTY SKIP_AUTOUIC ON)
7671 # ...
7672
7673 SKIP_PRECOMPILE_HEADERS
7674 New in version 3.16.
7675
7676
7677 Is this source file skipped by PRECOMPILE_HEADERS feature.
7678
7679 This property helps with build problems that one would run into when
7680 using the PRECOMPILE_HEADERS feature.
7681
7682 One example would be the usage of Objective-C (*.m) files, and Objec‐
7683 tive-C++ (*.mm) files, which lead to compilation failure because they
7684 are treated (in case of Ninja / Makefile generator) as C, and CXX
7685 respectively. The precompile headers are not compatible between lan‐
7686 guages.
7687
7688 SKIP_UNITY_BUILD_INCLUSION
7689 New in version 3.16.
7690
7691
7692 Setting this property to true ensures the source file will be skipped
7693 by unity builds when its associated target has its UNITY_BUILD property
7694 set to true. The source file will instead be compiled on its own in
7695 the same way as it would with unity builds disabled.
7696
7697 This property helps with “ODR (One definition rule)” problems where
7698 combining a particular source file with others might lead to build
7699 errors or other unintended side effects.
7700
7701 Swift_DEPENDENCIES_FILE
7702 New in version 3.15.
7703
7704
7705 This property sets the path for the Swift dependency file (swiftdeps)
7706 for the source. If one is not specified, it will default to
7707 <OBJECT>.swiftdeps.
7708
7709 Swift_DIAGNOSTICS_FILE
7710 New in version 3.15.
7711
7712
7713 This property controls where the Swift diagnostics are serialized.
7714
7715 SYMBOLIC
7716 Is this just a name for a rule.
7717
7718 If SYMBOLIC (boolean) is set to True the build system will be informed
7719 that the source file is not actually created on disk but instead used
7720 as a symbolic name for a build rule.
7721
7722 UNITY_GROUP
7723 New in version 3.18.
7724
7725
7726 This property controls which bucket the source will be part of when the
7727 UNITY_BUILD_MODE is set to GROUP.
7728
7729 VS_COPY_TO_OUT_DIR
7730 New in version 3.8.
7731
7732
7733 Sets the <CopyToOutputDirectory> tag for a source file in a Visual Stu‐
7734 dio project file. Valid values are Never, Always and PreserveNewest.
7735
7736 VS_CSHARP_<tagname>
7737 New in version 3.8.
7738
7739
7740 Visual Studio and CSharp source-file-specific configuration.
7741
7742 Tell the Visual Studio generators to set the source file tag <tagname>
7743 to a given value in the generated Visual Studio CSharp project. Ignored
7744 on other generators and languages. This property can be used to define
7745 dependencies between source files or set any other Visual Studio spe‐
7746 cific parameters.
7747
7748 Example usage:
7749
7750 set_source_files_property(<filename>
7751 PROPERTIES
7752 VS_CSHARP_DependentUpon <other file>
7753 VS_CSHARP_SubType "Form")
7754
7755 VS_DEPLOYMENT_CONTENT
7756 New in version 3.1.
7757
7758
7759 Mark a source file as content for deployment with a Windows Phone or
7760 Windows Store application when built with a Visual Studio generators.
7761 The value must evaluate to either 1 or 0 and may use generator expres‐
7762 sions to make the choice based on the build configuration. The .vcx‐
7763 proj file entry for the source file will be marked either Deployment‐
7764 Content or ExcludedFromBuild for values 1 and 0, respectively.
7765
7766 VS_DEPLOYMENT_LOCATION
7767 New in version 3.1.
7768
7769
7770 Specifies the deployment location for a content source file with a Win‐
7771 dows Phone or Windows Store application when built with a Visual Studio
7772 generators. This property is only applicable when using VS_DEPLOY‐
7773 MENT_CONTENT. The value represent the path relative to the app package
7774 and applies to all configurations.
7775
7776 VS_INCLUDE_IN_VSIX
7777 New in version 3.8.
7778
7779
7780 Boolean property to specify if the file should be included within a
7781 VSIX (Visual Studio Integration Extension) extension package. This is
7782 needed for development of Visual Studio extensions.
7783
7784 VS_RESOURCE_GENERATOR
7785 New in version 3.8.
7786
7787
7788 This property allows to specify the resource generator to be used on
7789 this file. It defaults to PublicResXFileCodeGenerator if not set.
7790
7791 This property only applies to C# projects.
7792
7793 VS_SETTINGS
7794 New in version 3.18.
7795
7796
7797 Set any item metadata on a non-built file.
7798
7799 Takes a list of Key=Value pairs. Tells the Visual Studio generator to
7800 set Key to Value as item metadata on the file.
7801
7802 For example:
7803
7804 set_property(SOURCE file.hlsl PROPERTY VS_SETTINGS "Key=Value" "Key2=Value2")
7805
7806 will set Key to Value and Key2 to Value2 on the file.hlsl item as meta‐
7807 data.
7808
7809 Generator expressions are supported.
7810
7811 VS_SHADER_DISABLE_OPTIMIZATIONS
7812 New in version 3.11.
7813
7814
7815 Disable compiler optimizations for an .hlsl source file. This adds the
7816 -Od flag to the command line for the FxCompiler tool. Specify the
7817 value true for this property to disable compiler optimizations.
7818
7819 VS_SHADER_ENABLE_DEBUG
7820 New in version 3.11.
7821
7822
7823 Enable debugging information for an .hlsl source file. This adds the
7824 -Zi flag to the command line for the FxCompiler tool. Specify the
7825 value true to generate debugging information for the compiled shader.
7826
7827 VS_SHADER_ENTRYPOINT
7828 New in version 3.1.
7829
7830
7831 Specifies the name of the entry point for the shader of a .hlsl source
7832 file.
7833
7834 VS_SHADER_FLAGS
7835 New in version 3.2.
7836
7837
7838 Set additional Visual Studio shader flags of a .hlsl source file.
7839
7840 VS_SHADER_MODEL
7841 New in version 3.1.
7842
7843
7844 Specifies the shader model of a .hlsl source file. Some shader types
7845 can only be used with recent shader models
7846
7847 VS_SHADER_OBJECT_FILE_NAME
7848 New in version 3.12.
7849
7850
7851 Specifies a file name for the compiled shader object file for an .hlsl
7852 source file. This adds the -Fo flag to the command line for the FxCom‐
7853 piler tool.
7854
7855 VS_SHADER_OUTPUT_HEADER_FILE
7856 New in version 3.10.
7857
7858
7859 Set filename for output header file containing object code of a .hlsl
7860 source file.
7861
7862 VS_SHADER_TYPE
7863 New in version 3.1.
7864
7865
7866 Set the Visual Studio shader type of a .hlsl source file.
7867
7868 VS_SHADER_VARIABLE_NAME
7869 New in version 3.10.
7870
7871
7872 Set name of variable in header file containing object code of a .hlsl
7873 source file.
7874
7875 VS_TOOL_OVERRIDE
7876 New in version 3.7.
7877
7878
7879 Override the default Visual Studio tool that will be applied to the
7880 source file with a new tool not based on the extension of the file.
7881
7882 VS_XAML_TYPE
7883 New in version 3.3.
7884
7885
7886 Mark a Extensible Application Markup Language (XAML) source file as a
7887 different type than the default Page. The most common usage would be
7888 to set the default App.xaml file as ApplicationDefinition.
7889
7890 WRAP_EXCLUDE
7891 Exclude this source file from any code wrapping techniques.
7892
7893 Some packages can wrap source files into alternate languages to provide
7894 additional functionality.
7895
7896 For example, C++ code can be wrapped into Java or Python, using SWIG.
7897 If WRAP_EXCLUDE is set to True, that indicates that this source file
7898 should not be wrapped.
7899
7900 XCODE_EXPLICIT_FILE_TYPE
7901 New in version 3.1.
7902
7903
7904 Set the Xcode explicitFileType attribute on its reference to a source
7905 file. CMake computes a default based on file extension but can be told
7906 explicitly with this property.
7907
7908 See also XCODE_LAST_KNOWN_FILE_TYPE.
7909
7910 XCODE_FILE_ATTRIBUTES
7911 New in version 3.7.
7912
7913
7914 Add values to the Xcode ATTRIBUTES setting on its reference to a source
7915 file. Among other things, this can be used to set the role on a .mig
7916 file:
7917
7918 set_source_files_properties(defs.mig
7919 PROPERTIES
7920 XCODE_FILE_ATTRIBUTES "Client;Server"
7921 )
7922
7923 XCODE_LAST_KNOWN_FILE_TYPE
7924 New in version 3.1.
7925
7926
7927 Set the Xcode lastKnownFileType attribute on its reference to a source
7928 file. CMake computes a default based on file extension but can be told
7929 explicitly with this property.
7930
7931 See also XCODE_EXPLICIT_FILE_TYPE, which is preferred over this prop‐
7932 erty if set.
7933
7935 ADVANCED
7936 True if entry should be hidden by default in GUIs.
7937
7938 This is a boolean value indicating whether the entry is considered
7939 interesting only for advanced configuration. The mark_as_advanced()
7940 command modifies this property.
7941
7942 HELPSTRING
7943 Help associated with entry in GUIs.
7944
7945 This string summarizes the purpose of an entry to help users set it
7946 through a CMake GUI.
7947
7948 MODIFIED
7949 Internal management property. Do not set or get.
7950
7951 This is an internal cache entry property managed by CMake to track
7952 interactive user modification of entries. Ignore it.
7953
7954 STRINGS
7955 Enumerate possible STRING entry values for GUI selection.
7956
7957 For cache entries with type STRING, this enumerates a set of values.
7958 CMake GUIs may use this to provide a selection widget instead of a
7959 generic string entry field. This is for convenience only. CMake does
7960 not enforce that the value matches one of those listed.
7961
7962 TYPE
7963 Widget type for entry in GUIs.
7964
7965 Cache entry values are always strings, but CMake GUIs present widgets
7966 to help users set values. The GUIs use this property as a hint to
7967 determine the widget type. Valid TYPE values are:
7968
7969 BOOL = Boolean ON/OFF value.
7970 PATH = Path to a directory.
7971 FILEPATH = Path to a file.
7972 STRING = Generic string value.
7973 INTERNAL = Do not present in GUI at all.
7974 STATIC = Value managed by CMake, do not change.
7975 UNINITIALIZED = Type not yet specified.
7976
7977 Generally the TYPE of a cache entry should be set by the command which
7978 creates it ( set(), option(), find_library(), etc.).
7979
7980 VALUE
7981 Value of a cache entry.
7982
7983 This property maps to the actual value of a cache entry. Setting this
7984 property always sets the value without checking, so use with care.
7985
7987 CPACK_DESKTOP_SHORTCUTS
7988 New in version 3.3.
7989
7990
7991 Species a list of shortcut names that should be created on the Desktop
7992 for this file.
7993
7994 The property is currently only supported by the CPack WIX Generator.
7995
7996 CPACK_NEVER_OVERWRITE
7997 New in version 3.1.
7998
7999
8000 Request that this file not be overwritten on install or reinstall.
8001
8002 The property is currently only supported by the CPack WIX Generator.
8003
8004 CPACK_PERMANENT
8005 New in version 3.1.
8006
8007
8008 Request that this file not be removed on uninstall.
8009
8010 The property is currently only supported by the CPack WIX Generator.
8011
8012 CPACK_START_MENU_SHORTCUTS
8013 New in version 3.3.
8014
8015
8016 Species a list of shortcut names that should be created in the Start
8017 Menu for this file.
8018
8019 The property is currently only supported by the CPack WIX Generator.
8020
8021 CPACK_STARTUP_SHORTCUTS
8022 New in version 3.3.
8023
8024
8025 Species a list of shortcut names that should be created in the Startup
8026 folder for this file.
8027
8028 The property is currently only supported by the CPack WIX Generator.
8029
8030 CPACK_WIX_ACL
8031 New in version 3.1.
8032
8033
8034 Specifies access permissions for files or directories installed by a
8035 WiX installer.
8036
8037 The property can contain multiple list entries, each of which has to
8038 match the following format.
8039
8040 <user>[@<domain>]=<permission>[,<permission>]
8041
8042 <user> and <domain> specify the windows user and domain for which the
8043 <Permission> element should be generated.
8044
8045 <permission> is any of the YesNoType attributes listed here:
8046
8047 http://wixtoolset.org/documentation/manual/v3/xsd/wix/permission.html
8048
8049 The property is currently only supported by the CPack WIX Generator.
8050
8052 ADDITIONAL_MAKE_CLEAN_FILES
8053 Deprecated since version 3.15: Use ADDITIONAL_CLEAN_FILES instead.
8054
8055
8056 Additional files to remove during the clean stage.
8057
8058 A ;-list of files that will be removed as a part of the make clean tar‐
8059 get.
8060
8061 Arguments to ADDITIONAL_MAKE_CLEAN_FILES may use generator expressions.
8062
8063 This property only works for the Makefile generators. It is ignored on
8064 other generators.
8065
8066 COMPILE_DEFINITIONS_<CONFIG>
8067 Ignored. See CMake Policy CMP0043.
8068
8069 Per-configuration preprocessor definitions in a directory.
8070
8071 This is the configuration-specific version of COMPILE_DEFINITIONS where
8072 <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).
8073
8074 This property will be initialized in each directory by its value in the
8075 directory’s parent.
8076
8077 Contents of COMPILE_DEFINITIONS_<CONFIG> may use “generator expres‐
8078 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
8079 manual for available expressions. See the cmake-buildsystem(7) manual
8080 for more on defining buildsystem properties.
8081
8082 Generator expressions should be preferred instead of setting this prop‐
8083 erty.
8084
8085 TEST_INCLUDE_FILE
8086 Deprecated. Use TEST_INCLUDE_FILES instead.
8087
8088 A cmake file that will be included when ctest is run.
8089
8090 If you specify TEST_INCLUDE_FILE, that file will be included and pro‐
8091 cessed when ctest is run on the directory.
8092
8094 COMPILE_DEFINITIONS_<CONFIG>
8095 Ignored. See CMake Policy CMP0043.
8096
8097 Per-configuration preprocessor definitions on a target.
8098
8099 This is the configuration-specific version of COMPILE_DEFINITIONS where
8100 <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).
8101
8102 Contents of COMPILE_DEFINITIONS_<CONFIG> may use “generator expres‐
8103 sions” with the syntax $<...>. See the cmake-generator-expressions(7)
8104 manual for available expressions. See the cmake-buildsystem(7) manual
8105 for more on defining buildsystem properties.
8106
8107 Generator expressions should be preferred instead of setting this prop‐
8108 erty.
8109
8110 POST_INSTALL_SCRIPT
8111 Deprecated install support.
8112
8113 The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old
8114 way to specify CMake scripts to run before and after installing a tar‐
8115 get. They are used only when the old INSTALL_TARGETS command is used
8116 to install the target. Use the install() command instead.
8117
8118 PRE_INSTALL_SCRIPT
8119 Deprecated install support.
8120
8121 The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old
8122 way to specify CMake scripts to run before and after installing a tar‐
8123 get. They are used only when the old INSTALL_TARGETS command is used
8124 to install the target. Use the install() command instead.
8125
8127 COMPILE_DEFINITIONS_<CONFIG>
8128 Ignored. See CMake Policy CMP0043.
8129
8130 Per-configuration preprocessor definitions on a source file.
8131
8132 This is the configuration-specific version of COMPILE_DEFINITIONS.
8133 Note that Xcode does not support per-configuration source file flags so
8134 this property will be ignored by the Xcode generator.
8135
8137 2000-2021 Kitware, Inc. and Contributors
8138
8139
8140
8141
81423.19.7 Mar 15, 2021 CMAKE-PROPERTIES(7)