mand is rarely necessary. Library locations returned by find_package() and find_library() are absolute paths. Pass these absolute library file paths directly to the tar‐ get_link_libraries() command. CMake will ensure the linker finds them. list List operations. list(LENGTH <list> <output variable>) list(GET <list> <element index> [<element index> ...] <output variable>) list(APPEND <list> <element> [<element> ...]) list(FIND <list> <value> <output variable>) list(INSERT <list> <element_index> <element> [<element> ...]) list(REMOVE_ITEM <list> <value> [<value> ...]) list(REMOVE_AT <list> <index> [<index> ...]) list(REMOVE_DUPLICATES <list>) list(REVERSE <list>) list(SORT <list>) LENGTH will return a given list's length. GET will return list of elements specified by indices from the list. APPEND will append elements to the list. FIND will return the index of the element specified in the list or -1 if it wasn't found. INSERT will insert elements to the list to the specified location. REMOVE_AT and REMOVE_ITEM will remove items from the list. The difference is that REMOVE_ITEM will remove the given items, while REMOVE_AT will remove the items at the given indices. REMOVE_DUPLICATES will remove duplicated items in the list. REVERSE reverses the contents of the list in-place. SORT sorts the list in-place alphabetically. The list subcommands APPEND, INSERT, REMOVE_AT, REMOVE_ITEM, REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list within the current CMake variable scope. Similar to the SET command, the LIST command creates new variable values in the cur‐ rent scope, even if the list itself is actually defined in a par‐ ent scope. To propagate the results of these operations upwards, use SET with PARENT_SCOPE, SET with CACHE INTERNAL, or some other means of value propagation. NOTES: A list in cmake is a ; separated group of strings. To cre‐ ate a list the set command can be used. For example, set(var a b c d e) creates a list with a;b;c;d;e, and set(var "a b c d e") cre‐ ates a string or a list with one item in it. When specifying index values, if <element index> is 0 or greater, it is indexed from the beginning of the list, with 0 representing the first list element. If <element index> is -1 or lesser, it is indexed from the end of the list, with -1 representing the last list element. Be careful when counting with negative indices: they do not start from 0. -0 is equivalent to 0, the first list ele‐ ment. load_cache Load in the values from another project's CMake cache. load_cache(pathToCacheFile READ_WITH_PREFIX prefix entry1...) Read the cache and store the requested entries in variables with their name prefixed with the given prefix. This only reads the values, and does not create entries in the local project's cache. load_cache(pathToCacheFile [EXCLUDE entry1...] [INCLUDE_INTERNALS entry1...]) Load in the values from another cache and store them in the local project's cache as internal entries. This is useful for a project that depends on another project built in a different tree. EXCLUDE option can be used to provide a list of entries to be excluded. INCLUDE_INTERNALS can be used to provide a list of internal entries to be included. Normally, no internal entries are brought in. Use of this form of the command is strongly dis‐ couraged, but it is provided for backward compatibility. load_command Load a command into a running CMake. load_command(COMMAND_NAME <loc1> [loc2 ...]) The given locations are searched for a library whose name is cmCOMMAND_NAME. If found, it is loaded as a module and the com‐ mand is added to the set of available CMake commands. Usually, TRY_COMPILE is used before this command to compile the module. If the command is successfully loaded a variable named CMAKE_LOADED_COMMAND_<COMMAND_NAME> will be set to the full path of the module that was loaded. Oth‐ erwise the variable will not be set. macro Start recording a macro for later invocation as a command. macro(<name> [arg1 [arg2 [arg3 ...]]]) COMMAND1(ARGS ...) COMMAND2(ARGS ...) ... endmacro(<name>) Define a macro named <name> that takes arguments named arg1 arg2 arg3 (...). Commands listed after macro, but before the matching endmacro, are not invoked until the macro is invoked. When it is invoked, the commands recorded in the macro are first modified by replacing formal parameters (${arg1}) with the arguments passed, and then invoked as normal commands. In addition to referencing the formal parameters you can reference the values ${ARGC} which will be set to the number of arguments passed into the function as well as ${ARGV0} ${ARGV1} ${ARGV2} ... which will have the actual values of the arguments passed in. This facilitates creating macros with optional arguments. Additionally ${ARGV} holds the list of all arguments given to the macro and ${ARGN} holds the list of argument past the last expected argument. Note that the parameters to a macro and values such as ARGN are not variables in the usual CMake sense. They are string replacements much like the c preprocessor would do with a macro. If you want true CMake vari‐ ables you should look at the function command. See the cmake_policy() command documentation for the behavior of policies inside macros. mark_as_advanced Mark cmake cached variables as advanced. mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...) Mark the named cached variables as advanced. An advanced variable will not be displayed in any of the cmake GUIs unless the show advanced option is on. If CLEAR is the first argument advanced variables are changed back to unadvanced. If FORCE is the first argument, then the variable is made advanced. If neither FORCE nor CLEAR is specified, new values will be marked as advanced, but if the variable already has an advanced/non-advanced state, it will not be changed. It does nothing in script mode. math Mathematical expressions. math(EXPR <output variable> <math expression>) EXPR evaluates mathematical expression and return result in the output variable. Example mathematical expression is '5 * ( 10 + 13 )'. Supported operators are + - * / % | & ^ ~ << >> * / %. They have the same meaning as they do in c code. message Display a message to the user. message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR] "message to display" ...) The optional keyword determines the type of message: (none) = Important information STATUS = Incidental information WARNING = CMake Warning, continue processing AUTHOR_WARNING = CMake Warning (dev), continue processing SEND_ERROR = CMake Error, continue but skip generation FATAL_ERROR = CMake Error, stop all processing The CMake command-line tool displays STATUS messages on stdout and all other message types on stderr. The CMake GUI displays all messages in its log area. The interactive dialogs (ccmake and CMakeSetup) show STATUS messages one at a time on a status line and other messages in interactive pop-up boxes. CMake Warning and Error message text displays using a simple markup language. Non-indented text is formatted in line-wrapped paragraphs delimited by newlines. Indented text is considered pre-formatted. option Provides an option that the user can optionally select. option(<option_variable> "help string describing option" [initial value]) Provide an option for the user to select as ON or OFF. If no ini‐ tial value is provided, OFF is used. If you have options that depend on the values of other options, see the module help for CMakeDependentOption. project Set a name for the entire project. project(<projectname> [languageName1 languageName2 ... ] ) Sets the name of the project. Additionally this sets the vari‐ ables <projectName>_BINARY_DIR and <projectName>_SOURCE_DIR to the respective values. Optionally you can specify which languages your project supports. Example languages are CXX (i.e. C++), C, Fortran, etc. By default C and CXX are enabled. E.g. if you do not have a C++ compiler, you can disable the check for it by explicitly listing the lan‐ guages you want to support, e.g. C. By using the special language "NONE" all checks for any language can be disabled. If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE, the file pointed to by that variable will be included as the last step of the project command. qt_wrap_cpp Create Qt Wrappers. qt_wrap_cpp(resultingLibraryName DestName SourceLists ...) Produce moc files for all the .h files listed in the SourceLists. The moc files will be added to the library using the DestName source list. qt_wrap_ui Create Qt user interfaces Wrappers. qt_wrap_ui(resultingLibraryName HeadersDestName SourcesDestName SourceLists ...) Produce .h and .cxx files for all the .ui files listed in the SourceLists. The .h files will be added to the library using the HeadersDestNamesource list. The .cxx files will be added to the library using the SourcesDestNamesource list. remove_definitions Removes -D define flags added by add_definitions. remove_definitions(-DFOO -DBAR ...) Removes flags (added by add_definitions) from the compiler command line for sources in the current directory and below. return Return from a file, directory or function. return() Returns from a file, directory or function. When this command is encountered in an included file (via include() or find_package()), it causes processing of the current file to stop and control is returned to the including file. If it is encountered in a file which is not included by another file, e.g. a CMakeLists.txt, con‐ trol is returned to the parent directory if there is one. If return is called in a function, control is returned to the caller of the function. Note that a macro is not a function and does not handle return like a function does. separate_arguments Parse space-separated arguments into a semicolon-separated list. separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>") Parses a unix- or windows-style command-line string "<args>" and stores a semicolon-separated list of the arguments in <var>. The entire command line must be given in one "<args>" argument. The UNIX_COMMAND mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A back‐ slash escapes the next literal character (\" is "); there are no special escapes (\n is just n). The WINDOWS_COMMAND mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the MSDN article "Parsing C Command-Line Arguments" for details. separate_arguments(VARIABLE) Convert the value of VARIABLE to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. set Set a CMake, cache or environment variable to a given value. set(<variable> <value> [[CACHE <type> <docstring> [FORCE]] | PARENT_SCOPE]) Within CMake sets <variable> to the value <value>. <value> is expanded before <variable> is set to it. Normally, set will set a regular CMake variable. If CACHE is present, then the <variable> is put in the cache instead, unless it is already in the cache. See section 'Variable types in CMake' below for details of regular and cache variables and their interactions. If CACHE is used, <type> and <docstring> are required. <type> is used by the CMake GUI to choose a widget with which the user sets a value. The value for <type> may be one of FILEPATH = File chooser dialog. PATH = Directory chooser dialog. STRING = Arbitrary string. BOOL = Boolean ON/OFF checkbox. INTERNAL = No GUI entry (used for persistent variables). If <type> is INTERNAL, the cache variable is marked as internal, and will not be shown to the user in tools like cmake-gui. This is intended for values that should be persisted in the cache, but which users should not normally change. INTERNAL implies FORCE. Normally, set(...CACHE...) creates cache variables, but does not modify them. If FORCE is specified, the value of the cache vari‐ able is set, even if the variable is already in the cache. This should normally be avoided, as it will remove any changes to the cache variable's value by the user. If PARENT_SCOPE is present, the variable will be set in the scope above the current scope. Each new directory or function creates a new scope. This command will set the value of a variable into the parent directory or calling function (whichever is applicable to the case at hand). PARENT_SCOPE cannot be combined with CACHE. If <value> is not specified then the variable is removed instead of set. See also: the unset() command. set(<variable> <value1> ... <valueN>) In this case <variable> is set to a semicolon separated list of values. <variable> can be an environment variable such as: set( ENV{PATH} /home/martink ) in which case the environment variable will be set. *** Variable types in CMake *** In CMake there are two types of variables: normal variables and cache variables. Normal variables are meant for the internal use of the script (just like variables in most programming languages); they are not persisted across CMake runs. Cache variables (unless set with INTERNAL) are mostly intended for configuration settings where the first CMake run determines a suitable default value, which the user can then override, by editing the cache with tools such as ccmake or cmake-gui. Cache variables are stored in the CMake cache file, and are persisted across CMake runs. Both types can exist at the same time with the same name but dif‐ ferent values. When ${FOO} is evaluated, CMake first looks for a normal variable 'FOO' in scope and uses it if set. If and only if no normal variable exists then it falls back to the cache variable 'FOO'. Some examples: The code 'set(FOO "x")' sets the normal variable 'FOO'. It does not touch the cache, but it will hide any existing cache value 'FOO'. The code 'set(FOO "x" CACHE ...)' checks for 'FOO' in the cache, ignoring any normal variable of the same name. If 'FOO' is in the cache then nothing happens to either the normal variable or the cache variable. If 'FOO' is not in the cache, then it is added to the cache. Finally, whenever a cache variable is added or modified by a com‐ mand, CMake also *removes* the normal variable of the same name from the current scope so that an immediately following evaluation of it will expose the newly cached value. Normally projects should avoid using normal and cache variables of the same name, as this interaction can be hard to follow. However, in some situations it can be useful. One example (used by some projects): A project has a subproject in its source tree. The child project has its own CMakeLists.txt, which is included from the parent CMakeLists.txt using add_subdirectory(). Now, if the parent and the child project provide the same option (for example a compiler option), the parent gets the first chance to add a user-editable option to the cache. Normally, the child would then use the same value that the parent uses. However, it may be necessary to hard-code the value for the child project's option while still allowing the user to edit the value used by the parent project. The parent project can achieve this simply by setting a normal variable with the same name as the option in a scope sufficient to hide the option's cache variable from the child completely. The parent has already set the cache variable, so the child's set(...CACHE...) will do nothing, and evaluating the option vari‐ able will use the value from the normal variable, which hides the cache variable. set_directory_properties Set a property of the directory. set_directory_properties(PROPERTIES prop1 value1 prop2 value2) Set a property for the current directory and subdirectories. If the property is not found, CMake will report an error. The proper‐ ties include: INCLUDE_DIRECTORIES, LINK_DIRECTORIES, INCLUDE_REGU‐ LAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES. ADDI‐ TIONAL_MAKE_CLEAN_FILES is a list of files that will be cleaned as a part of "make clean" stage. set_property Set a named property in a given scope. set_property(<GLOBAL | DIRECTORY [dir] | TARGET [target1 [target2 ...]] | SOURCE [src1 [src2 ...]] | TEST [test1 [test2 ...]] | CACHE [entry1 [entry2 ...]]> [APPEND] [APPEND_STRING] PROPERTY <name> [value1 [value2 ...]]) Set one property on zero or more objects of a scope. The first argument determines the scope in which the property is set. It must be one of the following: GLOBAL scope is unique and does not accept a name. DIRECTORY scope defaults to the current directory but another directory (already processed by CMake) may be named by full or relative path. TARGET scope may name zero or more existing targets. SOURCE scope may name zero or more source files. Note that source file properties are visible only to targets added in the same directory (CMakeLists.txt). TEST scope may name zero or more existing tests. CACHE scope must name zero or more cache existing entries. The required PROPERTY option is immediately followed by the name of the property to set. Remaining arguments are used to compose the property value in the form of a semicolon-separated list. If the APPEND option is given the list is appended to any existing property value.If the APPEND_STRING option is given the string is append to any existing property value as string, i.e. it results in a longer string and not a list of strings. set_source_files_properties Source files can have properties that affect how they are built. set_source_files_properties([file1 [file2 [...]]] PROPERTIES prop1 value1 [prop2 value2 [...]]) Set properties associated with source files using a key/value paired list. See properties documentation for those known to CMake. Unrecognized properties are ignored. Source file proper‐ ties are visible only to targets added in the same directory (CMakeLists.txt). set_target_properties Targets can have properties that affect how they are built. set_target_properties(target1 target2 ... PROPERTIES prop1 value1 prop2 value2 ...) Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it later with the GET_TARGET_PROPERTY command. Properties that affect the name of a target's output file are as follows. The PREFIX and SUFFIX properties override the default target name prefix (such as "lib") and suffix (such as ".so"). IMPORT_PREFIX and IMPORT_SUFFIX are the equivalent properties for the import library corresponding to a DLL (for SHARED library tar‐ gets). OUTPUT_NAME sets the real name of a target when it is built and can be used to help create two targets of the same name even though CMake requires unique logical target names. There is also a <CONFIG>_OUTPUT_NAME that can set the output name on a per-configuration basis. <CONFIG>_POSTFIX sets a postfix for the real name of the target when it is built under the configuration named by <CONFIG> (in upper-case, such as "DEBUG_POSTFIX"). The value of this property is initialized when the target is created to the value of the variable CMAKE_<CONFIG>_POSTFIX (except for executable targets because earlier CMake versions which did not use this variable for executables). The LINK_FLAGS property can be used to add extra flags to the link step of a target. LINK_FLAGS_<CONFIG> will add to the configura‐ tion <CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDE‐ BINFO. 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 sub‐ stitutions 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 dllex‐ port/dllimport decorations. The COMPILE_FLAGS property sets addi‐ tional compiler flags used to build sources within the target. It may also be used to pass additional preprocessor definitions. The LINKER_LANGUAGE property is used to change the tool used to link an executable or shared library. The default is set the lan‐ guage to match the files in the library. CXX and C are common val‐ ues for this property. 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 sup‐ ports 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 cre‐ ated if the platform supports symlinks. 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. There are a few properties used to specify RPATH rules. INSTALL_RPATH is a semicolon-separated list specifying the rpath to use in installed targets (for platforms that support it). INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will append directories in the linker search path and outside the project to the INSTALL_RPATH. SKIP_BUILD_RPATH is a boolean speci‐ fying whether to skip automatic generation of an rpath allowing the target to run from the build tree. 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 instal‐ lation. 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. When the target is created the values of the variables CMAKE_INSTALL_RPATH, CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH, CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR are used to initialize these properties. PROJECT_LABEL can be used to change the name of the target in an IDE like visual studio. VS_KEYWORD can be set to change the vis‐ ual studio keyword, for example QT integration works better if this is set to Qt4VSv1.0. VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and VS_SCC_AUXPATH can be set to add support for source control bind‐ ings in a Visual Studio project file. VS_GLOBAL_<variable> can be set to add a Visual Studio project-specific global variable. Qt integration works better if VS_GLOBAL_QtVersion is set to the Qt version FindQt4.cmake found. For example, "4.7.3" 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_TAR‐ GETS command is used to install the target. Use the INSTALL com‐ mand instead. The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual stu‐ dio generators. If it is set to 1 the target will not be part of the default build when you select "Build Solution". set_tests_properties Set a property of the tests. set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2) Set a property for the tests. If the property is not found, CMake will report an error. The properties include: WILL_FAIL: If set to true, this will invert the pass/fail flag of the test. PASS_REGULAR_EXPRESSION: 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: PASS_REGULAR_EXPRESSION "TestPassed;All ok" FAIL_REGULAR_EXPRESSION: If set, if the output will match to one of specified regular expressions, the test will fail. Example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed" Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a list of regular expressions. TIMEOUT: Setting this will limit the test runtime to the number of seconds specified. site_name Set the given variable to the name of the computer. site_name(variable) source_group Define a grouping for sources in the makefile. source_group(name [REGULAR_EXPRESSION regex] [FILES src1 src2 ...]) Defines a group into which sources will be placed in project files. This is mainly used to setup file tabs in Visual Studio. Any file whose name is listed or matches the regular expression will be placed in this group. If a file matches multiple groups, the LAST group that explicitly lists the file will be favored, if any. If no group explicitly lists the file, the LAST group whose regular expression matches the file will be favored. The name of the group may contain backslashes to specify sub‐ groups: source_group(outer\\inner ...) For backwards compatibility, this command is also supports the format: source_group(name regex) string String operations. string(REGEX MATCH <regular_expression> <output variable> <input> [<input>...]) string(REGEX MATCHALL <regular_expression> <output variable> <input> [<input>...]) string(REGEX REPLACE <regular_expression> <replace_expression> <output variable> <input> [<input>...]) string(REPLACE <match_string> <replace_string> <output variable> <input> [<input>...]) string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512> <output variable> <input>) string(COMPARE EQUAL <string1> <string2> <output variable>) string(COMPARE NOTEQUAL <string1> <string2> <output variable>) string(COMPARE LESS <string1> <string2> <output variable>) string(COMPARE GREATER <string1> <string2> <output variable>) string(ASCII <number> [<number> ...] <output variable>) string(CONFIGURE <string1> <output variable> [@ONLY] [ESCAPE_QUOTES]) string(TOUPPER <string1> <output variable>) string(TOLOWER <string1> <output variable>) string(LENGTH <string> <output variable>) string(SUBSTRING <string> <begin> <length> <output variable>) string(STRIP <string> <output variable>) string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>] [RANDOM_SEED <seed>] <output variable>) string(FIND <string> <substring> <output variable> [REVERSE]) REGEX MATCH will match the regular expression once and store the match in the output variable. REGEX MATCHALL will match the regular expression as many times as possible and store the matches in the output variable as a list. REGEX REPLACE will match the regular expression as many times as possible and substitute the replacement expression for the match in the output. The replace expression may refer to paren-delim‐ ited subexpressions of the match using \1, \2, ..., \9. Note that two backslashes (\\1) are required in CMake code to get a back‐ slash through argument parsing. REPLACE will replace all occurrences of match_string in the input with replace_string and store the result in the output. MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a cryp‐ tographic hash of the input string. COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and store true or false in the output variable. ASCII will convert all numbers into corresponding ASCII charac‐ ters. CONFIGURE will transform a string like CONFIGURE_FILE transforms a file. TOUPPER/TOLOWER will convert string to upper/lower characters. LENGTH will return a given string's length. SUBSTRING will return a substring of a given string. If length is -1 the remainder of the string starting at begin will be returned. STRIP will return a substring of a given string with leading and trailing spaces removed. RANDOM will return a random string of given length consisting of characters from the given alphabet. Default length is 5 characters and default alphabet is all numbers and upper and lower case let‐ ters. If an integer RANDOM_SEED is given, its value will be used to seed the random number generator. FIND will return the position where the given substring was found in the supplied string. If the REVERSE flag was used, the command will search for the position of the last occurrence of the speci‐ fied substring. The following characters have special meaning in regular expres‐ sions: ^ Matches at beginning of a line $ Matches at end of a line . Matches any single character [ ] Matches any character(s) inside the brackets [^ ] Matches any character(s) not inside the brackets - Matches any character in range on either side of a dash * Matches preceding pattern zero or more times + Matches preceding pattern one or more times ? Matches preceding pattern zero or once only | Matches a pattern on either side of the | () Saves a matched subexpression, which can be referenced in the REGEX REPLACE operation. Additionally it is saved by all regular expression-related commands, including e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9). target_link_libraries Link a target to given libraries. target_link_libraries(<target> [item1 [item2 [...]]] [[debug|optimized|general] <item>] ...) Specify libraries or flags to use when linking a given target. The named <target> must have been created in the current directory by a command such as add_executable or add_library. The remaining arguments specify library names or flags. Repeated calls for the same <target> append items in the order called. If a library name matches that of another target in the project a dependency will automatically be added in the build system to make sure the library being linked is up-to-date before the target links. Item names starting with '-', but not '-l' or '-frame‐ work', are treated as linker flags. A "debug", "optimized", or "general" keyword indicates that the library immediately following it is to be used only for the corre‐ sponding build configuration. The "debug" keyword corresponds to the Debug configuration (or to configurations named in the DEBUG_CONFIGURATIONS global property if it is set). The "opti‐ mized" keyword corresponds to all other configurations. The "gen‐ eral" keyword corresponds to all configurations, and is purely optional (assumed if omitted). Higher granularity may be achieved for per-configuration rules by creating and linking to IMPORTED library targets. See the IMPORTED mode of the add_library command for more information. Library dependencies are transitive by default. When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too. See the LINK_INTERFACE_LIBRARIES target property to override the set of transitive link dependencies for a target. target_link_libraries(<target> LINK_INTERFACE_LIBRARIES [[debug|optimized|general] <lib>] ...) The LINK_INTERFACE_LIBRARIES mode appends the libraries to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent tar‐ get properties instead of using them for linking. Libraries spec‐ ified as "debug" are appended to the the LINK_INTER‐ FACE_LIBRARIES_DEBUG property (or to the properties corresponding to configurations listed in the DEBUG_CONFIGURATIONS global prop‐ erty if it is set). Libraries specified as "optimized" are appended to the the LINK_INTERFACE_LIBRARIES property. Libraries specified as "general" (or without any keyword) are treated as if specified for both "debug" and "optimized". target_link_libraries(<target> <LINK_PRIVATE|LINK_PUBLIC> [[debug|optimized|general] <lib>] ... [<LINK_PRIVATE|LINK_PUBLIC> [[debug|optimized|general] <lib>] ...]) The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following LINK_PUBLIC are linked to, and are made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets following LINK_PRIVATE are linked to, but are not made part of the LINK_INTERFACE_LIBRARIES. The library dependency graph is normally acyclic (a DAG), but in the case of mutually-dependent STATIC libraries CMake allows the graph to contain cycles (strongly connected components). When another target links to one of the libraries CMake repeats the entire connected component. For example, the code add_library(A STATIC a.c) add_library(B STATIC b.c) target_link_libraries(A B) target_link_libraries(B A) add_executable(main main.c) target_link_libraries(main A) links 'main' to 'A B A B'. (While one repetition is usually suf‐ ficient, pathological object file and symbol arrangements can require more. One may handle such cases by manually repeating the component in the last target_link_libraries call. However, if two archives are really so interdependent they should probably be com‐ bined into a single archive.) try_compile Try building some code. try_compile(RESULT_VAR <bindir> <srcdir> <projectName> [targetName] [CMAKE_FLAGS flags...] [OUTPUT_VARIABLE <var>]) Try building a project. In this form, srcdir should contain a complete CMake project with a CMakeLists.txt file and all sources. The bindir and srcdir will not be deleted after this command is run. Specify targetName to build a specific target instead of the 'all' or 'ALL_BUILD' target. try_compile(RESULT_VAR <bindir> <srcfile> [CMAKE_FLAGS flags...] [COMPILE_DEFINITIONS flags...] [OUTPUT_VARIABLE <var>] [COPY_FILE <fileName>]) Try building a source file into an executable. In this form the user need only supply a source file that defines a 'main'. CMake will create a CMakeLists.txt file to build the source as an exe‐ cutable. Specify COPY_FILE to get a copy of the linked executable at the given fileName. In this version all files in bindir/CMakeFiles/CMakeTmp will be cleaned automatically. For debugging, --debug-trycompile can be passed to cmake to avoid this clean. However, multiple sequential try_compile operations reuse this single output directory. If you use --debug-trycompile, you can only debug one try_compile call at a time. The recommended procedure is to configure with cmake all the way through once, then delete the cache entry associated with the try_compile call of interest, and then re-run cmake again with --debug-trycompile. Some extra flags that can be included are, INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. COMPILE_DEFINITIONS are -Ddefinition that will be passed to the compile line. try_compile creates a CMakeList.txt file on the fly that looks like this: add_definitions( <expanded COMPILE_DEFINITIONS from calling cmake>) include_directories(${INCLUDE_DIRECTORIES}) link_directories(${LINK_DIRECTORIES}) add_executable(cmTryCompileExec sources) target_link_libraries(cmTryCompileExec ${LINK_LIBRARIES}) In both versions of the command, if OUTPUT_VARIABLE is specified, then the output from the build process is stored in the given variable. The success or failure of the try_compile, i.e. TRUE or FALSE respectively, is returned in RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags to the cmake that is run dur‐ ing the build. Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build configuration. try_run Try compiling and then running some code. try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR bindir srcfile [CMAKE_FLAGS <Flags>] [COMPILE_DEFINITIONS <flags>] [COMPILE_OUTPUT_VARIABLE comp] [RUN_OUTPUT_VARIABLE run] [OUTPUT_VARIABLE var] [ARGS <arg1> <arg2>...]) Try compiling a srcfile. Return TRUE or FALSE for success or failure in COMPILE_RESULT_VAR. Then if the compile succeeded, run the executable and return its exit code in RUN_RESULT_VAR. If the executable was built, but failed to run, then RUN_RESULT_VAR will be set to FAILED_TO_RUN. COMPILE_OUTPUT_VARIABLE specifies the variable where the output from the compile step goes. RUN_OUT‐ PUT_VARIABLE specifies the variable where the output from the run‐ ning executable goes. For compatibility reasons OUTPUT_VARIABLE is still supported, which gives you the output from the compile and run step combined. Cross compiling issues When cross compiling, the executable compiled in the first step usually cannot be run on the build host. try_run() checks the CMAKE_CROSSCOMPILING variable to detect whether CMake is in cross‐ compiling mode. If that's the case, it will still try to compile the executable, but it will not try to run the executable. Instead it will create cache variables which must be filled by the user or by presetting them in some CMake script file to the values the executable would have produced if it would have been run on its actual target platform. These variables are RUN_RESULT_VAR (expla‐ nation see above) and if RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an additional cache variable RUN_RESULT_VAR__COM‐ PILE_RESULT_VAR__TRYRUN_OUTPUT.This is intended to hold stdout and stderr from the executable. In order to make cross compiling your project easier, use try_run only if really required. If you use try_run, use RUN_OUTPUT_VARI‐ ABLE (or OUTPUT_VARIABLE) only if really required. Using them will require that when crosscompiling, the cache variables will have to be set manually to the output of the executable. You can also "guard" the calls to try_run with if(CMAKE_CROSSCOMPILING) and provide an easy-to-preset alternative for this case. Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build configuration. unset Unset a variable, cache variable, or environment variable. unset(<variable> [CACHE]) Removes the specified variable causing it to become undefined. If CACHE is present then the variable is removed from the cache instead of the current scope. <variable> can be an environment variable such as: unset(ENV{LD_LIBRARY_PATH}) in which case the variable will be removed from the current envi‐ ronment. variable_watch Watch the CMake variable for change. variable_watch(<variable name> [<command to execute>]) If the specified variable changes, the message will be printed about the variable being changed. If the command is specified, the command will be executed. The command will receive the following arguments: COMMAND(<variable> <access> <value> <current list file> <stack>) while Evaluate a group of commands while a condition is true while(condition) COMMAND1(ARGS ...) COMMAND2(ARGS ...) ... endwhile(condition) All commands between while and the matching endwhile are recorded without being invoked. Once the endwhile is evaluated, the recorded list of commands is invoked as long as the condition is true. The condition is evaluated using the same logic as the if command. PROPERTIES CMake Properties - Properties supported by CMake, the Cross-Platform Makefile Generator. This is the documentation for the properties supported by CMake. Proper‐ ties can have different scopes. They can either be assigned to a source file, a directory, a target or globally to CMake. By modifying the values of properties the behaviour of the build system can be customized. 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 nec‐ essary 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 genera‐ tors 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 pro‐ duce an error and refuse to generate the project. 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 tar‐ get_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. Pack‐ ages 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 Fea‐ tureSummary.cmake. ENABLED_LANGUAGES Read-only property that contains the list of currently enabled languages Set to list of currently enabled languages. FIND_LIBRARY_USE_LIB64_PATHS Whether FIND_LIBRARY should automatically search lib64 directo‐ ries. 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 configura‐ tion. True when building a project inside a TRY_COMPILE or TRY_RUN com‐ mand. 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 vari‐ ables. 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. 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. 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 prefix compiler commands with the given launcher command line. This is intended to allow launchers to intercept build problems with high granularity. Non-Makefile gen‐ erators currently ignore this property. RULE_LAUNCH_CUSTOM Specify a launcher for custom rules. Makefile generators prefix custom commands with the given launcher command line. This is intended to allow launchers to intercept build problems with high granularity. Non-Makefile generators currently ignore this property. RULE_LAUNCH_LINK Specify a launcher for link rules. Makefile generators prefix link and archive commands with the given launcher command line. This is intended to allow launchers to intercept build problems with high granularity. Non-Makefile generators currently ignore this property. 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 com‐ pletes. 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 prop‐ erty. 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_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 embed‐ ded 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 prop‐ erty. __CMAKE_DELETE_CACHE_CHANGE_VARS_ Internal property Used to detect compiler changes, Do not set. 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. CACHE_VARIABLES List of cache variables available in the current directory. This read-only property specifies the list of CMake cache vari‐ ables currently defined. It is intended for debugging purposes. CLEAN_NO_CUSTOM Should the output of custom commands be left. If this is true then the outputs of custom commands for this directory will not be removed during the "make clean" stage. COMPILE_DEFINITIONS Preprocessor definitions for compiling a directory's sources. The COMPILE_DEFINITIONS property may be set to a semicolon-sepa‐ rated 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-configu‐ ration basis using the name COMPILE_DEFINITIONS_<CONFIG> 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. CMake will automatically drop some definitions that are not sup‐ ported by the native build tool. The VS6 IDE does not support definition values with spaces (but NMake does). 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 lim‐ itations include: # - broken almost everywhere ; - broken in VS IDE 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_DEFINITIONS_<CONFIG> Per-configuration preprocessor definitions in a directory. This is the configuration-specific version of COMPILE_DEFINITIONS. This property will be initialized in each directory by its value in the directory's parent. 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 pur‐ poses. Use the COMPILE_DEFINITIONS instead. 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 gen‐ erators. 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 lit‐ eral). 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 direc‐ tory. 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 exists on directo‐ ries and targets. In addition to accepting values from the include_directories command, values may be set directly on any directory or any target using the set_property command. A target gets its initial value for this property from the value of the directory property. A directory gets its initial value from its parent directory if it has one. 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. See also the include_directories command. INCLUDE_REGULAR_EXPRESSION Include file scanning regular expression. This read-only property specifies the regular expression used dur‐ ing dependency scanning to match include files that should be fol‐ lowed. See the include_regular_expression command. 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. INTERPROCEDURAL_OPTIMIZATION_<CONFIG> Per-configuration interprocedural optimization for a directory. This is a per-configuration version of INTERPROCEDURAL_OPTIMIZA‐ TION. If set, this property overrides the generic property for the named configuration. LINK_DIRECTORIES List of linker search directories. This read-only property specifies the list of directories given so far to the link_directories command. It is intended for debugging purposes. 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 com‐ mand 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 cur‐ rently 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 over‐ rides 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 over‐ rides the global property for a directory. RULE_LAUNCH_LINK Specify a launcher for link rules. See the global property of the same name for details. This over‐ rides the global property for a directory. 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 cur‐ rently defined. It is intended for debugging purposes. PROPERTIES ON TARGETS <CONFIG>_OUTPUT_NAME Old per-configuration target file base name. This is a configuration-specific version of OUTPUT_NAME. Use OUT‐ PUT_NAME_<CONFIG> instead. <CONFIG>_POSTFIX Postfix to append to the target file name for configuration <CON‐ FIG>. When building with configuration <CONFIG> the value of this prop‐ erty 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. 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. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified direc‐ tory. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library tar‐ gets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems includ‐ ing Cygwin are DLL platforms. This property is initialized by the value of the variable CMAKE_ARCHIVE_OUTPUT_DIRECTORY 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 ARCHIVE_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 variable CMAKE_AR‐ CHIVE_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is cre‐ ated. 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. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms. ARCHIVE_OUTPUT_NAME_<CONFIG> Per-configuration output name for ARCHIVE target files. This is the configuration-specific version of ARCHIVE_OUTPUT_NAME. 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() macro. Currently Qt4 is supported. When this prop‐ erty is set to TRUE, 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. 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, all header files are parsed for Q_OBJECT macros, and if found, moc is also executed on those files. The resulting moc files, which are not included as shown above in any of the source files are included in a generated <tar‐ getname>_automoc.cpp file, which is compiled as part of the tar‐ get.This property is initialized by the value of the variable CMAKE_AUTOMOC if it is set when a target is created. Additional command line options for moc can be set via the AUTO‐ MOC_MOC_OPTIONS property. By setting the CMAKE_AUTOMOC_RELAXED_MODE variable to TRUE the rules for searching the files which will be processed by moc can be relaxed. See the documentation for this variable for more details. AUTOMOC_MOC_OPTIONS Additional options for moc when using automoc (see the AUTOMOC property) This property is only used if the AUTOMOC property is set to TRUE 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. 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 This target is a CFBundle on the Mac. 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. BUNDLE_EXTENSION The file extension used to name a BUNDLE target on the Mac. The default value is "bundle" - you can also use "plugin" or what‐ ever file extension is required by the host app for your bundle. COMPILE_DEFINITIONS Preprocessor definitions for compiling a target's sources. The COMPILE_DEFINITIONS property may be set to a semicolon-sepa‐ rated 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-configu‐ ration 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 sup‐ ported by the native build tool. The VS6 IDE does not support definition values with spaces (but NMake does). 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 lim‐ itations include: # - broken almost everywhere ; - broken in VS IDE 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_DEFINITIONS_<CONFIG> Per-configuration preprocessor definitions on a target. This is the configuration-specific version of COMPILE_DEFINITIONS. 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. DEBUG_POSTFIX See target property <CONFIG>_POSTFIX. This property is a special case of the more-general <CONFIG>_POST‐ FIX 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 head‐ ers to know whether they are being included from inside their library our outside to properly setup dllexport/dllimport decora‐ tions. ENABLE_EXPORTS Specify whether an executable exports symbols for loadable mod‐ ules. 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 tar‐ get-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 Win‐ dows-based systems including Cygwin are DLL platforms. For non-DLL platforms that require all symbols to be resolved at link time, such as Mac 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. 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 unde‐ fined behavior. 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. 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. FRAMEWORK This target is a framework on the Mac. If a shared library target has this property set to true it will be built as a framework when built on the mac. It will have the directory structure required for a framework and will be suitable to be used with the -framework option 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 cor‐ responding 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 tar‐ get. 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 direc‐ tory corresponding to the target's source directory. If the vari‐ able CMAKE_Fortran_MODULE_DIRECTORY is set when a target is cre‐ ated its value is used to initialize this property. Note that some compilers will automatically search the module out‐ put 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. GENERATOR_FILE_NAME Generator's file for this target. An internal property used by some generators to record the name of project or dsp file associated with this target. 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 for‐ mat (.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 lit‐ eral). 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 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_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 import‐ ing 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 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_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_LINK_DEPENDENT_LIBRARIES Dependent shared libraries of an imported shared library. Shared libraries may be linked to other shared libraries as part of their implementation. On some platforms the linker searches for the dependent libraries of shared libraries they are including in the link. Set this property to the list of dependent shared libraries of an imported library. The list should be disjoint from the list of interface libraries in the IMPORTED_LINK_INTER‐ FACE_LIBRARIES property. On platforms requiring dependent shared libraries to be found at link time CMake uses this list to add appropriate files or paths to the link command line. Ignored for non-imported targets. IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG> <CONFIG>-specific version of IMPORTED_LINK_DEPENDENT_LIBRARIES. Configuration names correspond to those provided by the project from which the target is imported. If set, this property com‐ pletely overrides the generic property for the named configura‐ tion. IMPORTED_LINK_INTERFACE_LANGUAGES Languages compiled into an IMPORTED static library. Set this to the list of languages of source files compiled to pro‐ duce a STATIC IMPORTED library (such as "C" or "CXX"). CMake accounts for these languages when computing how to link a target to the imported library. For example, when a C executable links to an imported C++ static library CMake chooses the C++ linker to satisfy language runtime dependencies of the static library. This property is ignored for targets that are not STATIC libraries. This property is ignored for non-imported targets. IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG> <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LANGUAGES. Configuration names correspond to those provided by the project from which the target is imported. If set, this property com‐ pletely overrides the generic property for the named configura‐ tion. IMPORTED_LINK_INTERFACE_LIBRARIES Transitive link interface of an IMPORTED target. Set this to the list of libraries whose interface is included when an IMPORTED library target is linked to another target. The libraries will be included on the link line for the target. Unlike the LINK_INTERFACE_LIBRARIES property, this property applies to all imported target types, including STATIC libraries. This property is ignored for non-imported targets. IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG> <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LIBRARIES. Configuration names correspond to those provided by the project from which the target is imported. If set, this property com‐ pletely overrides the generic property for the named configura‐ tion. IMPORTED_LINK_INTERFACE_MULTIPLICITY Repetition count for cycles of IMPORTED static libraries. This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets. IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG> <CONFIG>-specific version of IMPORTED_LINK_INTERFACE_MULTIPLICITY. If set, this property completely overrides the generic property for the named configuration. 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 bun‐ dles 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 mod‐ ule. For shared libraries on non-DLL platforms this is the loca‐ tion 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_<CON‐ FIG> properties. 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_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_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_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. 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. 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 pre‐ fix (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 suf‐ fix (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 include_directories command. This property exists on directo‐ ries and targets. In addition to accepting values from the include_directories command, values may be set directly on any directory or any target using the set_property command. A target gets its initial value for this property from the value of the directory property. A directory gets its initial value from its parent directory if it has one. 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. See also the include_directories command. 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. INSTALL_RPATH_USE_LINK_PATH Add paths to linker search and installed rpath. INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will append directories in the linker search path and outside the project to the INSTALL_RPATH. This property is initialized by the value of the variable CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is created. 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. INTERPROCEDURAL_OPTIMIZATION_<CONFIG> Per-configuration interprocedural optimization for a target. This is a per-configuration version of INTERPROCEDURAL_OPTIMIZA‐ TION. If set, this property overrides the generic property for the named configuration. LABELS Specify a list of text labels associated with a target. Target label semantics are currently unspecified. 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. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified direc‐ tory. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library tar‐ gets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems includ‐ ing Cygwin are DLL platforms. This property is initialized by the value of the variable CMAKE_LIBRARY_OUTPUT_DIRECTORY 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 LIBRARY_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 variable CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is created. 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. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms. LIBRARY_OUTPUT_NAME_<CONFIG> Per-configuration output name for LIBRARY target files. This is the configuration-specific version of LIBRARY_OUTPUT_NAME. LINKER_LANGUAGE Specifies language whose compiler will invoke the linker. For executables, shared libraries, and modules, this sets the lan‐ guage 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. LINK_DEPENDS Additional files on which a target binary depends for linking. Specifies a semicolon-separated list of full-paths to files on which the link rule for this target depends. The target binary will be linked if any of the named files is newer than it. This property is ignored by non-Makefile generators. It is intended to specify dependencies on "linker scripts" for custom Makefile link rules. LINK_FLAGS Additional flags to use when linking this target. The LINK_FLAGS property can be used to add extra flags to the link step of a target. LINK_FLAGS_<CONFIG> will add to the configura‐ tion <CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDE‐ BINFO. LINK_FLAGS_<CONFIG> Per-configuration linker flags for a target. This is the configuration-specific version of LINK_FLAGS. LINK_INTERFACE_LIBRARIES List public interface libraries for a shared library or exe‐ cutable. By default linking to a shared library target transitively links to targets with which the library itself was linked. For an exe‐ cutable with exports (see the ENABLE_EXPORTS property) no default transitive link dependencies are used. This property replaces the default transitive link dependencies with an explicit list. When the target is linked into another target the libraries listed (and recursively their link interface libraries) will be provided to the other target also. If the list is empty then no transitive link dependencies will be incorporated when this target is linked into another target even if the default set is non-empty. This property is initialized by the value of the variable CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is cre‐ ated. This property is ignored for STATIC libraries. LINK_INTERFACE_LIBRARIES_<CONFIG> Per-configuration list of public interface libraries for a target. This is the configuration-specific version of LINK_INTER‐ FACE_LIBRARIES. If set, this property completely overrides the generic property for the named configuration. LINK_INTERFACE_MULTIPLICITY Repetition count for STATIC libraries with cyclic dependencies. When linking to a STATIC library target with cyclic dependencies the linker may need to scan more than once through the archives in the strongly connected component of the dependency graph. CMake by default constructs the link line so that the linker will scan through the component at least twice. This property specifies the minimum number of scans if it is larger than the default. CMake uses the largest value specified by any target in a component. LINK_INTERFACE_MULTIPLICITY_<CONFIG> Per-configuration repetition count for cycles of STATIC libraries. This is the configuration-specific version of LINK_INTERFACE_MUL‐ TIPLICITY. If set, this property completely overrides the generic property for the named configuration. LINK_SEARCH_END_STATIC End a link line such that static system libraries are used. Some linkers support switches such as -Bstatic and -Bdynamic to determine whether to use static or shared libraries for -lXXX options. CMake uses these options to set the link type for libraries whose full paths are not known or (in some cases) are in implicit link directories for the platform. By default CMake adds an option at the end of the library list (if necessary) to set the linker search type back to its starting type. This property switches the final linker search type to -Bstatic regardless of how it started. See also LINK_SEARCH_START_STATIC. LINK_SEARCH_START_STATIC Assume the linker looks for static libraries by default. Some linkers support switches such as -Bstatic and -Bdynamic to determine whether to use static or shared libraries for -lXXX options. CMake uses these options to set the link type for libraries whose full paths are not known or (in some cases) are in implicit link directories for the platform. By default the linker search type is assumed to be -Bdynamic at the beginning of the library list. This property switches the assumption to -Bstatic. It is intended for use when linking an executable statically (e.g. with the GNU -static option). See also LINK_SEARCH_END_STATIC. 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 compati‐ bility 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_com‐ mand. 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 com‐ mands. 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>)?" or "(IMPLIB_)?(PREFIX|SUFFIX)". Failure to follow this rule is not diagnosed and leaves the location of the target undefined. 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 tar‐ get 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 configura‐ tions 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>)?" or "(IMPLIB_)?(PREFIX|SUFFIX)". Failure to follow this rule is not diagnosed and leaves the location of the target undefined. MACOSX_BUNDLE Build an executable as an application bundle on Mac OS X. When this property is set to true the executable when built on Mac OS X will be created as an application bundle. This makes it a GUI executable that can be launched from the Finder. See the MACOSX_BUNDLE_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_BUNDLE_INFO_PLIST Specify a custom Info.plist template for a Mac OS X App Bundle. An executable target with MACOSX_BUNDLE enabled will be built as an application bundle on Mac OS X. By default its Info.plist file is created by configuring a template called MacOSXBundle‐ Info.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_INFO_STRING MACOSX_BUNDLE_ICON_FILE MACOSX_BUNDLE_GUI_IDENTIFIER MACOSX_BUNDLE_LONG_VERSION_STRING MACOSX_BUNDLE_BUNDLE_NAME MACOSX_BUNDLE_SHORT_VERSION_STRING MACOSX_BUNDLE_BUNDLE_VERSION MACOSX_BUNDLE_COPYRIGHT 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_FRAMEWORK_INFO_PLIST Specify a custom Info.plist template for a Mac OS X Framework. An library target with FRAMEWORK enabled will be built as a frame‐ work on Mac 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_ICON_FILE MACOSX_FRAMEWORK_IDENTIFIER MACOSX_FRAMEWORK_SHORT_VERSION_STRING MACOSX_FRAMEWORK_BUNDLE_VERSION 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. 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 suit‐ able 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 con‐ figurations are available, then the imported target is considered to be not found. This property is ignored for non-imported tar‐ gets. NO_SONAME Whether to set "soname" when linking a shared library or module. Enable this boolean property if a generated shared library or mod‐ ule should not have "soname" set. Default is to set "soname" on all shared libraries and modules 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. OSX_ARCHITECTURES Target specific architectures for OS X. The OSX_ARCHITECTURES property sets the target binary architecture for targets on OS X. 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 archi‐ tectures on a per-configuration basis. <CONFIG> is an upper-case name (ex: "OSX_ARCHITECTURES_DEBUG"). OSX_ARCHITECTURES_<CONFIG> Per-configuration OS X binary architectures for a target. This property is the configuration-specific version of OSX_ARCHI‐ TECTURES. 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. OUTPUT_NAME_<CONFIG> Per-configuration target file base name. This is the configuration-specific version of OUTPUT_NAME. 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. 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_TAR‐ GETS command is used to install the target. Use the INSTALL com‐ mand instead. 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. 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_TAR‐ GETS command is used to install the target. Use the INSTALL com‐ mand instead. 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 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 PRI‐ VATE_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 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 shared library target. Shared library targets marked with the FRAMEWORK property generate frameworks on OS X and normal shared libraries on other platforms. This property may be set to a list of files to be placed in the Resources directory inside the framework folder. On non-Apple platforms these files may be installed using the RESOURCE option to the install(TARGETS) command. RULE_LAUNCH_COMPILE Specify a launcher for compile rules. See the global property of the same name for details. This over‐ rides 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 over‐ rides the global and directory property for a target. RULE_LAUNCH_LINK Specify a launcher for link rules. See the global property of the same name for details. This over‐ rides the global and directory property for a target. 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. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified direc‐ tory. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library tar‐ gets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems includ‐ ing Cygwin are DLL platforms. This property is initialized by the value of the variable CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created. RUNTIME_OUTPUT_DIRECTORY_<CONFIG> Per-configuration output directory for RUNTIME target files. This is a per-configuration version of RUNTIME_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 variable CMAKE_RUN‐ TIME_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is cre‐ ated. 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. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms. RUNTIME_OUTPUT_NAME_<CONFIG> Per-configuration output name for RUNTIME target files. This is the configuration-specific version of RUNTIME_OUTPUT_NAME. 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. SOURCES Source names specified for a target. Read-only list of sources specified for a target. The names returned are suitable for passing to the set_source_files_proper‐ ties command. 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 sup‐ ports 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. 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. STATIC_LIBRARY_FLAGS Extra flags to use when linking static libraries. Extra flags to use when linking a static library. STATIC_LIBRARY_FLAGS_<CONFIG> Per-configuration flags for creating a static library. This is the configuration-specific version of STATIC_LIBRARY_FLAGS. 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, 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 sup‐ ports 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 cre‐ ated if the platform supports symlinks. 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. VS_DOTNET_REFERENCES Visual Studio managed project .NET references Adds one or more semicolon-delimited .NET references to a gener‐ ated Visual Studio project. For example, "System;System.Win‐ dows.Forms". 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_GLOBAL_KEYWORD Visual Studio project keyword. 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. 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_KEYWORD Visual Studio project keyword. Can be set to change the visual studio keyword, for example QT integration works better if this is set to Qt4VSv1.0. 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_WINRT_EXTENSIONS Visual Studio project C++/CX language extensions for Windows Run‐ time Can be set to enable C++/CX language extensions. VS_WINRT_REFERENCES Visual Studio project Windows Runtime Metadata references Adds one or more semicolon-delimited WinRT references to a gener‐ ated Visual Studio project. For example, "Windows;Win‐ dows.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 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. 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. PROPERTIES ON TESTS ATTACHED_FILES Attach a list of files to a dashboard submission. Set this property to a list of files that will be encoded and sub‐ mitted to the dashboard as an addition to the test result. 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. 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. 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 run‐ ning 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 expres‐ sions, the test will fail.For example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed" 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 reg‐ ular expressions and at least one of the regular expressions has to match, otherwise the test will fail. 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 guaran‐ teed not to run concurrently. 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. 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_TESTING_TIMEOUT. 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 exe‐ cutable 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 rep‐ resents a class that is abstract. This only makes sense for lan‐ guages that have a notion of an abstract class and it is only used by some tools that wrap classes into other languages. COMPILE_DEFINITIONS Preprocessor definitions for compiling a source file. The COMPILE_DEFINITIONS property may be set to a semicolon-sepa‐ rated 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-configu‐ ration 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 sup‐ ported by the native build tool. The VS6 IDE does not support definition values with spaces (but NMake does). 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 lim‐ itations include: # - broken almost everywhere ; - broken in VS IDE 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_DEFINITIONS_<CONFIG> 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. 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 For‐ tran_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 han‐ dle 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 auto‐ matically based on the file extension and is used by CMake to determine is 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 header 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 Mac OS X bundle, CFBundle, or frame‐ work. Executable targets with the MACOSX_BUNDLE property set are built as Mac OS X application bundles on Apple platforms. Shared library targets with the FRAMEWORK property set are built as Mac OS X frameworks on Apple platforms. Module library targets with the BUNDLE property set are built as Mac 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 bundles the content folder is "<name>.app/Contents". For frame‐ works the content folder is "<name>.framework/Versions/<version>". For cfbundles the content folder is "<name>.bundle/Contents" (unless the extension is changed). See the PUBLIC_HEADER, PRI‐ VATE_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 semicolon-separated list of full-paths to files on which any object files compiled from this source file depend. An object file will be recompiled if any of the named files is newer than it. 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 auto‐ matic 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_dependen‐ cies command (if one does not already exist due to linking rela‐ tionships). 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. 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 then this source file should not be wrapped. 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 val‐ ues. 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 wid‐ gets 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. COMPATIBILITY COMMANDS CMake Compatibility Listfile Commands - Obsolete commands supported by CMake for compatibility. This is the documentation for now obsolete listfile commands from previ‐ ous CMake versions, which are still supported for compatibility reasons. You should instead use the newer, faster and shinier new commands. ;-) build_name Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. build_name(variable) Sets the specified variable to a string representing the platform and compiler settings. These values are now available through the CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables. exec_program Deprecated. Use the execute_process() command instead. Run an executable program during the processing of the CMake‐ List.txt file. exec_program(Executable [directory in which to run] [ARGS <arguments to executable>] [OUTPUT_VARIABLE <var>] [RETURN_VALUE <var>]) The executable is run in the optionally specified directory. The executable can include arguments if it is double quoted, but it is better to use the optional ARGS argument to specify arguments to the program. This is because cmake will then be able to escape spaces in the executable path. An optional argument OUTPUT_VARI‐ ABLE specifies a variable in which to store the output. To capture the return value of the execution, provide a RETURN_VALUE. If OUT‐ PUT_VARIABLE is specified, then no output will go to the std‐ out/stderr of the console running cmake. export_library_dependencies Deprecated. Use INSTALL(EXPORT) or EXPORT command. This command generates an old-style library dependencies file. Projects requiring CMake 2.6 or later should not use the command. Use instead the install(EXPORT) command to help export targets from an installation tree and the export() command to export tar‐ gets from a build tree. The old-style library dependencies file does not take into account per-configuration names of libraries or the LINK_INTER‐ FACE_LIBRARIES target property. export_library_dependencies(<file> [APPEND]) Create a file named <file> that can be included into a CMake list‐ file with the INCLUDE command. The file will contain a number of SET commands that will set all the variables needed for library dependency information. This should be the last command in the top level CMakeLists.txt file of the project. If the APPEND option is specified, the SET commands will be appended to the given file instead of replacing it. install_files Deprecated. Use the install(FILES ) command instead. This command has been superceded by the install command. It is provided for compatibility with older CMake code. The FILES form is directly replaced by the FILES form of the install command. The regexp form can be expressed more clearly using the GLOB form of the file command. install_files(<dir> extension file file ...) Create rules to install the listed files with the given extension into the given directory. Only files existing in the current source tree or its corresponding location in the binary tree may be listed. If a file specified already has an extension, that extension will be removed first. This is useful for providing lists of source files such as foo.cxx when you want the corre‐ sponding foo.h to be installed. A typical extension is '.h'. install_files(<dir> regexp) Any files in the current source directory that match the regular expression will be installed. install_files(<dir> FILES file file ...) Any files listed after the FILES keyword will be installed explic‐ itly from the names given. Full paths are allowed in this form. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. install_programs Deprecated. Use the install(PROGRAMS ) command instead. This command has been superceded by the install command. It is provided for compatibility with older CMake code. The FILES form is directly replaced by the PROGRAMS form of the INSTALL command. The regexp form can be expressed more clearly using the GLOB form of the FILE command. install_programs(<dir> file1 file2 [file3 ...]) install_programs(<dir> FILES file1 [file2 ...]) Create rules to install the listed programs into the given direc‐ tory. Use the FILES argument to guarantee that the file list ver‐ sion of the command will be used even when there is only one argu‐ ment. install_programs(<dir> regexp) In the second form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by cmake, such as shell scripts. See the TARGETS form of the INSTALL command to create installation rules for targets built by cmake. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. install_targets Deprecated. Use the install(TARGETS ) command instead. This command has been superceded by the install command. It is provided for compatibility with older CMake code. install_targets(<dir> [RUNTIME_DIRECTORY dir] target target) Create rules to install the listed targets into the given direc‐ tory. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. If RUN‐ TIME_DIRECTORY is specified, then on systems with special runtime files (Windows DLL), the files will be copied to that directory. link_libraries Deprecated. Use the target_link_libraries() command instead. Link libraries to all targets added later. link_libraries(library1 <debug | optimized> library2 ...) Specify a list of libraries to be linked into any following tar‐ gets (typically added with the add_executable or add_library calls). This command is passed down to all subdirectories. The debug and optimized strings may be used to indicate that the next library listed is to be used only for that specific type of build. make_directory Deprecated. Use the file(MAKE_DIRECTORY ) command instead. make_directory(directory) Creates the specified directory. Full paths should be given. Any parent directories that do not exist will also be created. Use with care. output_required_files Deprecated. Approximate C preprocessor dependency scanning. This command exists only because ancient CMake versions provided it. CMake handles preprocessor dependency scanning automatically using a more advanced scanner. output_required_files(srcfile outputfile) Outputs a list of all the source files that are required by the specified srcfile. This list is written into outputfile. This is similar to writing out the dependencies for srcfile except that it jumps from .h files into .cxx, .c and .cpp files if possible. remove Deprecated. Use the list(REMOVE_ITEM ) command instead. remove(VAR VALUE VALUE ...) Removes VALUE from the variable VAR. This is typically used to remove entries from a vector (e.g. semicolon separated list). VALUE is expanded. subdir_depends Deprecated. Does nothing. subdir_depends(subdir dep1 dep2 ...) Does not do anything. This command used to help projects order parallel builds correctly. This functionality is now automatic. subdirs Deprecated. Use the add_subdirectory() command instead. Add a list of subdirectories to the build. subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...] [PREORDER] ) Add a list of subdirectories to the build. The add_subdirectory command should be used instead of subdirs although subdirs will still work. This will cause any CMakeLists.txt files in the sub directories to be processed by CMake. Any directories after the PREORDER flag are traversed first by makefile builds, the PREORDER flag has no effect on IDE projects. Any directories after the EXCLUDE_FROM_ALL marker will not be included in the top level makefile or project file. This is useful for having CMake create makefiles or projects for a set of examples in a project. You would want CMake to generate makefiles or project files for all the examples at the same time, but you would not want them to show up in the top level project or be built each time make is run from the top. use_mangled_mesa Copy mesa headers for use in combination with system GL. use_mangled_mesa(PATH_TO_MESA OUTPUT_DIRECTORY) The path to mesa includes, should contain gl_mangle.h. The mesa headers are copied to the specified output directory. This allows mangled mesa headers to override other GL headers by being added to the include directory path earlier. utility_source Specify the source tree of a third-party utility. utility_source(cache_entry executable_name path_to_source [file1 file2 ...]) When a third-party utility's source is included in the distribu‐ tion, this command specifies its location and name. The cache entry will not be set unless the path_to_source and all listed files exist. It is assumed that the source tree of the utility will have been built before it is needed. When cross compiling CMake will print a warning if a util‐ ity_source() command is executed, because in many cases it is used to build an executable which is executed later on. This doesn't work when cross compiling, since the executable can run only on their target platform. So in this case the cache entry has to be adjusted manually so it points to an executable which is runnable on the build host. variable_requires Deprecated. Use the if() command instead. Assert satisfaction of an option's required variables. variable_requires(TEST_VARIABLE RESULT_VARIABLE REQUIRED_VARIABLE1 REQUIRED_VARIABLE2 ...) The first argument (TEST_VARIABLE) is the name of the variable to be tested, if that variable is false nothing else is done. If TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE) is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set to NOTFOUND to avoid an error. If any are not true, an error is reported. write_file Deprecated. Use the file(WRITE ) command instead. write_file(filename "message to write"... [APPEND]) The first argument is the file name, the rest of the arguments are messages to write. If the argument APPEND is specified, then the message will be appended. NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as this one but add some more functionality. NOTE 2: When using write_file the produced file cannot be used as an input to CMake (CONFIGURE_FILE, source file ...) because it will lead to an infinite loop. Use configure_file if you want to generate input files to CMake. MODULES The following modules are provided with CMake. They can be used with INCLUDE(ModuleName). CMake Modules - Modules coming with CMake, the Cross-Platform Makefile Generator. This is the documentation for the modules and scripts coming with CMake. Using these modules you can check the computer system for installed soft‐ ware packages, features of the compiler and the existance of headers to name just a few. AddFileDependencies ADD_FILE_DEPENDENCIES(source_file depend_files...) Adds the given files as dependencies to source_file BundleUtilities Functions to help assemble a standalone bundle application. A collection of CMake utility functions useful for dealing with .app bundles on the Mac and bundle-like directories on any OS. The following functions are provided by this module: fixup_bundle copy_and_fixup_bundle verify_app get_bundle_main_executable get_dotapp_dir get_bundle_and_executable get_bundle_all_executables get_item_key clear_bundle_keys set_bundle_key_values get_bundle_keys copy_resolved_item_into_bundle copy_resolved_framework_into_bundle fixup_bundle_item verify_bundle_prerequisites verify_bundle_symlinks Requires CMake 2.6 or greater because it uses function, break and PARENT_SCOPE. Also depends on GetPrerequisites.cmake. FIXUP_BUNDLE(<app> <libs> <dirs>) Fix up a bundle in-place and make it standalone, such that it can be drag-n-drop copied to another machine and run on that machine as long as all of the system libraries are compatible. If you pass plugins to fixup_bundle as the libs parameter, you should install them or copy them into the bundle before calling fixup_bundle. The "libs" parameter is a list of libraries that must be fixed up, but that cannot be determined by otool output analysis. (i.e., plugins) Gather all the keys for all the executables and libraries in a bundle, and then, for each key, copy each prerequisite into the bundle. Then fix each one up according to its own list of prereq‐ uisites. Then clear all the keys and call verify_app on the final bundle to ensure that it is truly standalone. COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>) Makes a copy of the bundle <src> at location <dst> and then fixes up the new copied bundle in-place at <dst>... VERIFY_APP(<app>) Verifies that an application <app> appears valid based on running analysis tools on it. Calls "message(FATAL_ERROR" if the applica‐ tion is not verified. GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>) The result will be the full path name of the bundle's main exe‐ cutable file or an "error:" prefixed string if it could not be determined. GET_DOTAPP_DIR(<exe> <dotapp_dir_var>) Returns the nearest parent dir whose name ends with ".app" given the full path to an executable. If there is no such parent dir, then simply return the dir containing the executable. The returned directory may or may not exist. GET_BUNDLE_AND_EXECUTABLE(<app> <bundle_var> <executable_var> <valid_var>) Takes either a ".app" directory name or the name of an executable nested inside a ".app" directory and returns the path to the ".app" directory in <bundle_var> and the path to its main exe‐ cutable in <executable_var> GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>) Scans the given bundle recursively for all executable files and accumulates them into a variable. GET_ITEM_KEY(<item> <key_var>) Given a file (item) name, generate a key that should be unique considering the set of libraries that need copying or fixing up to make a bundle standalone. This is essentially the file name including extension with "." replaced by "_" This key is used as a prefix for CMake variables so that we can associate a set of variables with a given item based on its key. CLEAR_BUNDLE_KEYS(<keys_var>) Loop over the list of keys, clearing all the variables associated with each key. After the loop, clear the list of keys itself. Caller of get_bundle_keys should call clear_bundle_keys when done with list of keys. SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs> <copyflag>) Add a key to the list (if necessary) for the given item. If added, also set all the variables associated with that key. GET_BUNDLE_KEYS(<app> <libs> <dirs> <keys_var>) Loop over all the executable and library files within the bundle (and given as extra <libs>) and accumulate a list of keys repre‐ senting them. Set values associated with each key such that we can loop over all of them and copy prerequisite libs into the bundle and then do appropriate install_name_tool fixups. COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) Copy a resolved item into the bundle if necessary. Copy is not necessary if the resolved_item is "the same as" the resolved_embedded_item. COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) Copy a resolved framework into the bundle if necessary. Copy is not necessary if the resolved_item is "the same as" the resolved_embedded_item. By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the frame‐ work dylib itself plus the framework Resources directory. FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>) Get the direct/non-system prerequisites of the resolved embedd