cmake-properties man page

cmake-properties — CMake Properties Reference

Properties of Global Scope

Allow_duplicate_custom_targets

Allow duplicate custom targets to be created.

Normally CMake requires that all targets built in a project have globally unique logical names (see policy CMP0002). This is necessary to generate meaningful project file names in Xcode and VS IDE generators. It also allows the target names to be referenced unambiguously.

Makefile generators are capable of supporting duplicate custom target names. For projects that care only about Makefile generators and do not wish to support Xcode or VS IDE generators, one may set this property to true to allow duplicate custom targets. The property allows multiple add_custom_target command calls in different directories to specify the same target name. However, setting this property will cause non-Makefile generators to produce an error and refuse to generate the project.

Autogen_targets_folder

Name of Folder for *_automoc targets that are added automatically by CMake for targets for which Automoc is enabled.

If not set, CMake uses the Folder property of the parent target as a default value for this property. See also the documentation for the Folder target property and the Automoc target property.

Automoc_targets_folder

Name of Folder for *_automoc targets that are added automatically by CMake for targets for which Automoc is enabled.

This property is obsolete. Use Autogen_targets_folder instead.

If not set, CMake uses the Folder property of the parent target as a default value for this property. See also the documentation for the Folder target property and the Automoc target property.

Cmake_c_known_features

List of C features known to this version of CMake.

The features listed in this global property may be known to be available to the C compiler. If the feature is available with the C compiler, it will be listed in the CMAKE_C_COMPILE_FEATURES variable.

The features listed here may be used with the target_compile_features() command. See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

The features known to this version of CMake are:

c_function_prototypes
Function prototypes, as defined in ISO/IEC 9899:1990.
c_restrict
restrict keyword, as defined in ISO/IEC 9899:1999.
c_static_assert
Static assert, as defined in ISO/IEC 9899:2011.
c_variadic_macros
Variadic macros, as defined in ISO/IEC 9899:1999.

Cmake_cxx_known_features

List of C++ features known to this version of CMake.

The features listed in this global property may be known to be available to the C++ compiler. If the feature is available with the C++ compiler, it will be listed in the CMAKE_CXX_COMPILE_FEATURES variable.

The features listed here may be used with the target_compile_features() command. See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

The features known to this version of CMake are:

cxx_aggregate_default_initializers
Aggregate default initializers, as defined in N3605.
cxx_alias_templates
Template aliases, as defined in N2258.
cxx_alignas
Alignment control alignas, as defined in N2341.
cxx_alignof
Alignment control alignof, as defined in N2341.
cxx_attributes
Generic attributes, as defined in N2761.
cxx_attribute_deprecated
[[deprecated]] attribute, as defined in N3760.
cxx_auto_type
Automatic type deduction, as defined in N1984.
cxx_binary_literals
Binary literals, as defined in N3472.
cxx_constexpr
Constant expressions, as defined in N2235.
cxx_contextual_conversions
Contextual conversions, as defined in N3323.
cxx_decltype_incomplete_return_types
Decltype on incomplete return types, as defined in N3276.
cxx_decltype
Decltype, as defined in N2343.
cxx_decltype_auto
decltype(auto) semantics, as defined in N3638.
cxx_default_function_template_args
Default template arguments for function templates, as defined in DR226
cxx_defaulted_functions
Defaulted functions, as defined in N2346.
cxx_defaulted_move_initializers
Defaulted move initializers, as defined in N3053.
cxx_delegating_constructors
Delegating constructors, as defined in N1986.
cxx_deleted_functions
Deleted functions, as defined in N2346.
cxx_digit_separators
Digit separators, as defined in N3781.
cxx_enum_forward_declarations
Enum forward declarations, as defined in N2764.
cxx_explicit_conversions
Explicit conversion operators, as defined in N2437.
cxx_extended_friend_declarations
Extended friend declarations, as defined in N1791.
cxx_extern_templates
Extern templates, as defined in N1987.
cxx_final
Override control final keyword, as defined in N2928, N3206 and N3272.
cxx_func_identifier
Predefined __func__ identifier, as defined in N2340.
cxx_generalized_initializers
Initializer lists, as defined in N2672.
cxx_generic_lambdas
Generic lambdas, as defined in N3649.
cxx_inheriting_constructors
Inheriting constructors, as defined in N2540.
cxx_inline_namespaces
Inline namespaces, as defined in N2535.
cxx_lambdas
Lambda functions, as defined in N2927.
cxx_lambda_init_captures
Initialized lambda captures, as defined in N3648.
cxx_local_type_template_args
Local and unnamed types as template arguments, as defined in N2657.
cxx_long_long_type
long long type, as defined in N1811.
cxx_noexcept
Exception specifications, as defined in N3050.
cxx_nonstatic_member_init
Non-static data member initialization, as defined in N2756.
cxx_nullptr
Null pointer, as defined in N2431.
cxx_override
Override control override keyword, as defined in N2928, N3206 and N3272.
cxx_range_for
Range-based for, as defined in N2930.
cxx_raw_string_literals
Raw string literals, as defined in N2442.
cxx_reference_qualified_functions
Reference qualified functions, as defined in N2439.
cxx_relaxed_constexpr
Relaxed constexpr, as defined in N3652.
cxx_return_type_deduction
Return type deduction on normal functions, as defined in N3386.
cxx_right_angle_brackets
Right angle bracket parsing, as defined in N1757.
cxx_rvalue_references
R-value references, as defined in N2118.
cxx_sizeof_member
Size of non-static data members, as defined in N2253.
cxx_static_assert
Static assert, as defined in N1720.
cxx_strong_enums
Strongly typed enums, as defined in N2347.
cxx_thread_local
Thread-local variables, as defined in N2659.
cxx_trailing_return_types
Automatic function return type, as defined in N2541.
cxx_unicode_literals
Unicode string literals, as defined in N2442.
cxx_uniform_initialization
Uniform initialization, as defined in N2640.
cxx_unrestricted_unions
Unrestricted unions, as defined in N2544.
cxx_user_literals
User-defined literals, as defined in N2765.
cxx_variable_templates
Variable templates, as defined in N3651.
cxx_variadic_macros
Variadic macros, as defined in N1653.
cxx_variadic_templates
Variadic templates, as defined in N2242.
cxx_template_template_parameters
Template template parameters, as defined in ISO/IEC 14882:1998.

Debug_configurations

Specify which configurations are for debugging.

The value must be a semi-colon separated list of configuration names. Currently this property is used only by the target_link_libraries command (see its documentation for details). Additional uses may be defined in the future.

This property must be set at the top level of the project and before the first target_link_libraries command invocation. If any entry in the list does not match a valid configuration for the project the behavior is undefined.

Disabled_features

List of features which are disabled during the CMake run.

List of features which are disabled during the CMake run. By default it contains the names of all packages which were not found. This is determined using the <Name>_FOUND variables. Packages which are searched QUIET are not listed. A project can add its own features to this list. This property is used by the macros in FeatureSummary.cmake.

Enabled_features

List of features which are enabled during the CMake run.

List of features which are enabled during the CMake run. By default it contains the names of all packages which were found. This is determined using the <Name>_FOUND variables. Packages which are searched QUIET are not listed. A project can add its own features to this list. This property is used by the macros in FeatureSummary.cmake.

Enabled_languages

Read-only property that contains the list of currently enabled languages

Set to list of currently enabled languages.

Find_library_use_lib32_paths

Whether the find_library() command should automatically search lib32 directories.

Find_library_use_lib32_paths is a boolean specifying whether the find_library() command should automatically search the lib32 variant of directories called lib in the search path when building 32-bit binaries.

Find_library_use_lib64_paths

Whether find_library() should automatically search lib64 directories.

Find_library_use_lib64_paths is a boolean specifying whether the find_library() command should automatically search the lib64 variant of directories called lib in the search path when building 64-bit binaries.

Find_library_use_openbsd_versioning

Whether find_library() should find OpenBSD-style shared libraries.

This property is a boolean specifying whether the find_library() command should find shared libraries with OpenBSD-style versioned extension: ".so.<major>.<minor>". The property is set to true on OpenBSD and false on other platforms.

Global_depends_debug_mode

Enable global target dependency graph debug mode.

CMake automatically analyzes the global inter-target dependency graph at the beginning of native build system generation. This property causes it to display details of its analysis to stderr.

Global_depends_no_cycles

Disallow global target dependency graph cycles.

CMake automatically analyzes the global inter-target dependency graph at the beginning of native build system generation. It reports an error if the dependency graph contains a cycle that does not consist of all STATIC library targets. This property tells CMake to disallow all cycles completely, even among static libraries.

In_try_compile

Read-only property that is true during a try-compile configuration.

True when building a project inside a try_compile() or try_run() command.

Packages_found

List of packages which were found during the CMake run.

List of packages which were found during the CMake run. Whether a package has been found is determined using the <Name>_FOUND variables.

Packages_not_found

List of packages which were not found during the CMake run.

List of packages which were not found during the CMake run. Whether a package has been found is determined using the <Name>_FOUND variables.

Job_pools

Ninja only: List of available pools.

A pool is a named integer property and defines the maximum number of concurrent jobs which can be started by a rule assigned to the pool. The Job_pools property is a semicolon-separated list of pairs using the syntax Name=integer (without a space after the equality sign).

For instance:

set_property(GLOBAL PROPERTY JOB_POOLS two_jobs=2 ten_jobs=10)

Defined pools could be used globally by setting CMAKE_JOB_POOL_COMPILE and CMAKE_JOB_POOL_LINK or per target by setting the target properties Job_pool_compile and Job_pool_link.

Build targets provided by CMake that are meant for individual interactive use, such as install, are placed in the console pool automatically.

Predefined_targets_folder

Name of Folder for targets that are added automatically by CMake.

If not set, CMake uses "CMakePredefinedTargets" as a default value for this property. Targets such as INSTALL, PACKAGE and RUN_TESTS will be organized into this Folder. See also the documentation for the Folder target property.

Eclipse_extra_natures

List of natures to add to the generated Eclipse project file.

Eclipse projects specify language plugins by using natures. This property should be set to the unique identifier for a nature (which looks like a Java package name).

Report_undefined_properties

If set, report any undefined properties to this file.

If this property is set to a filename then when CMake runs it will report any properties or variables that were accessed but not defined into the filename specified in this property.

Rule_launch_compile

Specify a launcher for compile rules.

Makefile Generators and the Ninja generator prefix compiler commands with the given launcher command line. This is intended to allow launchers to intercept build problems with high granularity. Other generators ignore this property because their underlying build systems provide no hook to wrap individual commands with a launcher.

Rule_launch_custom

Specify a launcher for custom rules.

Makefile Generators and the Ninja generator prefix custom commands with the given launcher command line. This is intended to allow launchers to intercept build problems with high granularity. Other generators ignore this property because their underlying build systems provide no hook to wrap individual commands with a launcher.

Rule_messages

Specify whether to report a message for each make rule.

This property specifies whether Makefile generators should add a progress message describing what each build rule does. If the property is not set the default is ON. Set the property to OFF to disable granular messages and report only as each target completes. This is intended to allow scripted builds to avoid the build time cost of detailed reports. If a CMAKE_RULE_MESSAGES cache entry exists its value initializes the value of this property. Non-Makefile generators currently ignore this property.

Target_archives_may_be_shared_libs

Set if shared libraries may be named like archives.

On AIX shared libraries may be named "lib<name>.a". This property is set to true on such platforms.

Target_messages

Specify whether to report the completion of each target.

This property specifies whether Makefile Generators should add a progress message describing that each target has been completed. If the property is not set the default is ON. Set the property to OFF to disable target completion messages.

This option is intended to reduce build output when little or no work needs to be done to bring the build tree up to date.

If a CMAKE_TARGET_MESSAGES cache entry exists its value initializes the value of this property.

Non-Makefile generators currently ignore this property.

See the counterpart property Rule_messages to disable everything except for target completion messages.

Target_supports_shared_libs

Does the target platform support shared libraries.

Target_supports_shared_libs is a boolean specifying whether the target platform supports shared libraries. Basically all current general general purpose OS do so, the exception are usually embedded systems with no or special OSs.

Use_folders

Use the Folder target property to organize targets into folders.

If not set, CMake treats this property as OFF by default. CMake generators that are capable of organizing into a hierarchy of folders use the values of the Folder target property to name those folders. See also the documentation for the Folder target property.

Properties on Directories

Additional_make_clean_files

Additional files to clean during the make clean stage.

A list of files that will be cleaned as a part of the "make clean" stage.

Binary_dir

This read-only directory property reports absolute path to the binary directory corresponding to the source on which it is read.

Buildsystem_targets

This read-only directory property contains a ;-list of buildsystem targets added in the directory by calls to the add_library(), add_executable(), and add_custom_target() commands. The list does not include any Imported Targets or Alias Targets, but does include Interface Libraries. Each entry in the list is the logical name of a target, suitable to pass to the get_property() command TARGET option.

Cache_variables

List of cache variables available in the current directory.

This read-only property specifies the list of CMake cache variables currently defined. It is intended for debugging purposes.

Clean_no_custom

Set to true to tell Makefile Generators not to remove the outputs of custom commands for this directory during the make clean operation. This is ignored on other generators because it is not possible to implement.

Cmake_configure_depends

Tell CMake about additional input files to the configuration process. If any named file is modified the build system will re-run CMake to re-configure the file and generate the build system again.

Specify files as a semicolon-separated list of paths. Relative paths are interpreted as relative to the current source directory.

Compile_definitions

Preprocessor definitions for compiling a directory's sources.

This property specifies the list of options given so far to the add_definitions() command.

The Compile_definitions property may be set to a semicolon-separated list of preprocessor definitions using the syntax VAR or VAR=value. Function-style definitions are not supported. CMake will automatically escape the value correctly for the native build system (note that CMake language syntax may require escapes to specify some values).

This property will be initialized in each directory by its value in the directory's parent.

CMake will automatically drop some definitions that are not supported by the native build tool.

Disclaimer: Most native build tools have poor support for escaping certain values. CMake has work-arounds for many cases but some values may just not be possible to pass correctly. If a value does not seem to be escaped correctly, do not attempt to work-around the problem by adding escape sequences to the value. Your work-around may break in a future version of CMake that has improved escape support. Instead consider defining the macro in a (configured) header file. Then report the limitation. Known limitations include:

#          - broken almost everywhere
;          - broken in VS IDE 7.0 and Borland Makefiles
,          - broken in VS IDE
%          - broken in some cases in NMake
& |        - broken in some cases on MinGW
^ < > \"   - broken in most Make tools on Windows

CMake does not reject these values outright because they do work in some cases. Use with caution.

Contents of Compile_definitions may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

The corresponding COMPILE_DEFINITIONS_<CONFIG> property may be set to specify per-configuration definitions. Generator expressions should be preferred instead of setting the alternative property.

Compile_options

List of options to pass to the compiler.

This property holds a ;-list of options given so far to the add_compile_options() command.

This property is used to initialize the Compile_options target property when a target is created, which is used by the generators to set the options for the compiler.

Contents of Compile_options may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Definitions

For CMake 2.4 compatibility only. Use Compile_definitions instead.

This read-only property specifies the list of flags given so far to the add_definitions() command. It is intended for debugging purposes. Use the Compile_definitions directory property instead.

This built-in read-only property does not exist if policy CMP0059 is set to NEW.

Exclude_from_all

Exclude the directory from the all target of its parent.

A property on a directory that indicates if its targets are excluded from the default build target. If it is not, then with a Makefile for example typing make will cause the targets to be built. The same concept applies to the default build of other generators.

Implicit_depends_include_transform

Specify #include line transforms for dependencies in a directory.

This property specifies rules to transform macro-like #include lines during implicit dependency scanning of C and C++ source files. The list of rules must be semicolon-separated with each entry of the form "A_MACRO(%)=value-with-%" (the % must be literal). During dependency scanning occurrences of A_MACRO(...) on #include lines will be replaced by the value given with the macro argument substituted for '%'. For example, the entry

MYDIR(%)=<mydir/%>

will convert lines of the form

#include MYDIR(myheader.h)

to

#include <mydir/myheader.h>

allowing the dependency to be followed.

This property applies to sources in all targets within a directory. The property value is initialized in each directory by its value in the directory's parent.

Include_directories

List of preprocessor include file search directories.

This property specifies the list of directories given so far to the include_directories() command.

This property is used to populate the Include_directories target property, which is used by the generators to set the include directories for the compiler.

In addition to accepting values from that command, values may be set directly on any directory using the set_property() command. A directory gets its initial value from its parent directory if it has one. The initial value of the Include_directories target property comes from the value of this property. Both directory and target property values are adjusted by calls to the include_directories() command.

The target property values are used by the generators to set the include paths for the compiler.

Contents of Include_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Include_regular_expression

Include file scanning regular expression.

This property specifies the regular expression used during dependency scanning to match include files that should be followed. See the include_regular_expression() command for a high-level interface to set this property.

Interprocedural_optimization_<Config>

Per-configuration interprocedural optimization for a directory.

This is a per-configuration version of Interprocedural_optimization. If set, this property overrides the generic property for the named configuration.

Interprocedural_optimization

Enable interprocedural optimization for targets in a directory.

If set to true, enables interprocedural optimizations if they are known to be supported by the compiler.

Listfile_stack

The current stack of listfiles being processed.

This property is mainly useful when trying to debug errors in your CMake scripts. It returns a list of what list files are currently being processed, in order. So if one listfile does an include() command then that is effectively pushing the included listfile onto the stack.

Macros

List of macro commands available in the current directory.

This read-only property specifies the list of CMake macros currently defined. It is intended for debugging purposes. See the macro command.

Parent_directory

Source directory that added current subdirectory.

This read-only property specifies the source directory that added the current source directory as a subdirectory of the build. In the top-level directory the value is the empty-string.

Rule_launch_compile

Specify a launcher for compile rules.

See the global property of the same name for details. This overrides the global property for a directory.

Rule_launch_custom

Specify a launcher for custom rules.

See the global property of the same name for details. This overrides the global property for a directory.

Source_dir

This read-only directory property reports absolute path to the source directory on which it is read.

Subdirectories

This read-only directory property contains a ;-list of subdirectories processed so far by the add_subdirectory() or subdirs() commands. Each entry is the absolute path to the source directory (containing the CMakeLists.txt file). This is suitable to pass to the get_property() command DIRECTORY option.

NOTE:

The subdirs() command does not process its arguments until after the calling directory is fully processed. Therefore looking up this property in the current directory will not see them.

Test_include_file

A cmake file that will be included when ctest is run.

If you specify Test_include_file, that file will be included and processed when ctest is run on the directory.

Variables

List of variables defined in the current directory.

This read-only property specifies the list of CMake variables currently defined. It is intended for debugging purposes.

VS_GLOBAL_SECTION_POST_<section>

Specify a postSolution global section in Visual Studio.

Setting a property like this generates an entry of the following form in the solution file:

GlobalSection(<section>) = postSolution
  <contents based on property value>
EndGlobalSection

The property must be set to a semicolon-separated list of key=value pairs. Each such pair will be transformed into an entry in the solution global section. Whitespace around key and value is ignored. List elements which do not contain an equal sign are skipped.

This property only works for Visual Studio 7 and above; it is ignored on other generators. The property only applies when set on a directory whose CMakeLists.txt contains a project() command.

Note that CMake generates postSolution sections ExtensibilityGlobals and ExtensibilityAddIns by default. If you set the corresponding property, it will override the default section. For example, setting VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default contents of the ExtensibilityGlobals section, while keeping ExtensibilityAddIns on its default.

VS_GLOBAL_SECTION_PRE_<section>

Specify a preSolution global section in Visual Studio.

Setting a property like this generates an entry of the following form in the solution file:

GlobalSection(<section>) = preSolution
  <contents based on property value>
EndGlobalSection

The property must be set to a semicolon-separated list of key=value pairs. Each such pair will be transformed into an entry in the solution global section. Whitespace around key and value is ignored. List elements which do not contain an equal sign are skipped.

This property only works for Visual Studio 7 and above; it is ignored on other generators. The property only applies when set on a directory whose CMakeLists.txt contains a project() command.

Vs_startup_project

Specify the default startup project in a Visual Studio solution.

The Visual Studio Generators create a .sln file for each directory whose CMakeLists.txt file calls the project() command. Set this property in the same directory as a project() command call (e.g. in the top-level CMakeLists.txt file) to specify the default startup project for the correpsonding solution file.

The property must be set to the name of an existing target. This will cause that project to be listed first in the generated solution file causing Visual Studio to make it the startup project if the solution has never been opened before.

If this property is not specified, then the ALL_BUILD project will be the default.

Properties on Targets

Aliased_target

Name of target aliased by this target.

If this is an Alias Target, this property contains the name of the target aliased.

Android_ant_additional_options

Set the additional options for Android Ant build system. This is a string value containing all command line options for the Ant build. This property is initialized by the value of the CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS variable if it is set when a target is created.

Android_api

When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio Edition, this property sets the Android target API version (e.g. 15). The version number must be a positive decimal integer. This property is initialized by the value of the CMAKE_ANDROID_API variable if it is set when a target is created.

Android_api_min

Set the Android MIN API version (e.g. 9). The version number must be a positive decimal integer. This property is initialized by the value of the CMAKE_ANDROID_API_MIN variable if it is set when a target is created. Native code builds using this API version.

Android_arch

When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio Edition, this property sets the Android target architecture.

This is a string property that could be set to the one of the following values:

·
armv7-a: "ARMv7-A (armv7-a)"
·
armv7-a-hard: "ARMv7-A, hard-float ABI (armv7-a)"
·
arm64-v8a: "ARMv8-A, 64bit (arm64-v8a)"
·
x86: "x86 (x86)"
·
x86_64: "x86_64 (x86_64)"

This property is initialized by the value of the CMAKE_ANDROID_ARCH variable if it is set when a target is created.

Android_assets_directories

Set the Android assets directories to copy into the main assets folder before build. This a string property that contains the directory paths separated by semicolon. This property is initialized by the value of the CMAKE_ANDROID_ASSETS_DIRECTORIES variable if it is set when a target is created.

Android_gui

When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio Edition, this property specifies whether to build an executable as an application package on Android.

When this property is set to true the executable when built for Android will be created as an application package. This property is initialized by the value of the CMAKE_ANDROID_GUI variable if it is set when a target is created.

Add the AndroidManifest.xml source file explicitly to the target add_executable() command invocation to specify the root directory of the application package source.

Android_jar_dependencies

Set the Android property that specifies JAR dependencies. This is a string value property. This property is initialized by the value of the CMAKE_ANDROID_JAR_DEPENDENCIES variable if it is set when a target is created.

Android_jar_directories

Set the Android property that specifies directories to search for the JAR libraries.

This a string property that contains the directory paths separated by semicolons. This property is initialized by the value of the CMAKE_ANDROID_JAR_DIRECTORIES variable if it is set when a target is created.

Contents of Android_jar_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions.

Android_java_source_dir

Set the Android property that defines the Java source code root directories. This a string property that contains the directory paths separated by semicolon. This property is initialized by the value of the CMAKE_ANDROID_JAVA_SOURCE_DIR variable if it is set when a target is created.

Android_native_lib_dependencies

Set the Android property that specifies the .so dependencies. This is a string property.

This property is initialized by the value of the CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES variable if it is set when a target is created.

Contents of Android_native_lib_dependencies may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions.

Android_native_lib_directories

Set the Android property that specifies directories to search for the

This a string property that contains the directory paths separated by semicolons.

This property is initialized by the value of the CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES variable if it is set when a target is created.

Contents of Android_native_lib_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions.

Android_process_max

Set the Android property that defines the maximum number of a parallel Android NDK compiler processes (e.g. 4). This property is initialized by the value of the CMAKE_ANDROID_PROCESS_MAX variable if it is set when a target is created.

Android_proguard

When this property is set to true that enables the ProGuard tool to shrink, optimize, and obfuscate the code by removing unused code and renaming classes, fields, and methods with semantically obscure names. This property is initialized by the value of the CMAKE_ANDROID_PROGUARD variable if it is set when a target is created.

Android_proguard_config_path

Set the Android property that specifies the location of the ProGuard config file. Leave empty to use the default one. This a string property that contains the path to ProGuard config file. This property is initialized by the value of the CMAKE_ANDROID_PROGUARD_CONFIG_PATH variable if it is set when a target is created.

Android_secure_props_path

Set the Android property that states the location of the secure properties file. This is a string property that contains the file path. This property is initialized by the value of the CMAKE_ANDROID_SECURE_PROPS_PATH variable if it is set when a target is created.

Android_skip_ant_step

Set the Android property that defines whether or not to skip the Ant build step. This is a boolean property initialized by the value of the CMAKE_ANDROID_SKIP_ANT_STEP variable if it is set when a target is created.

Android_stl_type

When Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio Edition, this property specifies the type of STL support for the project. This is a string property that could set to the one of the following values:

none
No C++ Support
system
Minimal C++ without STL
gabi++_static
GAbi++ Static
gabi++_shared
GAbi++ Shared
gnustl_static
GNU libstdc++ Static
gnustl_shared
GNU libstdc++ Shared
stlport_static
STLport Static
stlport_shared
STLport Shared

This property is initialized by the value of the CMAKE_ANDROID_STL_TYPE variable if it is set when a target is created.

Archive_output_directory_<Config>

Per-configuration output directory for ARCHIVE target files.

This is a per-configuration version of the Archive_output_directory target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.

Contents of ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> may use generator expressions.

Archive_output_directory

Output directory in which to build ARCHIVE target files.

This property specifies the directory into which archive target files should be built. The property value may use generator expressions. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory unless a generator expression is used.

This property is initialized by the value of the variable CMAKE_ARCHIVE_OUTPUT_DIRECTORY if it is set when a target is created.

See also the ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> target property.

Archive_output_name_<Config>

Per-configuration output name for ARCHIVE target files.

This is the configuration-specific version of the Archive_output_name target property.

Archive_output_name

Output name for ARCHIVE target files.

This property specifies the base name for archive target files. It overrides Output_name and OUTPUT_NAME_<CONFIG> properties.

See also the ARCHIVE_OUTPUT_NAME_<CONFIG> target property.

Autogen_target_depends

Target dependencies of the corresponding _automoc target.

Targets which have their Automoc target ON have a corresponding _automoc target which is used to autogenerate generate moc files. As this _automoc target is created at generate-time, it is not possible to define dependencies of it, such as to create inputs for the moc executable.

The Autogen_target_depends target property can be set instead to a list of dependencies for the _automoc target. The buildsystem will be generated to depend on its contents.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Automoc_moc_options

Additional options for moc when using Automoc

This property is only used if the Automoc property is ON for this target. In this case, it holds additional command line options which will be used when moc is executed during the build, i.e. it is equivalent to the optional OPTIONS argument of the qt4_wrap_cpp() macro.

By default it is empty.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Automoc

Should the target be processed with automoc (for Qt projects).

Automoc is a boolean specifying whether CMake will handle the Qt moc preprocessor automatically, i.e. without having to use the QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are supported.

When this property is set ON, CMake will scan the source files at build time and invoke moc accordingly.

·
If an #include statement like #include "moc_foo.cpp" is found, the Q_OBJECT class declaration is expected in the header, and moc is run on the header file. A moc_foo.cpp file will be generated from the source's header into the CMAKE_CURRENT_BINARY_DIR directory. This allows the compiler to find the included moc_foo.cpp file regardless of the location the original source. However, if multiple source files in different directories do this then their generated moc files would collide. In this case a diagnostic will be issued.
·
If an #include statement like #include "foo.moc" is found, then a Q_OBJECT is expected in the current source file and moc is run on the file itself. Additionally, header files with the same base name (like foo.h) or _p appended to the base name (like foo_p.h) are parsed for Q_OBJECT macros, and if found, moc is also executed on those files. Automoc checks multiple header alternative extensions, such as hpp, hxx etc when searching for headers. The resulting moc files, which are not included as shown above in any of the source files are included in a generated <targetname>_automoc.cpp file, which is compiled as part of the target.

This property is initialized by the value of the CMAKE_AUTOMOC variable if it is set when a target is created.

Additional command line options for moc can be set via the Automoc_moc_options property.

By enabling the CMAKE_AUTOMOC_RELAXED_MODE variable the rules for searching the files which will be processed by moc can be relaxed. See the documentation for this variable for more details.

The global property Autogen_targets_folder can be used to group the automoc targets together in an IDE, e.g. in MSVS.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Autouic

Should the target be processed with autouic (for Qt projects).

Autouic is a boolean specifying whether CMake will handle the Qt uic code generator automatically, i.e. without having to use the QT4_WRAP_UI() or QT5_WRAP_UI() macro. Currently Qt4 and Qt5 are supported.

When this property is ON, CMake will scan the source files at build time and invoke uic accordingly. If an #include statement like #include "ui_foo.h" is found in foo.cpp, a foo.ui file is expected next to foo.cpp, and uic is run on the foo.ui file. This property is initialized by the value of the CMAKE_AUTOUIC variable if it is set when a target is created.

Additional command line options for uic can be set via the Autouic_options source file property on the foo.ui file. The global property Autogen_targets_folder can be used to group the autouic targets together in an IDE, e.g. in MSVS.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Autouic_options

Additional options for uic when using Autouic

This property holds additional command line options which will be used when uic is executed during the build via Autouic, i.e. it is equivalent to the optional OPTIONS argument of the qt4_wrap_ui() macro.

By default it is empty.

This property is initialized by the value of the CMAKE_AUTOUIC_OPTIONS variable if it is set when a target is created.

The options set on the target may be overridden by Autouic_options set on the .ui source file.

This property may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Autorcc

Should the target be processed with autorcc (for Qt projects).

Autorcc is a boolean specifying whether CMake will handle the Qt rcc code generator automatically, i.e. without having to use the QT4_ADD_RESOURCES() or QT5_ADD_RESOURCES() macro. Currently Qt4 and Qt5 are supported.

When this property is ON, CMake will handle .qrc files added as target sources at build time and invoke rcc accordingly. This property is initialized by the value of the CMAKE_AUTORCC variable if it is set when a target is created.

Additional command line options for rcc can be set via the Autorcc_options source file property on the .qrc file.

The global property Autogen_targets_folder can be used to group the autorcc targets together in an IDE, e.g. in MSVS.

When there are multiple .qrc files with the same name, CMake will generate unspecified unique names for rcc. Therefore if Q_INIT_RESOURCE() or Q_CLEANUP_RESOURCE() need to be used the .qrc file name must be unique.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Autorcc_options

Additional options for rcc when using Autorcc

This property holds additional command line options which will be used when rcc is executed during the build via Autorcc, i.e. it is equivalent to the optional OPTIONS argument of the qt4_add_resources() macro.

By default it is empty.

This property is initialized by the value of the CMAKE_AUTORCC_OPTIONS variable if it is set when a target is created.

The options set on the target may be overridden by Autorcc_options set on the .qrc source file.

See the cmake-qt(7) manual for more information on using CMake with Qt.

Binary_dir

This read-only property reports the value of the CMAKE_CURRENT_BINARY_DIR variable in the directory in which the target was defined.

Build_with_install_rpath

Should build tree targets have install tree rpaths.

Build_with_install_rpath is a boolean specifying whether to link the target in the build tree with the Install_rpath. This takes precedence over Skip_build_rpath and avoids the need for relinking before installation. This property is initialized by the value of the variable CMAKE_BUILD_WITH_INSTALL_RPATH if it is set when a target is created.

Bundle_extension

The file extension used to name a Bundle, a Framework, or a Macosx_bundle target on the OS X and iOS.

The default value is bundle, framework, or app for the respective target types.

Bundle

This target is a CFBundle on the OS X.

If a module library target has this property set to true it will be built as a CFBundle when built on the mac. It will have the directory structure required for a CFBundle and will be suitable to be used for creating Browser Plugins or other application resources.

C_extensions

Boolean specifying whether compiler specific extensions are requested.

This property specifies whether compiler specific extensions should be used. For some compilers, this results in adding a flag such as -std=gnu11 instead of -std=c11 to the compile line. This property is ON by default. The basic C standard level is controlled by the C_standard target property.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_C_EXTENSIONS variable if it is set when a target is created.

C_standard

The C standard whose features are requested to build this target.

This property specifies the C standard whose features are requested to build this target. For some compilers, this results in adding a flag such as -std=gnu11 to the compile line. For compilers that have no notion of a standard level, such as MSVC, this has no effect.

Supported values are 90, 99 and 11.

If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This means that using:

set_property(TARGET tgt PROPERTY C_STANDARD 11)

with a compiler which does not support -std=gnu11 or an equivalent flag will not result in an error or warning, but will instead add the -std=gnu99 or -std=gnu90 flag if supported. This "decay" behavior may be controlled with the C_standard_required target property. Additionally, the C_extensions target property may be used to control whether compiler-specific extensions are enabled on a per-target basis.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_C_STANDARD variable if it is set when a target is created.

C_standard_required

Boolean describing whether the value of C_standard is a requirement.

If this property is set to ON, then the value of the C_standard target property is treated as a requirement. If this property is OFF or unset, the C_standard target property is treated as optional and may "decay" to a previous standard if the requested is not available. For compilers that have no notion of a standard level, such as MSVC, this has no effect.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_C_STANDARD_REQUIRED variable if it is set when a target is created.

Compatible_interface_bool

Properties which must be compatible with their link interface

The Compatible_interface_bool property may contain a list of properties for this target which must be consistent when evaluated as a boolean with the INTERFACE variant of the property in all linked dependees. For example, if a property FOO appears in the list, then for each dependee, the INTERFACE_FOO property content in all of its dependencies must be consistent with each other, and with the FOO property in the depender.

Consistency in this sense has the meaning that if the property is set, then it must have the same boolean value as all others, and if the property is not set, then it is ignored.

Note that for each dependee, the set of properties specified in this property must not intersect with the set specified in any of the other Compatible Interface Properties.

Compatible_interface_number_max

Properties whose maximum value from the link interface will be used.

The Compatible_interface_number_max property may contain a list of properties for this target whose maximum value may be read at generate time when evaluated in the INTERFACE variant of the property in all linked dependees. For example, if a property FOO appears in the list, then for each dependee, the INTERFACE_FOO property content in all of its dependencies will be compared with each other and with the FOO property in the depender. When reading the FOO property at generate time, the maximum value will be returned. If the property is not set, then it is ignored.

Note that for each dependee, the set of properties specified in this property must not intersect with the set specified in any of the other Compatible Interface Properties.

Compatible_interface_number_min

Properties whose maximum value from the link interface will be used.

The Compatible_interface_number_min property may contain a list of properties for this target whose minimum value may be read at generate time when evaluated in the INTERFACE variant of the property of all linked dependees. For example, if a property FOO appears in the list, then for each dependee, the INTERFACE_FOO property content in all of its dependencies will be compared with each other and with the FOO property in the depender. When reading the FOO property at generate time, the minimum value will be returned. If the property is not set, then it is ignored.

Note that for each dependee, the set of properties specified in this property must not intersect with the set specified in any of the other Compatible Interface Properties.

Compatible_interface_string

Properties which must be string-compatible with their link interface

The Compatible_interface_string property may contain a list of properties for this target which must be the same when evaluated as a string in the INTERFACE variant of the property all linked dependees. For example, if a property FOO appears in the list, then for each dependee, the INTERFACE_FOO property content in all of its dependencies must be equal with each other, and with the FOO property in the depender. If the property is not set, then it is ignored.

Note that for each dependee, the set of properties specified in this property must not intersect with the set specified in any of the other Compatible Interface Properties.

Compile_definitions

Preprocessor definitions for compiling a target's sources.

The Compile_definitions property may be set to a semicolon-separated list of preprocessor definitions using the syntax VAR or VAR=value. Function-style definitions are not supported. CMake will automatically escape the value correctly for the native build system (note that CMake language syntax may require escapes to specify some values).

CMake will automatically drop some definitions that are not supported by the native build tool.

Disclaimer: Most native build tools have poor support for escaping certain values. CMake has work-arounds for many cases but some values may just not be possible to pass correctly. If a value does not seem to be escaped correctly, do not attempt to work-around the problem by adding escape sequences to the value. Your work-around may break in a future version of CMake that has improved escape support. Instead consider defining the macro in a (configured) header file. Then report the limitation. Known limitations include:

#          - broken almost everywhere
;          - broken in VS IDE 7.0 and Borland Makefiles
,          - broken in VS IDE
%          - broken in some cases in NMake
& |        - broken in some cases on MinGW
^ < > \"   - broken in most Make tools on Windows

CMake does not reject these values outright because they do work in some cases. Use with caution.

Contents of Compile_definitions may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

The corresponding COMPILE_DEFINITIONS_<CONFIG> property may be set to specify per-configuration definitions. Generator expressions should be preferred instead of setting the alternative property.

Compile_features

Compiler features enabled for this target.

The list of features in this property are a subset of the features listed in the CMAKE_CXX_COMPILE_FEATURES variable.

Contents of Compile_features may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

Compile_flags

Additional flags to use when compiling this target's sources.

The Compile_flags property sets additional compiler flags used to build sources within the target. Use Compile_definitions to pass additional preprocessor definitions.

This property is deprecated. Use the Compile_options property or the command:target_compile_options command instead.

Compile_options

List of options to pass to the compiler.

This property holds a ;-list of options specified so far for its target. Use the target_compile_options() command to append more options.

This property is initialized by the Compile_options directory property when a target is created, and is used by the generators to set the options for the compiler.

Contents of Compile_options may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Compile_pdb_name

Output name for the MS debug symbol .pdb file generated by the compiler while building source files.

This property specifies the base name for the debug symbols file. If not set, the default is unspecified.

NOTE:

The compiler-generated program database files are specified by the /Fd compiler flag and are not the same as linker-generated program database files specified by the /pdb linker flag. Use the Pdb_name property to specify the latter.

Compile_pdb_name_<Config>

Per-configuration output name for the MS debug symbol .pdb file generated by the compiler while building source files.

This is the configuration-specific version of Compile_pdb_name.

NOTE:

The compiler-generated program database files are specified by the /Fd compiler flag and are not the same as linker-generated program database files specified by the /pdb linker flag. Use the PDB_NAME_<CONFIG> property to specify the latter.

Compile_pdb_output_directory

Output directory for the MS debug symbol .pdb file generated by the compiler while building source files.

This property specifies the directory into which the MS debug symbols will be placed by the compiler. This property is initialized by the value of the CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY variable if it is set when a target is created.

NOTE:

The compiler-generated program database files are specified by the /Fd compiler flag and are not the same as linker-generated program database files specified by the /pdb linker flag. Use the Pdb_output_directory property to specify the latter.

Compile_pdb_output_directory_<Config>

Per-configuration output directory for the MS debug symbol .pdb file generated by the compiler while building source files.

This is a per-configuration version of Compile_pdb_output_directory, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.

NOTE:

The compiler-generated program database files are specified by the /Fd compiler flag and are not the same as linker-generated program database files specified by the /pdb linker flag. Use the PDB_OUTPUT_DIRECTORY_<CONFIG> property to specify the latter.

<Config>_output_name

Old per-configuration target file base name. Use OUTPUT_NAME_<CONFIG> instead.

This is a configuration-specific version of the Output_name target property.

<Config>_postfix

Postfix to append to the target file name for configuration <CONFIG>.

When building with configuration <CONFIG> the value of this property is appended to the target file name built on disk. For non-executable targets, this property is initialized by the value of the variable CMAKE_<CONFIG>_POSTFIX if it is set when a target is created. This property is ignored on the Mac for Frameworks and App Bundles.

Crosscompiling_emulator

Use the given emulator to run executables created when crosscompiling. This command will be added as a prefix to add_test(), add_custom_command(), and add_custom_target() commands for built target system executables.

Cxx_extensions

Boolean specifying whether compiler specific extensions are requested.

This property specifies whether compiler specific extensions should be used. For some compilers, this results in adding a flag such as -std=gnu++11 instead of -std=c++11 to the compile line. This property is ON by default. The basic C++ standard level is controlled by the Cxx_standard target property.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_CXX_EXTENSIONS variable if it is set when a target is created.

Cxx_standard

The C++ standard whose features are requested to build this target.

This property specifies the C++ standard whose features are requested to build this target. For some compilers, this results in adding a flag such as -std=gnu++11 to the compile line. For compilers that have no notion of a standard level, such as MSVC, this has no effect.

Supported values are 98, 11 and 14.

If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This means that using:

set_property(TARGET tgt PROPERTY CXX_STANDARD 11)

with a compiler which does not support -std=gnu++11 or an equivalent flag will not result in an error or warning, but will instead add the -std=gnu++98 flag if supported. This "decay" behavior may be controlled with the Cxx_standard_required target property. Additionally, the Cxx_extensions target property may be used to control whether compiler-specific extensions are enabled on a per-target basis.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_CXX_STANDARD variable if it is set when a target is created.

Cxx_standard_required

Boolean describing whether the value of Cxx_standard is a requirement.

If this property is set to ON, then the value of the Cxx_standard target property is treated as a requirement. If this property is OFF or unset, the Cxx_standard target property is treated as optional and may "decay" to a previous standard if the requested is not available. For compilers that have no notion of a standard level, such as MSVC, this has no effect.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

This property is initialized by the value of the CMAKE_CXX_STANDARD_REQUIRED variable if it is set when a target is created.

Debug_postfix

See target property <CONFIG>_POSTFIX.

This property is a special case of the more-general <CONFIG>_POSTFIX property for the DEBUG configuration.

Define_symbol

Define a symbol when compiling this target's sources.

Define_symbol sets the name of the preprocessor symbol defined when compiling sources in a shared library. If not set here then it is set to target_EXPORTS by default (with some substitutions if the target is not a valid C identifier). This is useful for headers to know whether they are being included from inside their library or outside to properly setup dllexport/dllimport decorations.

Deployment_remote_directory

Set the WinCE project RemoteDirectory in DeploymentTool and RemoteExecutable in DebuggerTool in .vcproj files generated by the Visual Studio 9 2008 and Visual Studio 8 2005 generators. This is useful when you want to debug on remote WinCE device. For example:

set_property(TARGET ${TARGET} PROPERTY
  DEPLOYMENT_REMOTE_DIRECTORY "\\FlashStorage")

produces:

<DeploymentTool RemoteDirectory="\FlashStorage" ... />
<DebuggerTool RemoteExecutable="\FlashStorage\target_file" ... />

EchoString

A message to be displayed when the target is built.

A message to display on some generators (such as makefiles) when the target is built.

Enable_exports

Specify whether an executable exports symbols for loadable modules.

Normally an executable does not export any symbols because it is the final program. It is possible for an executable to export symbols to be used by loadable modules. When this property is set to true CMake will allow other targets to "link" to the executable with the TARGET_LINK_LIBRARIES() command. On all platforms a target-level dependency on the executable is created for targets that link to it. For DLL platforms an import library will be created for the exported symbols and then used for linking. All Windows-based systems including Cygwin are DLL platforms. For non-DLL platforms that require all symbols to be resolved at link time, such as OS X, the module will "link" to the executable using a flag like -bundle_loader. For other non-DLL platforms the link rule is simply ignored since the dynamic loader will automatically bind symbols when the module is loaded.

This property is initialized by the value of the variable CMAKE_ENABLE_EXPORTS if it is set when a target is created.

Exclude_from_all

Exclude the target from the all target.

A property on a target that indicates if the target is excluded from the default build target. If it is not, then with a Makefile for example typing make will cause this target to be built. The same concept applies to the default build of other generators. Installing a target with Exclude_from_all set to true has undefined behavior.

Exclude_from_default_build_<Config>

Per-configuration version of target exclusion from "Build Solution".

This is the configuration-specific version of Exclude_from_default_build. If the generic Exclude_from_default_build is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> takes precedence in configurations for which it has a value.

Exclude_from_default_build

Exclude target from "Build Solution".

This property is only used by Visual Studio generators 7 and above. When set to TRUE, the target will not be built when you press "Build Solution".

Export_name

Exported name for target files.

This sets the name for the Imported target generated when it this target is is exported. If not set, the logical target name is used by default.

Folder

Set the folder name. Use to organize targets in an IDE.

Targets with no Folder property will appear as top level entities in IDEs like Visual Studio. Targets with the same Folder property value will appear next to each other in a folder of that name. To nest folders, use Folder values such as 'GUI/Dialogs' with '/' characters separating folder levels.

Fortran_FORMAT

Set to FIXED or FREE to indicate the Fortran source layout.

This property tells CMake whether the Fortran source files in a target use fixed-format or free-format. CMake will pass the corresponding format flag to the compiler. Use the source-specific Fortran_FORMAT property to change the format of a specific source file. If the variable CMAKE_Fortran_FORMAT is set when a target is created its value is used to initialize this property.

Fortran_MODULE_DIRECTORY

Specify output directory for Fortran modules provided by the target.

If the target contains Fortran source files that provide modules and the compiler supports a module output directory this specifies the directory in which the modules will be placed. When this property is not set the modules will be placed in the build directory corresponding to the target's source directory. If the variable CMAKE_Fortran_MODULE_DIRECTORY is set when a target is created its value is used to initialize this property.

Note that some compilers will automatically search the module output directory for modules USEd during compilation but others will not. If your sources USE modules their location must be specified by Include_directories regardless of this property.

Framework

Build SHARED library as Framework Bundle on the OS X and iOS.

If a SHARED library target has this property set to TRUE it will be built as a framework when built on the OS X and iOS. It will have the directory structure required for a framework and will be suitable to be used with the -framework option

To customize Info.plist file in the framework, use Macosx_framework_info_plist target property.

For OS X see also the Framework_version target property.

Example of creation dynamicFramework:

add_library(dynamicFramework SHARED
            dynamicFramework.c
            dynamicFramework.h
)
set_target_properties(dynamicFramework PROPERTIES
  FRAMEWORK TRUE
  FRAMEWORK_VERSION C
  MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework
  MACOSX_FRAMEWORK_INFO_PLIST Info.plist
  # "current version" in semantic format in Mach-O binary file
  VERSION 16.4.0
  # "compatibility version" in semantic format in Mach-O binary file
  SOVERSION 1.0.0
  PUBLIC_HEADER dynamicFramework.h
  XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)

Framework_version

Version of a framework created using the Framework target property (e.g. A).

This property only affects OS X, as iOS doesn't have versioned directory structure.

Generator_file_name

Generator's file for this target.

An internal property used by some generators to record the name of the project or dsp file associated with this target. Note that at configure time, this property is only set for targets created by include_external_msproject().

GNUtoMS

Convert GNU import library (.dll.a) to MS format (.lib).

When linking a shared library or executable that exports symbols using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed convert the import library (.dll.a) from GNU to MS format (.lib). Both import libraries will be installed by install(TARGETS) and exported by install(EXPORT) and export() to be linked by applications with either GNU- or MS-compatible tools.

If the variable CMAKE_GNUtoMS is set when a target is created its value is used to initialize this property. The variable must be set prior to the first command that enables a language such as project() or enable_language(). CMake provides the variable as an option to the user automatically when configuring on Windows with GNU tools.

Has_cxx

Link the target using the C++ linker tool (obsolete).

This is equivalent to setting the Linker_language property to CXX. See that property's documentation for details.

Implicit_depends_include_transform

Specify #include line transforms for dependencies in a target.

This property specifies rules to transform macro-like #include lines during implicit dependency scanning of C and C++ source files. The list of rules must be semicolon-separated with each entry of the form "A_MACRO(%)=value-with-%" (the % must be literal). During dependency scanning occurrences of A_MACRO(...) on #include lines will be replaced by the value given with the macro argument substituted for '%'. For example, the entry

MYDIR(%)=<mydir/%>

will convert lines of the form

#include MYDIR(myheader.h)

to

#include <mydir/myheader.h>

allowing the dependency to be followed.

This property applies to sources in the target on which it is set.

Imported_configurations

Configurations provided for an Imported target.

Set this to the list of configuration names available for an Imported target. The names correspond to configurations defined in the project from which the target is imported. If the importing project uses a different set of configurations the names may be mapped using the MAP_IMPORTED_CONFIG_<CONFIG> property. Ignored for non-imported targets.

Imported_implib_<Config>

<CONFIG>-specific version of Imported_implib property.

Configuration names correspond to those provided by the project from which the target is imported.

Imported_implib

Full path to the import library for an Imported target.

Set this to the location of the ".lib" part of a windows DLL. Ignored for non-imported targets.

Imported_location_<Config>

<CONFIG>-specific version of Imported_location property.

Configuration names correspond to those provided by the project from which the target is imported.

Imported_location

Full path to the main file on disk for an Imported target.

Set this to the location of an Imported target file on disk. For executables this is the location of the executable file. For bundles on OS X this is the location of the executable file inside Contents/MacOS under the application bundle folder. For static libraries and modules this is the location of the library or module. For shared libraries on non-DLL platforms this is the location of the shared library. For frameworks on OS X this is the location of the library file symlink just inside the framework folder. For DLLs this is the location of the ".dll" part of the library. For UNKNOWN libraries this is the location of the file to be linked. Ignored for non-imported targets.

Projects may skip Imported_location if the configuration-specific property IMPORTED_LOCATION_<CONFIG> is set. To get the location of an imported target read one of the Location or LOCATION_<CONFIG> properties.

Imported_no_soname_<Config>

<CONFIG>-specific version of Imported_no_soname property.

Configuration names correspond to those provided by the project from which the target is imported.

Imported_no_soname

Specifies that an Imported shared library target has no "soname".

Set this property to true for an imported shared library file that has no "soname" field. CMake may adjust generated link commands for some platforms to prevent the linker from using the path to the library in place of its missing soname. Ignored for non-imported targets.

Imported

Read-only indication of whether a target is Imported.

The boolean value of this property is True for targets created with the Imported option to add_executable() or add_library(). It is False for targets built within the project.

Imported_soname_<Config>

<CONFIG>-specific version of Imported_soname property.

Configuration names correspond to those provided by the project from which the target is imported.

Imported_soname

The "soname" of an Imported target of shared library type.

Set this to the "soname" embedded in an imported shared library. This is meaningful only on platforms supporting the feature. Ignored for non-imported targets.

Import_prefix

What comes before the import library name.

Similar to the target property Prefix, but used for import libraries (typically corresponding to a DLL) instead of regular libraries. A target property that can be set to override the prefix (such as "lib") on an import library name.

Import_suffix

What comes after the import library name.

Similar to the target property Suffix, but used for import libraries (typically corresponding to a DLL) instead of regular libraries. A target property that can be set to override the suffix (such as ".lib") on an import library name.

Include_directories

List of preprocessor include file search directories.

This property specifies the list of directories given so far to the target_include_directories() command. In addition to accepting values from that command, values may be set directly on any target using the set_property() command. A target gets its initial value for this property from the value of the Include_directories directory property. Both directory and target property values are adjusted by calls to the include_directories() command.

The value of this property is used by the generators to set the include paths for the compiler.

Relative paths should not be added to this property directly. Use one of the commands above instead to handle relative paths.

Contents of Include_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Install_name_dir

Mac OSX directory name for installed targets.

Install_name_dir is a string specifying the directory portion of the "install_name" field of shared libraries on Mac OSX to use in the installed targets.

Install_rpath

The rpath to use for installed targets.

A semicolon-separated list specifying the rpath to use in installed targets (for platforms that support it). This property is initialized by the value of the variable CMAKE_INSTALL_RPATH if it is set when a target is created.

Interface_autouic_options

List of interface options to pass to uic.

Targets may populate this property to publish the options required to use when invoking uic. Consuming targets can add entries to their own Autouic_options property such as $<TARGET_PROPERTY:foo,Interface_autouic_options> to use the uic options specified in the interface of foo. This is done automatically by the target_link_libraries() command.

This property supports generator expressions. See the cmake-generator-expressions(7) manual for available expressions.

Interface_compile_definitions

List of public compile definitions requirements for a library.

Targets may populate this property to publish the compile definitions required to compile against the headers for the target. The target_compile_definitions() command populates this property with values given to the PUBLIC and INTERFACE keywords. Projects may also get and set the property directly.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to determine the build properties of the consumer.

Contents of Interface_compile_definitions may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) -manual for more on defining buildsystem properties.

Interface_compile_features

List of public compile features requirements for a library.

Targets may populate this property to publish the compile features required to compile against the headers for the target. The target_compile_features() command populates this property with values given to the PUBLIC and INTERFACE keywords. Projects may also get and set the property directly.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to determine the build properties of the consumer.

Contents of Interface_compile_features may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) -manual for more on defining buildsystem properties.

See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers.

Interface_compile_options

List of public compile options requirements for a library.

Targets may populate this property to publish the compile options required to compile against the headers for the target. The target_compile_options() command populates this property with values given to the PUBLIC and INTERFACE keywords. Projects may also get and set the property directly.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to determine the build properties of the consumer.

Contents of Interface_compile_options may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) -manual for more on defining buildsystem properties.

Interface_include_directories

List of public include directories requirements for a library.

Targets may populate this property to publish the include directories required to compile against the headers for the target. The target_include_directories() command populates this property with values given to the PUBLIC and INTERFACE keywords. Projects may also get and set the property directly.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to determine the build properties of the consumer.

Contents of Interface_include_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) -manual for more on defining buildsystem properties.

Include directories usage requirements commonly differ between the build-tree and the install-tree. The BUILD_INTERFACE and INSTALL_INTERFACE generator expressions can be used to describe separate usage requirements based on the usage location. Relative paths are allowed within the INSTALL_INTERFACE expression and are interpreted relative to the installation prefix. For example:

target_include_directories(mylib INTERFACE
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib>
  $<INSTALL_INTERFACE:include/mylib>  # <prefix>/include/mylib
)

Creating Relocatable Packages

Note that it is not advisable to populate the INSTALL_INTERFACE of the Interface_include_directories of a target with absolute paths to the include directories of dependencies. That would hard-code into installed packages the include directory paths for dependencies as found on the machine the package was made on.

The INSTALL_INTERFACE of the Interface_include_directories is only suitable for specifying the required include directories for headers provided with the target itself, not those provided by the transitive dependencies listed in its Interface_link_libraries target property. Those dependencies should themselves be targets that specify their own header locations in Interface_include_directories.

See the Creating Relocatable Packages section of the cmake-packages(7) manual for discussion of additional care that must be taken when specifying usage requirements while creating packages for redistribution.

Creating Relocatable Packages

Note that it is not advisable to populate the Interface_link_libraries of a target with absolute paths to dependencies. That would hard-code into installed packages the library file paths for dependencies as found on the machine the package was made on.

See the Creating Relocatable Packages section of the cmake-packages(7) manual for discussion of additional care that must be taken when specifying usage requirements while creating packages for redistribution.

Interface_position_independent_code

Whether consumers need to create a position-independent target

The Interface_position_independent_code property informs consumers of this target whether they must set their Position_independent_code property to ON. If this property is set to ON, then the Position_independent_code property on all consumers will be set to ON. Similarly, if this property is set to OFF, then the Position_independent_code property on all consumers will be set to OFF. If this property is undefined, then consumers will determine their Position_independent_code property by other means. Consumers must ensure that the targets that they link to have a consistent requirement for their Interface_position_independent_code property.

Interface_sources

List of interface sources to compile into consuming targets.

Targets may populate this property to publish the sources for consuming targets to compile. The target_sources() command populates this property with values given to the PUBLIC and INTERFACE keywords. Projects may also get and set the property directly.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to determine the sources of the consumer.

Contents of Interface_sources may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Interface_system_include_directories

List of public system include directories for a library.

Targets may populate this property to publish the include directories which contain system headers, and therefore should not result in compiler warnings. The target_include_directories(SYSTEM) command signature populates this property with values given to the PUBLIC and INTERFACE keywords.

Projects may also get and set the property directly, but must be aware that adding directories to this property does not make those directories used during compilation. Adding directories to this property marks directories as SYSTEM which otherwise would be used in a non-SYSTEM manner. This can appear similar to 'duplication', so prefer the high-level target_include_directories(SYSTEM) command and avoid setting the property by low-level means.

When target dependencies are specified using target_link_libraries(), CMake will read this property from all target dependencies to mark the same include directories as containing system headers.

Contents of Interface_system_include_directories may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Interprocedural_optimization_<Config>

Per-configuration interprocedural optimization for a target.

This is a per-configuration version of Interprocedural_optimization. If set, this property overrides the generic property for the named configuration.

Interprocedural_optimization

Enable interprocedural optimization for a target.

If set to true, enables interprocedural optimizations if they are known to be supported by the compiler.

Ios_install_combined

Build a combined (device and simulator) target when installing.

When this property is set to set to false (which is the default) then it will either be built with the device SDK or the simulator SDK depending on the SDK set. But if this property is set to true then the target will at install time also be built for the corresponding SDK and combined into one library.

This feature requires at least Xcode version 6.

Job_pool_compile

Ninja only: Pool used for compiling.

The number of parallel compile processes could be limited by defining pools with the global Job_pools property and then specifying here the pool name.

For instance:

set_property(TARGET myexe PROPERTY JOB_POOL_COMPILE ten_jobs)

This property is initialized by the value of CMAKE_JOB_POOL_COMPILE.

Labels

Specify a list of text labels associated with a target.

Target label semantics are currently unspecified.

<Lang>_clang_tidy

This property is implemented only when <LANG> is C or CXX.

Specify a ;-list containing a command line for the clang-tidy tool. The Makefile Generators and the Ninja generator will run this tool along with the compiler and report a warning if the tool reports any problems.

This property is initialized by the value of the CMAKE_<LANG>_CLANG_TIDY variable if it is set when a target is created.

<Lang>_compiler_launcher

This property is implemented only when <LANG> is C or CXX.

Specify a ;-list containing a command line for a compiler launching tool. The Makefile Generators and the Ninja generator will run this tool and pass the compiler and its arguments to the tool. Some example tools are distcc and ccache.

This property is initialized by the value of the CMAKE_<LANG>_COMPILER_LAUNCHER variable if it is set when a target is created.

<Lang>_include_what_you_use

This property is implemented only when <LANG> is C or CXX.

Specify a ;-list containing a command line for the include-what-you-use tool. The Makefile Generators and the Ninja generator will run this tool along with the compiler and report a warning if the tool reports any problems.

This property is initialized by the value of the CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable if it is set when a target is created.

<Lang>_visibility_preset

Value for symbol visibility compile flags

The <LANG>_VISIBILITY_PRESET property determines the value passed in a visibility related compile option, such as -fvisibility= for <LANG>. This property affects compilation in sources of all types of targets (subject to policy CMP0063).

This property is initialized by the value of the CMAKE_<LANG>_VISIBILITY_PRESET variable if it is set when a target is created.

Library_output_directory_<Config>

Per-configuration output directory for LIBRARY target files.

This is a per-configuration version of the Library_output_directory target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.

Contents of LIBRARY_OUTPUT_DIRECTORY_<CONFIG> may use generator expressions.

Library_output_directory

Output directory in which to build LIBRARY target files.

This property specifies the directory into which library target files should be built. The property value may use generator expressions. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory unless a generator expression is used.

This property is initialized by the value of the variable CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.

See also the LIBRARY_OUTPUT_DIRECTORY_<CONFIG> target property.

Library_output_name_<Config>

Per-configuration output name for LIBRARY target files.

This is the configuration-specific version of the Library_output_name target property.

Library_output_name

Output name for LIBRARY target files.

This property specifies the base name for library target files. It overrides Output_name and OUTPUT_NAME_<CONFIG> properties.

See also the LIBRARY_OUTPUT_NAME_<CONFIG> target property.

Linker_language

Specifies language whose compiler will invoke the linker.

For executables, shared libraries, and modules, this sets the language whose compiler is used to link the target (such as "C" or "CXX"). A typical value for an executable is the language of the source file providing the program entry point (main). If not set, the language with the highest linker preference value is the default. See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.

If this property is not set by the user, it will be calculated at generate-time by CMake.

Creating Relocatable Packages

Note that it is not advisable to populate the LINK_INTERFACE_LIBRARIES_<CONFIG> of a target with absolute paths to dependencies. That would hard-code into installed packages the library file paths for dependencies as found on the machine the package was made on.

See the Creating Relocatable Packages section of the cmake-packages(7) manual for discussion of additional care that must be taken when specifying usage requirements while creating packages for redistribution.

Creating Relocatable Packages

Note that it is not advisable to populate the Link_interface_libraries of a target with absolute paths to dependencies. That would hard-code into installed packages the library file paths for dependencies as found on the machine the package was made on.

See the Creating Relocatable Packages section of the cmake-packages(7) manual for discussion of additional care that must be taken when specifying usage requirements while creating packages for redistribution.

Location_<Config>

Read-only property providing a target location on disk.

A read-only property that indicates where a target's main file is located on disk for the configuration <CONFIG>. The property is defined only for library and executable targets. An imported target may provide a set of configurations different from that of the importing project. By default CMake looks for an exact-match but otherwise uses an arbitrary available configuration. Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported configurations explicitly.

Do not set properties that affect the location of a target after reading this property. These include properties whose names match "(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(Name|DIRECTORY)(_<CONFIG>)?", (IMPLIB_)?(Prefix|Suffix), or "Linker_language". Failure to follow this rule is not diagnosed and leaves the location of the target undefined.

Location

Read-only location of a target on disk.

For an imported target, this read-only property returns the value of the LOCATION_<CONFIG> property for an unspecified configuration <CONFIG> provided by the target.

For a non-imported target, this property is provided for compatibility with CMake 2.4 and below. It was meant to get the location of an executable target's output file for use in add_custom_command. The path may contain a build-system-specific portion that is replaced at build time with the configuration getting built (such as "$(ConfigurationName)" in VS). In CMake 2.6 and above add_custom_command automatically recognizes a target name in its COMMAND and Depends options and computes the target location. In CMake 2.8.4 and above add_custom_command recognizes generator expressions to refer to target locations anywhere in the command. Therefore this property is not needed for creating custom commands.

Do not set properties that affect the location of a target after reading this property. These include properties whose names match "(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(Name|DIRECTORY)(_<CONFIG>)?", (IMPLIB_)?(Prefix|Suffix), or "Linker_language". Failure to follow this rule is not diagnosed and leaves the location of the target undefined.

Macosx_bundle_info_plist

Specify a custom Info.plist template for a OS X and iOS Application Bundle.

An executable target with Macosx_bundle enabled will be built as an application bundle on OS X. By default its Info.plist file is created by configuring a template called MacOSXBundleInfo.plist.in located in the CMAKE_MODULE_PATH. This property specifies an alternative template file name which may be a full path.

The following target properties may be set to specify content to be configured into the file:

MACOSX_BUNDLE_BUNDLE_NAME
Sets CFBundleName.
MACOSX_BUNDLE_BUNDLE_VERSION
Sets CFBundleVersion.
MACOSX_BUNDLE_COPYRIGHT
Sets NSHumanReadableCopyright.
MACOSX_BUNDLE_GUI_IDENTIFIER
Sets CFBundleIdentifier.
MACOSX_BUNDLE_ICON_FILE
Sets CFBundleIconFile.
MACOSX_BUNDLE_INFO_STRING
Sets CFBundleGetInfoString.
MACOSX_BUNDLE_LONG_VERSION_STRING
Sets CFBundleLongVersionString.
MACOSX_BUNDLE_SHORT_VERSION_STRING
Sets CFBundleShortVersionString.

CMake variables of the same name may be set to affect all targets in a directory that do not have each specific property set. If a custom Info.plist is specified by this property it may of course hard-code all the settings instead of using the target properties.

Macosx_bundle

Build an executable as an Application Bundle on OS X or iOS.

When this property is set to TRUE the executable when built on OS X or iOS will be created as an application bundle. This makes it a GUI executable that can be launched from the Finder. See the Macosx_framework_info_plist target property for information about creation of the Info.plist file for the application bundle. This property is initialized by the value of the variable CMAKE_MACOSX_BUNDLE if it is set when a target is created.

Macosx_framework_info_plist

Specify a custom Info.plist template for a OS X and iOS Framework.

A library target with Framework enabled will be built as a framework on OS X. By default its Info.plist file is created by configuring a template called MacOSXFrameworkInfo.plist.in located in the CMAKE_MODULE_PATH. This property specifies an alternative template file name which may be a full path.

The following target properties may be set to specify content to be configured into the file:

MACOSX_FRAMEWORK_BUNDLE_VERSION
Sets CFBundleVersion.
MACOSX_FRAMEWORK_ICON_FILE
Sets CFBundleIconFile.
MACOSX_FRAMEWORK_IDENTIFIER
Sets CFBundleIdentifier.
MACOSX_FRAMEWORK_SHORT_VERSION_STRING
Sets CFBundleShortVersionString.

CMake variables of the same name may be set to affect all targets in a directory that do not have each specific property set. If a custom Info.plist is specified by this property it may of course hard-code all the settings instead of using the target properties.

Macosx_rpath

Whether this target on OS X or iOS is located at runtime using rpaths.

When this property is set to TRUE, the directory portion of the install_name field of this shared library will be @rpath unless overridden by Install_name_dir. This indicates the shared library is to be found at runtime using runtime paths (rpaths).

This property is initialized by the value of the variable CMAKE_MACOSX_RPATH if it is set when a target is created.

Runtime paths will also be embedded in binaries using this target and can be controlled by the Install_rpath target property on the target linking to this target.

Policy CMP0042 was introduced to change the default value of Macosx_rpath to TRUE. This is because use of @rpath is a more flexible and powerful alternative to @executable_path and @loader_path.

Map_imported_config_<Config>

Map from project configuration to Imported target's configuration.

Set this to the list of configurations of an imported target that may be used for the current project's <CONFIG> configuration. Targets imported from another project may not provide the same set of configuration names available in the current project. Setting this property tells CMake what imported configurations are suitable for use when building the <CONFIG> configuration. The first configuration in the list found to be provided by the imported target is selected. If this property is set and no matching configurations are available, then the imported target is considered to be not found. This property is ignored for non-imported targets.

This property is initialized by the value of the variable CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is created.

Name

Logical name for the target.

Read-only logical name for the target as used by CMake.

No_soname

Whether to set "soname" when linking a shared library.

Enable this boolean property if a generated shared library should not have "soname" set. Default is to set "soname" on all shared libraries as long as the platform supports it. Generally, use this property only for leaf private libraries or plugins. If you use it on normal shared libraries which other targets link against, on some platforms a linker will insert a full path to the library (as specified at link time) into the dynamic section of the dependent binary. Therefore, once installed, dynamic loader may eventually fail to locate the library for the binary.

No_system_from_imported

Do not treat includes from Imported target interfaces as SYSTEM.

The contents of the Interface_include_directories of Imported targets are treated as SYSTEM includes by default. If this property is enabled, the contents of the Interface_include_directories of Imported targets are not treated as system includes. This property is initialized by the value of the variable CMAKE_NO_SYSTEM_FROM_IMPORTED if it is set when a target is created.

Osx_architectures_<Config>

Per-configuration OS X and iOS binary architectures for a target.

This property is the configuration-specific version of Osx_architectures.

Osx_architectures

Target specific architectures for OS X.

The Osx_architectures property sets the target binary architecture for targets on OS X (-arch). This property is initialized by the value of the variable CMAKE_OSX_ARCHITECTURES if it is set when a target is created. Use OSX_ARCHITECTURES_<CONFIG> to set the binary architectures on a per-configuration basis, where <CONFIG> is an upper-case name (e.g. OSX_ARCHITECTURES_DEBUG).

Output_name_<Config>

Per-configuration target file base name.

This is the configuration-specific version of the Output_name target property.

Output_name

Output name for target files.

This sets the base name for output files created for an executable or library target. If not set, the logical target name is used by default.

Contents of Output_name and the variants listed below may use generator expressions.

See also the variants:

·
OUTPUT_NAME_<CONFIG>
·
ARCHIVE_OUTPUT_NAME_<CONFIG>
·
Archive_output_name
·
LIBRARY_OUTPUT_NAME_<CONFIG>
·
Library_output_name
·
RUNTIME_OUTPUT_NAME_<CONFIG>
·
Runtime_output_name

Pdb_name_<Config>

Per-configuration output name for the MS debug symbol .pdb file generated by the linker for an executable or shared library target.

This is the configuration-specific version of Pdb_name.

NOTE:

This property does not apply to STATIC library targets because no linker is invoked to produce them so they have no linker-generated .pdb file containing debug symbols.

The linker-generated program database files are specified by the /pdb linker flag and are not the same as compiler-generated program database files specified by the /Fd compiler flag. Use the COMPILE_PDB_NAME_<CONFIG> property to specify the latter.

Pdb_name

Output name for the MS debug symbol .pdb file generated by the linker for an executable or shared library target.

This property specifies the base name for the debug symbols file. If not set, the Output_name target property value or logical target name is used by default.

NOTE:

This property does not apply to STATIC library targets because no linker is invoked to produce them so they have no linker-generated .pdb file containing debug symbols.

The linker-generated program database files are specified by the /pdb linker flag and are not the same as compiler-generated program database files specified by the /Fd compiler flag. Use the Compile_pdb_name property to specify the latter.

Pdb_output_directory_<Config>

Per-configuration output directory for the MS debug symbol .pdb file generated by the linker for an executable or shared library target.

This is a per-configuration version of Pdb_output_directory, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.

NOTE:

This property does not apply to STATIC library targets because no linker is invoked to produce them so they have no linker-generated .pdb file containing debug symbols.

The linker-generated program database files are specified by the /pdb linker flag and are not the same as compiler-generated program database files specified by the /Fd compiler flag. Use the COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> property to specify the latter.

Pdb_output_directory

Output directory for the MS debug symbols .pdb file generated by the linker for an executable or shared library target.

This property specifies the directory into which the MS debug symbols will be placed by the linker. This property is initialized by the value of the CMAKE_PDB_OUTPUT_DIRECTORY variable if it is set when a target is created.

NOTE:

This property does not apply to STATIC library targets because no linker is invoked to produce them so they have no linker-generated .pdb file containing debug symbols.

The linker-generated program database files are specified by the /pdb linker flag and are not the same as compiler-generated program database files specified by the /Fd compiler flag. Use the Compile_pdb_output_directory property to specify the latter.

Position_independent_code

Whether to create a position-independent target

The Position_independent_code property determines whether position independent executables or shared libraries will be created. This property is True by default for SHARED and MODULE library targets and False otherwise. This property is initialized by the value of the CMAKE_POSITION_INDEPENDENT_CODE variable if it is set when a target is created.

Prefix

What comes before the library name.

A target property that can be set to override the prefix (such as "lib") on a library name.

Private_header

Specify private header files in a Framework shared library target.

Shared library targets marked with the Framework property generate frameworks on OS X, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the PrivateHeaders directory inside the framework folder. On non-Apple platforms these headers may be installed using the Private_header option to the install(TARGETS) command.

Project_label

Change the name of a target in an IDE.

Can be used to change the name of the target in an IDE like Visual Studio.

Public_header

Specify public header files in a Framework shared library target.

Shared library targets marked with the Framework property generate frameworks on OS X, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the Headers directory inside the framework folder. On non-Apple platforms these headers may be installed using the Public_header option to the install(TARGETS) command.

Resource

Specify resource files in a Framework or Bundle.

Target marked with the Framework or Bundle property generate framework or application bundle (both OS X and iOS is supported) or normal shared libraries on other platforms. This property may be set to a list of files to be placed in the corresponding directory (eg. Resources directory for OS X) inside the bundle. On non-Apple platforms these files may be installed using the Resource option to the install(TARGETS) command.

Following example of Application Bundle:

add_executable(ExecutableTarget
  addDemo.c
  resourcefile.txt
  appresourcedir/appres.txt
)

target_link_libraries(ExecutableTarget heymath mul)

set(RESOURCE_FILES
  resourcefile.txt
  appresourcedir/appres.txt
)

set_target_properties(ExecutableTarget PROPERTIES
  MACOSX_BUNDLE TRUE
  MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
  RESOURCE "${RESOURCE_FILES}"
)

will produce flat structure for iOS systems:

ExecutableTarget.app
  appres.txt
  ExecutableTarget
  Info.plist
  resourcefile.txt

For OS X systems it will produce following directory structure:

ExecutableTarget.app/
  Contents
    Info.plist
    MacOS
      ExecutableTarget
    Resources
      appres.txt
      resourcefile.txt

For Linux, such cmake script produce following files:

ExecutableTarget
Resources
  appres.txt
  resourcefile.txt

Rule_launch_compile

Specify a launcher for compile rules.

See the global property of the same name for details. This overrides the global and directory property for a target.

Rule_launch_custom

Specify a launcher for custom rules.

See the global property of the same name for details. This overrides the global and directory property for a target.

Runtime_output_directory_<Config>

Per-configuration output directory for RUNTIME target files.

This is a per-configuration version of the Runtime_output_directory target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> variable if it is set when a target is created.

Contents of RUNTIME_OUTPUT_DIRECTORY_<CONFIG> may use generator expressions.

Runtime_output_directory

Output directory in which to build RUNTIME target files.

This property specifies the directory into which runtime target files should be built. The property value may use generator expressions. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory unless a generator expression is used.

This property is initialized by the value of the variable CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created.

See also the RUNTIME_OUTPUT_DIRECTORY_<CONFIG> target property.

Runtime_output_name_<Config>

Per-configuration output name for RUNTIME target files.

This is the configuration-specific version of the Runtime_output_name target property.

Runtime_output_name

Output name for RUNTIME target files.

This property specifies the base name for runtime target files. It overrides Output_name and OUTPUT_NAME_<CONFIG> properties.

See also the RUNTIME_OUTPUT_NAME_<CONFIG> target property.

Skip_build_rpath

Should rpaths be used for the build tree.

Skip_build_rpath is a boolean specifying whether to skip automatic generation of an rpath allowing the target to run from the build tree. This property is initialized by the value of the variable CMAKE_SKIP_BUILD_RPATH if it is set when a target is created.

Source_dir

This read-only property reports the value of the CMAKE_CURRENT_SOURCE_DIR variable in the directory in which the target was defined.

Sources

Source names specified for a target.

List of sources specified for a target.

Soversion

What version number is this target.

For shared libraries Version and Soversion can be used to specify the build version and API version respectively. When building or installing appropriate symlinks are created if the platform supports symlinks and the linker supports so-names. If only one of both is specified the missing is assumed to have the same version number. Soversion is ignored if No_soname property is set.

Windows Versions

For shared libraries and executables on Windows the Version attribute is parsed to extract a <major>.<minor> version number. These numbers are used as the image version of the binary.

Mach-O Versions

For shared libraries and executables on Mach-O systems (e.g. OS X, iOS), the Soversion property corresponds to compatibility version and Version to current version. See the Framework target property for an example. Versions of Mach-O binaries may be checked with the otool -L <binary> command.

Static_library_flags_<Config>

Per-configuration flags for creating a static library.

This is the configuration-specific version of Static_library_flags.

Static_library_flags

Extra flags to use when linking static libraries.

Extra flags to use when linking a static library.

Suffix

What comes after the target name.

A target property that can be set to override the suffix (such as ".so" or ".exe") on the name of a library, module or executable.

Type

The type of the target.

This read-only property can be used to test the type of the given target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, SHARED_LIBRARY, INTERFACE_LIBRARY, EXECUTABLE or one of the internal target types.

Version

What version number is this target.

For shared libraries Version and Soversion can be used to specify the build version and API version respectively. When building or installing appropriate symlinks are created if the platform supports symlinks and the linker supports so-names. If only one of both is specified the missing is assumed to have the same version number. For executables Version can be used to specify the build version. When building or installing appropriate symlinks are created if the platform supports symlinks.

Windows Versions

For shared libraries and executables on Windows the Version attribute is parsed to extract a <major>.<minor> version number. These numbers are used as the image version of the binary.

Mach-O Versions

For shared libraries and executables on Mach-O systems (e.g. OS X, iOS), the Soversion property correspond to compatibility version and Version to current version. See the Framework target property for an example. Versions of Mach-O binaries may be checked with the otool -L <binary> command.

Visibility_inlines_hidden

Whether to add a compile flag to hide symbols of inline functions

The Visibility_inlines_hidden property determines whether a flag for hiding symbols for inline functions, such as -fvisibility-inlines-hidden, should be used when invoking the compiler. This property affects compilation in sources of all types of targets (subject to policy CMP0063).

This property is initialized by the value of the CMAKE_VISIBILITY_INLINES_HIDDEN variable if it is set when a target is created.

Vs_configuration_type

Visual Studio project configuration type.

Sets the ConfigurationType attribute for a generated Visual Studio project. If this property is set, it overrides the default setting that is based on the target type (e.g. StaticLibrary, Application, ...).

Supported on Visual Studio Generators for VS 2010 and higher.

Vs_desktop_extensions_version

Visual Studio Windows 10 Desktop Extensions Version

Specifies the version of the Desktop Extensions that should be included in the target. For example 10.0.10240.0. If the value is not specified, the Desktop Extensions will not be included. To use the same version of the extensions as the Windows 10 SDK that is being used, you can use the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.

Vs_dotnet_references

Visual Studio managed project .NET references

Adds one or more semicolon-delimited .NET references to a generated Visual Studio project. For example, "System;System.Windows.Forms".

Vs_dotnet_target_framework_version

Specify the .NET target framework version.

Used to specify the .NET target framework version for C++/CLI. For example, "v4.5".

Vs_global_keyword

Visual Studio project keyword for VS 10 (2010) and newer.

Sets the "keyword" attribute for a generated Visual Studio project. Defaults to "Win32Proj". You may wish to override this value with "ManagedCProj", for example, in a Visual Studio managed C++ unit test project.

Use the Vs_keyword target property to set the keyword for Visual Studio 9 (2008) and older.

Vs_global_project_types

Visual Studio project type(s).

Can be set to one or more UUIDs recognized by Visual Studio to indicate the type of project. This value is copied verbatim into the generated project file. Example for a managed C++ unit testing project:

{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}

UUIDs are semicolon-delimited.

Vs_global_rootnamespace

Visual Studio project root namespace.

Sets the "RootNamespace" attribute for a generated Visual Studio project. The attribute will be generated only if this is set.

VS_GLOBAL_<variable>

Visual Studio project-specific global variable.

Tell the Visual Studio generator to set the global variable '<variable>' to a given value in the generated Visual Studio project. Ignored on other generators. Qt integration works better if VS_GLOBAL_QtVersion is set to the version FindQt4.cmake found. For example, "4.7.3"

Vs_iot_extensions_version

Visual Studio Windows 10 IoT Extensions Version

Specifies the version of the IoT Extensions that should be included in the target. For example 10.0.10240.0. If the value is not specified, the IoT Extensions will not be included. To use the same version of the extensions as the Windows 10 SDK that is being used, you can use the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.

Vs_iot_startup_task

Visual Studio Windows 10 IoT Continuous Background Task

Specifies that the target should be compiled as a Continuous Background Task library.

Vs_keyword

Visual Studio project keyword for VS 9 (2008) and older.

Can be set to change the visual studio keyword, for example Qt integration works better if this is set to Qt4VSv1.0.

Use the Vs_global_keyword target property to set the keyword for Visual Studio 10 (2010) and newer.

Vs_mobile_extensions_version

Visual Studio Windows 10 Mobile Extensions Version

Specifies the version of the Mobile Extensions that should be included in the target. For example 10.0.10240.0. If the value is not specified, the Mobile Extensions will not be included. To use the same version of the extensions as the Windows 10 SDK that is being used, you can use the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION variable.

Vs_scc_auxpath

Visual Studio Source Code Control Aux Path.

Can be set to change the visual studio source code control auxpath property.

Vs_scc_localpath

Visual Studio Source Code Control Local Path.

Can be set to change the visual studio source code control local path property.

Vs_scc_projectname

Visual Studio Source Code Control Project.

Can be set to change the visual studio source code control project name property.

Vs_scc_provider

Visual Studio Source Code Control Provider.

Can be set to change the visual studio source code control provider property.

Vs_sdk_references

Visual Studio project SDK references. Specify a ;-list of SDK references to be added to a generated Visual Studio project, e.g. Microsoft.AdMediatorWindows81, Version=1.0.

Vs_windows_target_platform_min_version

Visual Studio Windows Target Platform Minimum Version

For Windows 10. Specifies the minimum version of the OS that is being targeted. For example 10.0.10240.0. If the value is not specified, the value of CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION will be used on WindowsStore projects otherwise the target platform minimum version will not be specified for the project.

Vs_winrt_component

Mark a target as a Windows Runtime component for the Visual Studio generator. Compile the target with C++/CX language extensions for Windows Runtime. For SHARED and MODULE libraries, this also defines the _WINRT_DLL preprocessor macro.

NOTE:

Currently this is implemented only by Visual Studio generators. Support may be added to other generators in the future.

Vs_winrt_extensions

Deprecated. Use Vs_winrt_component instead. This property was an experimental partial implementation of that one.

Vs_winrt_references

Visual Studio project Windows Runtime Metadata references

Adds one or more semicolon-delimited WinRT references to a generated Visual Studio project. For example, "Windows;Windows.UI.Core".

Win32_executable

Build an executable with a WinMain entry point on windows.

When this property is set to true the executable when linked on Windows will be created with a WinMain() entry point instead of just main(). This makes it a GUI executable instead of a console application. See the CMAKE_MFC_FLAG variable documentation to configure use of MFC for WinMain executables. This property is initialized by the value of the variable CMAKE_WIN32_EXECUTABLE if it is set when a target is created.

Windows_export_all_symbols

This property is implemented only for MS-compatible tools on Windows.

Enable this boolean property to automatically create a module definition (.def) file with all global symbols found in the input .obj files for a SHARED library (or executable with Enable_exports) on Windows. The module definition file will be passed to the linker causing all symbols to be exported from the .dll. For global data symbols, __declspec(dllimport) must still be used when compiling against the code in the .dll. All other function symbols will be automatically exported and imported by callers. This simplifies porting projects to Windows by reducing the need for explicit dllexport markup, even in C++ classes.

This property is initialized by the value of the CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS variable if it is set when a target is created.

XCODE_ATTRIBUTE_<an-attribute>

Set Xcode target attributes directly.

Tell the Xcode generator to set '<an-attribute>' to a given value in the generated Xcode project. Ignored on other generators.

See the CMAKE_XCODE_ATTRIBUTE_<an-attribute> variable to set attributes on all targets in a directory tree.

Contents of XCODE_ATTRIBUTE_<an-attribute> may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Xctest

This target is a XCTest CFBundle on the Mac.

This property will usually get set via the xctest_add_bundle() macro in FindXCTest module.

If a module library target has this property set to true it will be built as a CFBundle when built on the Mac. It will have the directory structure required for a CFBundle.

This property depends on Bundle to be effective.

Properties on Tests

Attached_files_on_fail

Attach a list of files to a dashboard submission if the test fails.

Same as Attached_files, but these files will only be included if the test does not pass.

Attached_files

Attach a list of files to a dashboard submission.

Set this property to a list of files that will be encoded and submitted to the dashboard as an addition to the test result.

Cost

Set this to a floating point value. Tests in a test set will be run in descending order of cost.

This property describes the cost of a test. You can explicitly set this value; tests with higher Cost values will run first.

Depends

Specifies that this test should only be run after the specified list of tests.

Set this to a list of tests that must finish before this test is run. The results of those tests are not considered, the dependency relationship is purely for order of execution (i.e. it is really just a run after relationship). Consider using test fixtures with setup tests if a dependency with successful completion is required (see Fixtures_required).

Environment

Specify environment variables that should be defined for running a test.

If set to a list of environment variables and values of the form MYVAR=value those environment variables will be defined while running the test. The environment is restored to its previous state after the test is done.

Fail_regular_expression

If the output matches this regular expression the test will fail.

If set, if the output matches one of specified regular expressions, the test will fail. Example:

set_tests_properties(mytest PROPERTIES
  FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
)

Fail_regular_expression expects a list of regular expressions.

Fixtures_cleanup

Specifies a list of fixtures for which the test is to be treated as a cleanup test.

Fixture cleanup tests are ordinary tests with all of the usual test functionality. Setting the Fixtures_cleanup property for a test has two primary effects:

·
CTest will ensure the test executes after all other tests which list any of the fixtures in its Fixtures_required property.
·
If CTest is asked to run only a subset of tests (e.g. using regular expressions or the --rerun-failed option) and the cleanup test is not in the set of tests to run, it will automatically be added if any tests in the set require any fixture listed in Fixtures_cleanup.

A cleanup test can have multiple fixtures listed in its Fixtures_cleanup property. It will execute only once for the whole CTest run, not once for each fixture. A fixture can also have more than one cleanup test defined. If there are multiple cleanup tests for a fixture, projects can control their order with the usual Depends test property if necessary.

A cleanup test is allowed to require other fixtures, but not any fixture listed in its Fixtures_cleanup property. For example:

# Ok: Dependent fixture is different to cleanup
set_tests_properties(cleanupFoo PROPERTIES
  FIXTURES_CLEANUP  Foo
  FIXTURES_REQUIRED Bar
)

# Error: cannot require same fixture as cleanup
set_tests_properties(cleanupFoo PROPERTIES
  FIXTURES_CLEANUP  Foo
  FIXTURES_REQUIRED Foo
)

Cleanup tests will execute even if setup or regular tests for that fixture fail or are skipped.

See Fixtures_required for a more complete discussion of how to use test fixtures.

Fixtures_required

Specifies a list of fixtures the test requires. Fixture names are case sensitive.

Fixtures are a way to attach setup and cleanup tasks to a set of tests. If a test requires a given fixture, then all tests marked as setup tasks for that fixture will be executed first (once for the whole set of tests, not once per test requiring the fixture). After all tests requiring a particular fixture have completed, CTest will ensure all tests marked as cleanup tasks for that fixture are then executed. Tests are marked as setup tasks with the Fixtures_setup property and as cleanup tasks with the Fixtures_cleanup property. If any of a fixture's setup tests fail, all tests listing that fixture in their Fixtures_required property will not be executed. The cleanup tests for the fixture will always be executed, even if some setup tests fail.

When CTest is asked to execute only a subset of tests (e.g. by the use of regular expressions or when run with the --rerun-failed command line option), it will automatically add any setup or cleanup tests for fixtures required by any of the tests that are in the execution set.

Since setup and cleanup tasks are also tests, they can have an ordering specified by the Depends test property just like any other tests. This can be exploited to implement setup or cleanup using multiple tests for a single fixture to modularise setup or cleanup logic.

The concept of a fixture is different to that of a resource specified by Resource_lock, but they may be used together. A fixture defines a set of tests which share setup and cleanup requirements, whereas a resource lock has the effect of ensuring a particular set of tests do not run in parallel. Some situations may need both, such as setting up a database, serialising test access to that database and deleting the database again at the end. For such cases, tests would populate both Fixtures_required and Resource_lock to combine the two behaviours. Names used for Resource_lock have no relationship with names of fixtures, so note that a resource lock does not imply a fixture and vice versa.

Consider the following example which represents a database test scenario similar to that mentioned above:

add_test(NAME testsDone   COMMAND emailResults)
add_test(NAME fooOnly     COMMAND testFoo)
add_test(NAME dbOnly      COMMAND testDb)
add_test(NAME dbWithFoo   COMMAND testDbWithFoo)
add_test(NAME createDB    COMMAND initDB)
add_test(NAME setupUsers  COMMAND userCreation)
add_test(NAME cleanupDB   COMMAND deleteDB)
add_test(NAME cleanupFoo  COMMAND removeFoos)

set_tests_properties(setupUsers PROPERTIES DEPENDS createDB)

set_tests_properties(createDB   PROPERTIES FIXTURES_SETUP    DB)
set_tests_properties(setupUsers PROPERTIES FIXTURES_SETUP    DB)
set_tests_properties(cleanupDB  PROPERTIES FIXTURES_CLEANUP  DB)
set_tests_properties(cleanupFoo PROPERTIES FIXTURES_CLEANUP  Foo)
set_tests_properties(testsDone  PROPERTIES FIXTURES_CLEANUP  "DB;Foo")

set_tests_properties(fooOnly    PROPERTIES FIXTURES_REQUIRED Foo)
set_tests_properties(dbOnly     PROPERTIES FIXTURES_REQUIRED DB)
set_tests_properties(dbWithFoo  PROPERTIES FIXTURES_REQUIRED "DB;Foo")

set_tests_properties(dbOnly dbWithFoo createDB setupUsers cleanupDB
                     PROPERTIES RESOURCE_LOCK DbAccess)

Key points from this example:

·
Two fixtures are defined: DB and Foo. Tests can require a single fixture as fooOnly and dbOnly do, or they can depend on multiple fixtures like dbWithFoo does.
·
A Depends relationship is set up to ensure setupUsers happens after createDB, both of which are setup tests for the DB fixture and will therefore be executed before the dbOnly and dbWithFoo tests automatically.
·
No explicit Depends relationships were needed to make the setup tests run before or the cleanup tests run after the regular tests.
·
The Foo fixture has no setup tests defined, only a single cleanup test.
·
testsDone is a cleanup test for both the DB and Foo fixtures. Therefore, it will only execute once regular tests for both fixtures have finished (i.e. after fooOnly, dbOnly and dbWithFoo). No Depends relationship was specified for testsDone, so it is free to run before, after or concurrently with other cleanup tests for either fixture.
·
The setup and cleanup tests never list the fixtures they are for in their own Fixtures_required property, as that would result in a dependency on themselves and be considered an error.

Fixtures_setup

Specifies a list of fixtures for which the test is to be treated as a setup test.

Fixture setup tests are ordinary tests with all of the usual test functionality. Setting the Fixtures_setup property for a test has two primary effects:

·
CTest will ensure the test executes before any other test which lists the fixture(s) in its Fixtures_required property.
·
If CTest is asked to run only a subset of tests (e.g. using regular expressions or the --rerun-failed option) and the setup test is not in the set of tests to run, it will automatically be added if any tests in the set require any fixture listed in Fixtures_setup.

A setup test can have multiple fixtures listed in its Fixtures_setup property. It will execute only once for the whole CTest run, not once for each fixture. A fixture can also have more than one setup test defined. If there are multiple setup tests for a fixture, projects can control their order with the usual Depends test property if necessary.

A setup test is allowed to require other fixtures, but not any fixture listed in its Fixtures_setup property. For example:

# Ok: dependent fixture is different to setup
set_tests_properties(setupFoo PROPERTIES
  FIXTURES_SETUP    Foo
  FIXTURES_REQUIRED Bar
)

# Error: cannot require same fixture as setup
set_tests_properties(setupFoo PROPERTIES
  FIXTURES_SETUP    Foo
  FIXTURES_REQUIRED Foo
)

If any of a fixture's setup tests fail, none of the tests listing that fixture in its Fixtures_required property will be run. Cleanup tests will, however, still be executed.

See Fixtures_required for a more complete discussion of how to use test fixtures.

Labels

Specify a list of text labels associated with a test.

The list is reported in dashboard submissions.

Measurement

Specify a CDASH measurement and value to be reported for a test.

If set to a name then that name will be reported to CDASH as a named measurement with a value of 1. You may also specify a value by setting Measurement to "measurement=value".

Pass_regular_expression

The output must match this regular expression for the test to pass.

If set, the test output will be checked against the specified regular expressions and at least one of the regular expressions has to match, otherwise the test will fail. Example:

set_tests_properties(mytest PROPERTIES
  PASS_REGULAR_EXPRESSION "TestPassed;All ok"
)

Pass_regular_expression expects a list of regular expressions.

Processors

How many process slots this test requires

Denotes the number of processors that this test will require. This is typically used for MPI tests, and should be used in conjunction with the ctest_test PARALLEL_LEVEL option.

Required_files

List of files required to run the test.

If set to a list of files, the test will not be run unless all of the files exist.

Resource_lock

Specify a list of resources that are locked by this test.

If multiple tests specify the same resource lock, they are guaranteed not to run concurrently.

See also Fixtures_required if the resource requires any setup or cleanup steps.

Run_serial

Do not run this test in parallel with any other test.

Use this option in conjunction with the ctest_test PARALLEL_LEVEL option to specify that this test should not be run in parallel with any other tests.

Skip_return_code

Return code to mark a test as skipped.

Sometimes only a test itself can determine if all requirements for the test are met. If such a situation should not be considered a hard failure a return code of the process can be specified that will mark the test as "Not Run" if it is encountered.

Timeout

How many seconds to allow for this test.

This property if set will limit a test to not take more than the specified number of seconds to run. If it exceeds that the test process will be killed and ctest will move to the next test. This setting takes precedence over CTEST_TEST_TIMEOUT.

Timeout_after_match

Change a test's timeout duration after a matching line is encountered in its output.

Usage

add_test(mytest ...)
set_property(TEST mytest PROPERTY TIMEOUT_AFTER_MATCH "${seconds}" "${regex}")

Description

Allow a test seconds to complete after regex is encountered in its output.

When the test outputs a line that matches regex its start time is reset to the current time and its timeout duration is changed to seconds. Prior to this, the timeout duration is determined by the Timeout property or the CTEST_TEST_TIMEOUT variable if either of these are set.

Timeout_after_match is useful for avoiding spurious timeouts when your test must wait for some system resource to become available before it can execute. Set Timeout to a longer duration that accounts for resource acquisition and use Timeout_after_match to control how long the actual test is allowed to run.

If the required resource can be controlled by CTest you should use Resource_lock instead of Timeout_after_match. This property should be used when only the test itself can determine when its required resources are available.

Will_fail

If set to true, this will invert the pass/fail flag of the test.

This property can be used for tests that are expected to fail and return a non zero return code.

Working_directory

The directory from which the test executable will be called.

If this is not set it is called from the directory the test executable is located in.

Properties on Source Files

Abstract

Is this source file an abstract class.

A property on a source file that indicates if the source file represents a class that is abstract. This only makes sense for languages that have a notion of an abstract class and it is only used by some tools that wrap classes into other languages.

Autouic_options

Additional options for uic when using Autouic

This property holds additional command line options which will be used when uic is executed during the build via Autouic, i.e. it is equivalent to the optional OPTIONS argument of the qt4_wrap_ui() macro.

By default it is empty.

The options set on the .ui source file may override Autouic_options set on the target.

Autorcc_options

Additional options for rcc when using Autorcc

This property holds additional command line options which will be used when rcc is executed during the build via Autorcc, i.e. it is equivalent to the optional OPTIONS argument of the qt4_add_resources() macro.

By default it is empty.

The options set on the .qrc source file may override Autorcc_options set on the target.

Compile_definitions

Preprocessor definitions for compiling a source file.

The Compile_definitions property may be set to a semicolon-separated list of preprocessor definitions using the syntax VAR or VAR=value. Function-style definitions are not supported. CMake will automatically escape the value correctly for the native build system (note that CMake language syntax may require escapes to specify some values). This property may be set on a per-configuration basis using the name COMPILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case name (ex. "COMPILE_DEFINITIONS_DEBUG").

CMake will automatically drop some definitions that are not supported by the native build tool. Xcode does not support per-configuration definitions on source files.

Disclaimer: Most native build tools have poor support for escaping certain values. CMake has work-arounds for many cases but some values may just not be possible to pass correctly. If a value does not seem to be escaped correctly, do not attempt to work-around the problem by adding escape sequences to the value. Your work-around may break in a future version of CMake that has improved escape support. Instead consider defining the macro in a (configured) header file. Then report the limitation. Known limitations include:

#          - broken almost everywhere
;          - broken in VS IDE 7.0 and Borland Makefiles
,          - broken in VS IDE
%          - broken in some cases in NMake
& |        - broken in some cases on MinGW
^ < > \"   - broken in most Make tools on Windows

CMake does not reject these values outright because they do work in some cases. Use with caution.

Compile_flags

Additional flags to be added when compiling this source file.

These flags will be added to the list of compile flags when this source file builds. Use Compile_definitions to pass additional preprocessor definitions.

External_object

If set to true then this is an object file.

If this property is set to true then the source file is really an object file and should not be compiled. It will still be linked into the target though.

Fortran_FORMAT

Set to FIXED or FREE to indicate the Fortran source layout.

This property tells CMake whether a given Fortran source file uses fixed-format or free-format. CMake will pass the corresponding format flag to the compiler. Consider using the target-wide Fortran_FORMAT property if all source files in a target share the same format.

Generated

Is this source file generated as part of the build process.

If a source file is generated by the build process CMake will handle it differently in terms of dependency checking etc. Otherwise having a non-existent source file could create problems.

Header_file_only

Is this source file only a header file.

A property on a source file that indicates if the source file is a header file with no associated implementation. This is set automatically based on the file extension and is used by CMake to determine if certain dependency information should be computed.

Keep_extension

Make the output file have the same extension as the source file.

If this property is set then the file extension of the output file will be the same as that of the source file. Normally the output file extension is computed based on the language of the source file, for example .cxx will go to a .o extension.

Labels

Specify a list of text labels associated with a source file.

This property has meaning only when the source file is listed in a target whose Labels property is also set. No other semantics are currently specified.

Language

What programming language is the file.

A property that can be set to indicate what programming language the source file is. If it is not set the language is determined based on the file extension. Typical values are CXX C etc. Setting this property for a file means this file will be compiled. Do not set this for headers or files that should not be compiled.

Location

The full path to a source file.

A read only property on a SOURCE FILE that contains the full path to the source file.

Macosx_package_location

Place a source file inside a Application Bundle (Macosx_bundle), Core Foundation Bundle (Bundle), or Framework Bundle (Framework). It is applicable for OS X and iOS.

Executable targets with the Macosx_bundle property set are built as OS X or iOS application bundles on Apple platforms. Shared library targets with the Framework property set are built as OS X or iOS frameworks on Apple platforms. Module library targets with the Bundle property set are built as OS X CFBundle bundles on Apple platforms. Source files listed in the target with this property set will be copied to a directory inside the bundle or framework content folder specified by the property value. For OS X Application Bundles the content folder is <name>.app/Contents. For OS X Frameworks the content folder is <name>.framework/Versions/<version>. For OS X CFBundles the content folder is <name>.bundle/Contents (unless the extension is changed). See the Public_header, Private_header, and Resource target properties for specifying files meant for Headers, PrivateHeaders, or Resources directories.

Object_depends

Additional files on which a compiled object file depends.

Specifies a ;-list of full-paths to files on which any object files compiled from this source file depend. On Makefile Generators and the Ninja generator an object file will be recompiled if any of the named files is newer than it. Visual Studio Generators and the Xcode generator cannot implement such compilation dependencies.

This property need not be used to specify the dependency of a source file on a generated header file that it includes. Although the property was originally introduced for this purpose, it is no longer necessary. If the generated header file is created by a custom command in the same target as the source file, the automatic dependency scanning process will recognize the dependency. If the generated header file is created by another target, an inter-target dependency should be created with the add_dependencies() command (if one does not already exist due to linking relationships).

Object_outputs

Additional outputs for a Makefile rule.

Additional outputs created by compilation of this source file. If any of these outputs is missing the object will be recompiled. This is supported only on Makefile generators and will be ignored on other generators.

Symbolic

Is this just a name for a rule.

If Symbolic (boolean) is set to true the build system will be informed that the source file is not actually created on disk but instead used as a symbolic name for a build rule.

Vs_deployment_content

Mark a source file as content for deployment with a Windows Phone or Windows Store application when built with a Visual Studio generator. The value must evaluate to either 1 or 0 and may use generator expressions to make the choice based on the build configuration. The .vcxproj file entry for the source file will be marked either DeploymentContent or ExcludedFromBuild for values 1 and 0, respectively.

Vs_deployment_location

Specifies the deployment location for a content source file with a Windows Phone or Windows Store application when built with a Visual Studio generator. This property is only applicable when using Vs_deployment_content. The value represent the path relative to the app package and applies to all configurations.

Vs_shader_entrypoint

Specifies the name of the entry point for the shader of a .hlsl source file.

Vs_shader_flags

Set additional VS shader flags of a .hlsl source file.

Vs_shader_model

Specifies the shader model of a .hlsl source file. Some shader types can only be used with recent shader models

Vs_shader_type

Set the VS shader type of a .hlsl source file.

Vs_tool_override

Override the default Visual Studio tool that will be applied to the source file with a new tool not based on the extension of the file.

Vs_xaml_type

Mark a XAML source file as a different type than the default Page. The most common usage would be to set the default App.xaml file as ApplicationDefinition.

Wrap_exclude

Exclude this source file from any code wrapping techniques.

Some packages can wrap source files into alternate languages to provide additional functionality. For example, C++ code can be wrapped into Java or Python etc using SWIG etc. If Wrap_exclude is set to true (1 etc) that indicates that this source file should not be wrapped.

Xcode_explicit_file_type

Set the Xcode explicitFileType attribute on its reference to a source file. CMake computes a default based on file extension but can be told explicitly with this property.

See also Xcode_last_known_file_type.

Xcode_file_attributes

Add values to the Xcode ATTRIBUTES setting on its reference to a source file. Among other things, this can be used to set the role on a mig file:

set_source_files_properties(defs.mig
    PROPERTIES
        XCODE_FILE_ATTRIBUTES "Client;Server"
)

Xcode_last_known_file_type

Set the Xcode lastKnownFileType attribute on its reference to a source file. CMake computes a default based on file extension but can be told explicitly with this property.

See also Xcode_explicit_file_type, which is preferred over this property if set.

Properties on Cache Entries

Advanced

True if entry should be hidden by default in GUIs.

This is a boolean value indicating whether the entry is considered interesting only for advanced configuration. The mark_as_advanced() command modifies this property.

Helpstring

Help associated with entry in GUIs.

This string summarizes the purpose of an entry to help users set it through a CMake GUI.

Modified

Internal management property. Do not set or get.

This is an internal cache entry property managed by CMake to track interactive user modification of entries. Ignore it.

Strings

Enumerate possible STRING entry values for GUI selection.

For cache entries with type STRING, this enumerates a set of values. CMake GUIs may use this to provide a selection widget instead of a generic string entry field. This is for convenience only. CMake does not enforce that the value matches one of those listed.

Type

Widget type for entry in GUIs.

Cache entry values are always strings, but CMake GUIs present widgets to help users set values. The GUIs use this property as a hint to determine the widget type. Valid Type values are:

BOOL          = Boolean ON/OFF value.
PATH          = Path to a directory.
FILEPATH      = Path to a file.
STRING        = Generic string value.
INTERNAL      = Do not present in GUI at all.
STATIC        = Value managed by CMake, do not change.
UNINITIALIZED = Type not yet specified.

Generally the Type of a cache entry should be set by the command which creates it (set, option, find_library, etc.).

Value

Value of a cache entry.

This property maps to the actual value of a cache entry. Setting this property always sets the value without checking, so use with care.

Properties on Installed Files

Cpack_desktop_shortcuts

Species a list of shortcut names that should be created on the Desktop for this file.

The property is currently only supported by the WIX generator.

Cpack_never_overwrite

Request that this file not be overwritten on install or reinstall.

The property is currently only supported by the WIX generator.

Cpack_permanent

Request that this file not be removed on uninstall.

The property is currently only supported by the WIX generator.

Cpack_start_menu_shortcuts

Species a list of shortcut names that should be created in the Start Menu for this file.

The property is currently only supported by the WIX generator.

Cpack_startup_shortcuts

Species a list of shortcut names that should be created in the Startup folder for this file.

The property is currently only supported by the WIX generator.

Cpack_wix_acl

Specifies access permissions for files or directories installed by a WiX installer.

The property can contain multiple list entries, each of which has to match the following format.

<user>[@<domain>]=<permission>[,<permission>]

<user> and <domain> specify the windows user and domain for which the <Permission> element should be generated.

<permission> is any of the YesNoType attributes listed here:

http://wixtoolset.org/documentation/manual/v3/xsd/wix/permission.html

Deprecated Properties on Directories

Compile_definitions_<Config>

Ignored. See CMake Policy CMP0043.

Per-configuration preprocessor definitions in a directory.

This is the configuration-specific version of Compile_definitions where <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).

This property will be initialized in each directory by its value in the directory's parent.

Contents of COMPILE_DEFINITIONS_<CONFIG> may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Generator expressions should be preferred instead of setting this property.

Deprecated Properties on Targets

Compile_definitions_<Config>

Ignored. See CMake Policy CMP0043.

Per-configuration preprocessor definitions on a target.

This is the configuration-specific version of Compile_definitions where <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).

Contents of COMPILE_DEFINITIONS_<CONFIG> may use "generator expressions" with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

Generator expressions should be preferred instead of setting this property.

Post_install_script

Deprecated install support.

The Pre_install_script and Post_install_script properties are the old way to specify CMake scripts to run before and after installing a target. They are used only when the old INSTALL_TARGETS command is used to install the target. Use the INSTALL command instead.

Pre_install_script

Deprecated install support.

The Pre_install_script and Post_install_script properties are the old way to specify CMake scripts to run before and after installing a target. They are used only when the old INSTALL_TARGETS command is used to install the target. Use the INSTALL command instead.

Deprecated Properties on Source Files

Compile_definitions_<Config>

Ignored. See CMake Policy CMP0043.

Per-configuration preprocessor definitions on a source file.

This is the configuration-specific version of Compile_definitions. Note that Xcode does not support per-configuration source file flags so this property will be ignored by the Xcode generator.

Referenced By

ccmake(1), cmake(1), cmake-commands(7), cmake-developer(7), cmake-gui(1), cpack(1), ctest(1).

Nov 12, 2016 3.7.0 CMake