Use this module to push data needed for testing an Android device behavior onto a connected Android device. The module will accept files and libraries as well as separate destinations for each. It will create a test that loads the files into a device object store and link to them from the specified destination. The files are only uploaded if they are not already in the object store.

The android_add_test_data function is used to copy files and libraries needed to run project-specific tests. On the host operating system, this is done at build time. For on-device testing, the files are loaded onto the device by the manufactured test at run time.

This function accepts the following named parameters:

FILES <files>...

zero or more files needed for testing

LIBS <libs>...

zero or more libraries needed for testing

FILES_DEST <device-dir>

absolute path where the data files are expected to be

LIBS_DEST <device-dir>

absolute path where the libraries are expected to be

DEVICE_OBJECT_STORE <device-dir>

absolute path to the location where the data is stored on-device

DEVICE_TEST_DIR <device-dir>

absolute path to the root directory of the on-device test location

NO_LINK_REGEX <strings>...

list of regex strings matching the names of files that should be copied from the object store to the testing directory

Requires CMake 2.6 or greater because it uses function, break and PARENT_SCOPE. Also depends on GetPrerequisites.cmake.

DO NOT USE THESE Functions AT CONFIGURE TIME (from CMakeLists.txt)! Instead, invoke them from an install(CODE) or install(SCRIPT) rule.

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 prerequisites.

Then clear all the keys and call verify_app on the final bundle to ensure that it is truly standalone.

As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM “vcredist_x86.exe;vcredist_x64.exe”)

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 application is not verified.

As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM “vcredist_x86.exe;vcredist_x64.exe”)

GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>)

The result will be the full path name of the bundle’s main executable 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.

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 executable 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.

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 representing 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.

As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM “vcredist_x86.exe;vcredist_x64.exe”)

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 framework dylib itself plus the framework Resources directory.

FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>)

Get the direct/non-system prerequisites of the resolved embedded item. For each prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to an “@executable_path” style reference.)

This function requires that the resolved_embedded_item be “inside” the bundle already. In other words, 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)

Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value.

Accumulate changes in a local variable and make one call to install_name_tool at the end of the function with all the changes at once.

If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be marked writable before install_name_tool tries to change them.

VERIFY_BUNDLE_PREREQUISITES(<bundle> <result_var> <info_var>)

Verifies that the sum of all prerequisites of all files inside the bundle are contained within the bundle or are “system” libraries, presumed to exist everywhere.

As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM “vcredist_x86.exe;vcredist_x64.exe”)

VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>)

Verifies that any symlinks found in the bundle point to other files that are already also in the bundle… Anything that points to an external file causes this function to fail the verification.

Check that the <flag> is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named <var>.

This command temporarily sets the CMAKE_REQUIRED_DEFINITIONS variable and calls the check_c_source_compiles macro from the CheckCSourceCompiles module. See documentation of that module for a listing of variables that can otherwise modify the build.

A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module.

NOTE:

Since the try_compile() command forwards flags from variables like CMAKE_C_FLAGS, unknown flags in such variables may cause a false negative for this check.

Check that the source supplied in code can be compiled as a C source file and linked as an executable (so it must contain at least a main() function). The result will be stored in the internal cache variable specified by resultVar, with a boolean true value for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions.

The underlying check is performed by the try_compile() command. The compile and link commands can be influenced by setting any of the following variables prior to calling check_c_source_compiles():

CMAKE_REQUIRED_FLAGS

Additional flags to pass to the compiler. Note that the contents of CMAKE_C_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

CMAKE_REQUIRED_DEFINITIONS

A ;-list of compiler definitions of the form -DFOO or -DFOO=bar. A definition for the name specified by resultVar will also be added automatically.

CMAKE_REQUIRED_INCLUDES

A ;-list of header search paths to pass to the compiler. These will be the only header search paths used by try_compile(), i.e. the contents of the INCLUDE_DIRECTORIES directory property will be ignored.

CMAKE_REQUIRED_LIBRARIES

A ;-list of libraries to add to the link command. These can be the name of system libraries or they can be Imported Targets (see try_compile() for further details).

CMAKE_REQUIRED_QUIET

If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed.

The check is only performed once, with the result cached in the variable named by resultVar. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the code changes. In order to force the check to be re-evaluated, the variable named by resultVar must be manually removed from the cache.

Check if given C source compiles and links into an executable and can subsequently be run.

check_c_source_runs

check_c_source_runs(code resultVar)

Check that the source supplied in code can be compiled as a C source file, linked as an executable and then run. The code must contain at least a main() function. If the code could be built and run successfully, the internal cache variable specified by resultVar will be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message).

The underlying check is performed by the try_run() command. The compile and link commands can be influenced by setting any of the following variables prior to calling check_c_source_runs():

CMAKE_REQUIRED_FLAGS

Additional flags to pass to the compiler. Note that the contents of CMAKE_C_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

CMAKE_REQUIRED_DEFINITIONS

A ;-list of compiler definitions of the form -DFOO or -DFOO=bar. A definition for the name specified by resultVar will also be added automatically.

CMAKE_REQUIRED_INCLUDES

A ;-list of header search paths to pass to the compiler. These will be the only header search paths used by try_run(), i.e. the contents of the INCLUDE_DIRECTORIES directory property will be ignored.

CMAKE_REQUIRED_LIBRARIES

A ;-list of libraries to add to the link command. These can be the name of system libraries or they can be Imported Targets (see try_run() for further details).

CMAKE_REQUIRED_QUIET

If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed.

The check is only performed once, with the result cached in the variable named by resultVar. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the code changes. In order to force the check to be re-evaluated, the variable named by resultVar must be manually removed from the cache.

Check that the <flag> is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named <var>.

This command temporarily sets the CMAKE_REQUIRED_DEFINITIONS variable and calls the check_cxx_source_compiles macro from the CheckCXXSourceCompiles module. See documentation of that module for a listing of variables that can otherwise modify the build.

A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module.

NOTE:

Since the try_compile() command forwards flags from variables like CMAKE_CXX_FLAGS, unknown flags in such variables may cause a false negative for this check.

Check that the source supplied in code can be compiled as a C++ source file and linked as an executable (so it must contain at least a main() function). The result will be stored in the internal cache variable specified by resultVar, with a boolean true value for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions.

The underlying check is performed by the try_compile() command. The compile and link commands can be influenced by setting any of the following variables prior to calling check_cxx_source_compiles():

CMAKE_REQUIRED_FLAGS

Additional flags to pass to the compiler. Note that the contents of CMAKE_CXX_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

CMAKE_REQUIRED_DEFINITIONS

A ;-list of compiler definitions of the form -DFOO or -DFOO=bar. A definition for the name specified by resultVar will also be added automatically.

CMAKE_REQUIRED_INCLUDES

A ;-list of header search paths to pass to the compiler. These will be the only header search paths used by try_compile(), i.e. the contents of the INCLUDE_DIRECTORIES directory property will be ignored.

CMAKE_REQUIRED_LIBRARIES

A ;-list of libraries to add to the link command. These can be the name of system libraries or they can be Imported Targets (see try_compile() for further details).

CMAKE_REQUIRED_QUIET

If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed.

The check is only performed once, with the result cached in the variable named by resultVar. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the code changes. In order to force the check to be re-evaluated, the variable named by resultVar must be manually removed from the cache.

Check if given C++ source compiles and links into an executable and can subsequently be run.

check_cxx_source_runs

check_cxx_source_runs(code resultVar)

Check that the source supplied in code can be compiled as a C++ source file, linked as an executable and then run. The code must contain at least a main() function. If the code could be built and run successfully, the internal cache variable specified by resultVar will be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message).

The underlying check is performed by the try_run() command. The compile and link commands can be influenced by setting any of the following variables prior to calling check_cxx_source_runs():

CMAKE_REQUIRED_FLAGS

Additional flags to pass to the compiler. Note that the contents of CMAKE_CXX_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

CMAKE_REQUIRED_DEFINITIONS

A ;-list of compiler definitions of the form -DFOO or -DFOO=bar. A definition for the name specified by resultVar will also be added automatically.

CMAKE_REQUIRED_INCLUDES

A ;-list of header search paths to pass to the compiler. These will be the only header search paths used by try_run(), i.e. the contents of the INCLUDE_DIRECTORIES directory property will be ignored.

CMAKE_REQUIRED_LIBRARIES

A ;-list of libraries to add to the link command. These can be the name of system libraries or they can be Imported Targets (see try_run() for further details).

CMAKE_REQUIRED_QUIET

If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed.

The check is only performed once, with the result cached in the variable named by resultVar. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the code changes. In order to force the check to be re-evaluated, the variable named by resultVar must be manually removed from the cache.

Check that the <symbol> is available after including given header <files> and store the result in a <variable>. Specify the list of files in one argument as a semicolon-separated list. CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as opposed to CHECK_SYMBOL_EXISTS(), which works only for C.

If the header files define the symbol as a macro it is considered available and assumed to work. If the header files declare the symbol as a function or variable then the symbol must also be available for linking. If the symbol is a type or enum value it will not be recognized (consider using CheckTypeSize or CheckCSourceCompiles).

The following variables may be set before calling this macro to modify the way the check is run:

Check that the <flag> is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named <var>.

This command temporarily sets the CMAKE_REQUIRED_DEFINITIONS variable and calls the check_fortran_source_compiles macro from the CheckFortranSourceCompiles module. See documentation of that module for a listing of variables that can otherwise modify the build.

A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module.

NOTE:

Since the try_compile() command forwards flags from variables like CMAKE_Fortran_FLAGS, unknown flags in such variables may cause a false negative for this check.

Check that the source supplied in code can be compiled as a Fortran source file and linked as an executable (so it must contain at least a PROGRAM entry point). The result will be stored in the internal cache variable specified by resultVar, with a boolean true value for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions.

By default, the test source file will be given a .F file extension. The SRC_EXT option can be used to override this with .ext instead.

The underlying check is performed by the try_compile() command. The compile and link commands can be influenced by setting any of the following variables prior to calling check_fortran_source_compiles():

CMAKE_REQUIRED_FLAGS

Additional flags to pass to the compiler. Note that the contents of CMAKE_Fortran_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

CMAKE_REQUIRED_DEFINITIONS

A ;-list of compiler definitions of the form -DFOO or -DFOO=bar. A definition for the name specified by resultVar will also be added automatically.

CMAKE_REQUIRED_INCLUDES

A ;-list of header search paths to pass to the compiler. These will be the only header search paths used by try_compile(), i.e. the contents of the INCLUDE_DIRECTORIES directory property will be ignored.

CMAKE_REQUIRED_LIBRARIES

A ;-list of libraries to add to the link command. These can be the name of system libraries or they can be Imported Targets (see try_compile() for further details).

CMAKE_REQUIRED_QUIET

If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed.

The check is only performed once, with the result cached in the variable named by resultVar. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the code changes. In order to force the check to be re-evaluated, the variable named by resultVar must be manually removed from the cache.

Check if the given <include> file may be included in a CXX source file and store the result in an internal cache entry named <variable>. The optional third argument may be used to add compilation flags to the check (or use CMAKE_REQUIRED_FLAGS below).

The following variables may be set before calling this macro to modify the way the check is run:

CMAKE_REQUIRED_FLAGS

string of compile command line flags

CMAKE_REQUIRED_DEFINITIONS

list of macros to define (-DFOO=bar)

CMAKE_REQUIRED_INCLUDES

list of include directories

CMAKE_REQUIRED_LIBRARIES

A list of libraries to link. See policy CMP0075.

CMAKE_REQUIRED_QUIET

execute quietly without messages

See modules CheckIncludeFile and CheckIncludeFiles to check for one or more C headers.

Check if the given <include> file may be included in a C source file and store the result in an internal cache entry named <variable>. The optional third argument may be used to add compilation flags to the check (or use CMAKE_REQUIRED_FLAGS below).

The following variables may be set before calling this macro to modify the way the check is run:

CMAKE_REQUIRED_FLAGS

string of compile command line flags

CMAKE_REQUIRED_DEFINITIONS

list of macros to define (-DFOO=bar)

CMAKE_REQUIRED_INCLUDES

list of include directories

CMAKE_REQUIRED_LIBRARIES

A list of libraries to link. See policy CMP0075.

CMAKE_REQUIRED_QUIET

execute quietly without messages

See the CheckIncludeFiles module to check for multiple headers at once. See the CheckIncludeFileCXX module to check for headers using the CXX language.

Provides a macro to check if a list of one or more header files can be included together.

CHECK_INCLUDE_FILES

CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>])

Check if the given <includes> list may be included together in a source file and store the result in an internal cache entry named <variable>. Specify the <includes> argument as a ;-list of header file names.

If LANGUAGE is set, the specified compiler will be used to perform the check. Acceptable values are C and CXX. If not set, the C compiler will be used if enabled. If the C compiler is not enabled, the C++ compiler will be used if enabled.

The following variables may be set before calling this macro to modify the way the check is run:

CMAKE_REQUIRED_FLAGS

string of compile command line flags

CMAKE_REQUIRED_DEFINITIONS

list of macros to define (-DFOO=bar)

CMAKE_REQUIRED_INCLUDES

list of include directories

CMAKE_REQUIRED_LIBRARIES

A list of libraries to link. See policy CMP0075.

CMAKE_REQUIRED_QUIET

execute quietly without messages

See modules CheckIncludeFile and CheckIncludeFileCXX to check for a single header file in C or CXX languages.

where <lang> is a language that may be passed to enable_language() such as “Fortran”. If CMAKE_<lang>_COMPILER is already defined the check does nothing. Otherwise it tries enabling the language in a test project. The result is cached in CMAKE_<lang>_COMPILER as the compiler that was found, or NOTFOUND if the language cannot be enabled.

LIBRARY - the name of the library you are looking for
FUNCTION - the name of the function
LOCATION - location where the library should be found
VARIABLE - variable to store the result
Will be created as an internal cache variable.

The following variables may be set before calling this macro to modify the way the check is run:

FUNCTION - The name of the function (used to check if prototype exists)
PROTOTYPE- The prototype to check.
RETURN - The return value of the function.
HEADER - The header files required.
VARIABLE - The variable to store the result.
Will be created as an internal cache variable.

<struct> - the name of the struct or class you are interested in
<member> - the member which existence you want to check
<header> - the header(s) where the prototype should be declared
<variable> - variable to store the result
<language> - the compiler to use (C or CXX)

The following variables may be set before calling this macro to modify the way the check is run:

Provides a macro to check if a symbol exists as a function, variable, or macro in C.

check_symbol_exists

check_symbol_exists(<symbol> <files> <variable>)

Check that the <symbol> is available after including given header <files> and store the result in a <variable>. Specify the list of files in one argument as a semicolon-separated list. <variable> will be created as an internal cache variable.

If the header files define the symbol as a macro it is considered available and assumed to work. If the header files declare the symbol as a function or variable then the symbol must also be available for linking (so intrinsics may not be detected). If the symbol is a type, enum value, or intrinsic it will not be recognized (consider using CheckTypeSize or CheckCSourceCompiles). If the check needs to be done in C++, consider using CheckCXXSymbolExists instead.

The following variables may be set before calling this macro to modify the way the check is run:

Both HAVE_${VARIABLE} and ${VARIABLE} will be created as internal cache variables.

Furthermore, the variable “${VARIABLE}_CODE” holds C preprocessor code to define the macro “${VARIABLE}” to the size of the type, or leave the macro undefined if the type does not exist.

The variable “${VARIABLE}” may be “0” when CMAKE_OSX_ARCHITECTURES has multiple architectures for building OS X universal binaries. This indicates that the type size varies across architectures. In this case “${VARIABLE}_CODE” contains C preprocessor tests mapping from each architecture macro to the corresponding type size. The list of architecture macros is stored in “${VARIABLE}_KEYS”, and the value for each key is stored in “${VARIABLE}-${KEY}”.

If the BUILTIN_TYPES_ONLY option is not given, the macro checks for headers <sys/types.h>, <stdint.h>, and <stddef.h>, and saves results in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type size check automatically includes the available headers, thus supporting checks of types defined in the headers.

If LANGUAGE is set, the specified compiler will be used to perform the check. Acceptable values are C and CXX

Despite the name of the macro you may use it to check the size of more complex expressions, too. To check e.g. for the size of a struct member you can do something like this:

check_type_size("((struct something*)0)->member" SIZEOF_MEMBER)

The following variables may be set before calling this macro to modify the way the check is run:

The ‘add_fortran_subdirectory’ function adds a subdirectory to a project that contains a fortran only sub-project. The module will check the current compiler and see if it can support fortran. If no fortran compiler is found and the compiler is MSVC, then this module will find the MinGW gfortran. It will then use an external project to build with the MinGW tools. It will also create imported targets for the libraries created. This will only work if the fortran code is built into a dll, so BUILD_SHARED_LIBS is turned on in the project. In addition the CMAKE_GNUtoMS option is set to on, so that the MS .lib files are created. Usage is as follows:

This macro presents an option to the user only if a set of other conditions are true. When the option is not presented a default value is used, but any value set by the user is preserved for when the option is presented again. Example invocation:

If USE_BAR is true and USE_ZOT is false, this provides an option called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to OFF. If the status of USE_BAR or USE_ZOT ever changes, any value for the USE_FOO option is saved so that when the option is re-enabled it retains its old value.

This module was once needed to expand imported targets to the underlying libraries they reference on disk for use with the try_compile() and try_run() commands. These commands now support imported libraries in their LINK_LIBRARIES options (since CMake 2.8.11 for try_compile() and since CMake 3.2 for try_run()).

This module does not support the policy CMP0022 NEW behavior or use of the INTERFACE_LINK_LIBRARIES property because generator expressions cannot be evaluated during configuration.

CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces all imported targets contained in this list with their actual file paths of the referenced libraries on disk, including the libraries from their link interfaces. If a CONFIGURATION is given, it uses the respective configuration of the imported targets if it exists. If no CONFIGURATION is given, it uses the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.

The find_dependency() macro wraps a find_package() call for a package dependency:

find_dependency(<dep> [...])

It is designed to be used in a Package Configuration File (<PackageName>Config.cmake). find_dependency forwards the correct parameters for QUIET and REQUIRED which were passed to the original find_package() call. Any additional arguments specified are forwarded to find_package().

If the dependency could not be found it sets an informative diagnostic message and calls return() to end processing of the calling package configuration file and return to the find_package() command that loaded it.

NOTE:

The call to return() makes this macro unsuitable to call from Find Modules.

The macros provided by this module were once intended for use by cross-compiling toolchain files when CMake was not able to automatically detect the compiler identification. Since the introduction of this module, CMake’s compiler identification capabilities have improved and can now be taught to recognize any compiler. Furthermore, the suite of information CMake detects from a compiler is now too extensive to be provided by toolchain files using these macros.

One common use case for this module was to skip CMake’s checks for a working compiler when using a cross-compiler that cannot link binaries without special flags or custom linker scripts. This case is now supported by setting the CMAKE_TRY_COMPILE_TARGET_TYPE variable in the toolchain file instead.

----

Macro CMAKE_FORCE_C_COMPILER has the following signature:

CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)

It sets CMAKE_C_COMPILER to the given compiler and the cmake internal variable CMAKE_C_COMPILER_ID to the given compiler-id. It also bypasses the check for working compiler and basic compiler information tests.

Macro CMAKE_FORCE_CXX_COMPILER has the following signature:

CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)

It sets CMAKE_CXX_COMPILER to the given compiler and the cmake internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id. It also bypasses the check for working compiler and basic compiler information tests.

Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:

CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)

It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id. It also bypasses the check for working compiler and basic compiler information tests.

CMake can generate graphviz files, showing the dependencies between the targets in a project and also external libraries which are linked against. When CMake is run with the --graphviz=foo.dot option, it will produce:

a foo.dot file showing all dependencies in the project

a foo.dot.<target> file for each target, file showing on which other targets the respective target depends

a foo.dot.<target>.dependers file, showing which other targets depend on the respective target

The different dependency types PUBLIC, PRIVATE and INTERFACE are represented as solid, dashed and dotted edges.

This can result in huge graphs. Using the file CMakeGraphVizOptions.cmake the look and content of the generated graphs can be influenced. This file is searched first in CMAKE_BINARY_DIR and then in CMAKE_SOURCE_DIR. If found, it is read and the variables set in it are used to adjust options for the generated graphviz files.

GRAPHVIZ_GRAPH_TYPE

The graph type.

Mandatory : NO

Default : “digraph”

Valid graph types are:

“graph” : Nodes are joined with lines

“digraph” : Nodes are joined with arrows showing direction

“strict graph” : Like “graph” but max one line between each node

“strict digraph” : Like “graph” but max one line between each node in each direction

GRAPHVIZ_GRAPH_NAME

The graph name.

Mandatory : NO

Default : “GG”

GRAPHVIZ_GRAPH_HEADER

The header written at the top of the graphviz file.

Mandatory : NO

Default : “node [n fontsize = “12”];”

GRAPHVIZ_NODE_PREFIX

The prefix for each node in the graphviz file.

Mandatory : NO

Default : “node”

GRAPHVIZ_EXECUTABLES

Set this to FALSE to exclude executables from the generated graphs.

Mandatory : NO

Default : TRUE

GRAPHVIZ_STATIC_LIBS

Set this to FALSE to exclude static libraries from the generated graphs.

Mandatory : NO

Default : TRUE

GRAPHVIZ_SHARED_LIBS

Set this to FALSE to exclude shared libraries from the generated graphs.

Mandatory : NO

Default : TRUE

GRAPHVIZ_MODULE_LIBS

Set this to FALSE to exclude module libraries from the generated graphs.

Mandatory : NO

Default : TRUE

GRAPHVIZ_EXTERNAL_LIBS

Set this to FALSE to exclude external libraries from the generated graphs.

Mandatory : NO

Default : TRUE

GRAPHVIZ_IGNORE_TARGETS

A list of regular expressions for ignoring targets.

Mandatory : NO

Default : empty

GRAPHVIZ_GENERATE_PER_TARGET

Set this to FALSE to exclude per target graphs foo.dot.<target>.

Mandatory : NO

Default : TRUE

GRAPHVIZ_GENERATE_DEPENDERS

Set this to FALSE to exclude depender graphs foo.dot.<target>.dependers.

configure_package_config_file() should be used instead of the plain configure_file() command when creating the <PackageName>Config.cmake or <PackageName>-config.cmake file for installing a project or library. It helps making the resulting package relocatable by avoiding hardcoded paths in the installed Config.cmake file.

In a FooConfig.cmake file there may be code like this to make the install destinations know to the using project:

All 4 options shown above are not sufficient, since the first 3 hardcode the absolute directory locations, and the 4th case works only if the logic to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains a relative path, which in general cannot be guaranteed. This has the effect that the resulting FooConfig.cmake file would work poorly under Windows and OSX, where users are used to choose the install location of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time.

Using configure_package_config_file helps. If used correctly, it makes the resulting FooConfig.cmake file relocatable. Usage:

1.

write a FooConfig.cmake.in file as you are used to

2.

insert a line containing only the string @PACKAGE_INIT@

3.

instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") (this must be after the @PACKAGE_INIT@ line)

4.

instead of using the normal configure_file(), use configure_package_config_file()

The <input> and <output> arguments are the input and output file, the same way as in configure_file().

The <path> given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake file will be installed to. This path can either be absolute, or relative to the INSTALL_PREFIX path.

The variables <var1> to <varN> given as PATH_VARS are the variables which contain install destinations. For each of them the macro will create a helper variable PACKAGE_<var...>. These helper variables must be used in the FooConfig.cmake.in file for setting the installed location. They are calculated by configure_package_config_file so that they are always relative to the installed location of the package. This works both for relative and also for absolute locations. For absolute locations it works only if the absolute location is a subdirectory of INSTALL_PREFIX.

If the INSTALL_PREFIX argument is passed, this is used as base path to calculate all the relative paths. The <path> argument must be an absolute path. If this argument is not passed, the CMAKE_INSTALL_PREFIX variable will be used instead. The default value is good when generating a FooConfig.cmake file to use your package from the install tree. When generating a FooConfig.cmake file to use your package from the build tree this option should be used.

By default configure_package_config_file also generates two helper macros, set_and_check() and check_required_components() into the FooConfig.cmake file.

set_and_check() should be used instead of the normal set() command for setting directories and file locations. Additionally to setting the variable it also checks that the referenced file or directory actually exists and fails with a FATAL_ERROR otherwise. This makes sure that the created FooConfig.cmake file does not contain wrong references. When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the FooConfig.cmake file.

check_required_components(<PackageName>) should be called at the end of the FooConfig.cmake file. This macro checks whether all requested, non-optional components have been found, and if this is not the case, sets the Foo_FOUND variable to FALSE, so that the package is considered to be not found. It does that by testing the Foo_<Component>_FOUND variables for all requested required components. This macro should be called even if the package doesn’t provide any components to make sure users are not specifying components erroneously. When using the NO_CHECK_REQUIRED_COMPONENTS_MACRO option, this macro is not generated into the FooConfig.cmake file.

For an example see below the documentation for write_basic_package_version_file().

Writes a file for use as <PackageName>ConfigVersion.cmake file to <filename>. See the documentation of find_package() for details on this.

<filename> is the output filename, it should be in the build tree. <major.minor.patch> is the version number of the project to be installed.

If no VERSION is given, the PROJECT_VERSION variable is used. If this hasn’t been set, it errors out.

The Compatibility mode AnyNewerVersion means that the installed package version will be considered compatible if it is newer or exactly the same as the requested version. This mode should be used for packages which are fully backward compatible, also across major versions. If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion in that the major version number must be the same as requested, e.g. version 2.0 will not be considered compatible if 1.0 is requested. This mode should be used for packages which guarantee backward compatibility within the same major version. If SameMinorVersion is used, the behaviour is the same as SameMajorVersion, but both major and minor version must be the same as requested, e.g version 0.2 will not be compatible if 0.1 is requested. If ExactVersion is used, then the package is only considered compatible if the requested version matches exactly its own version number (not considering the tweak version). For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3. This mode is for packages without compatibility guarantees. If your project has more elaborated version matching rules, you will need to write your own custom ConfigVersion.cmake file instead of using this macro.

Internally, this macro executes configure_file() to create the resulting version file. Depending on the Compatibility, the corresponding BasicConfigVersion-<Compatibility>.cmake.in file is used. Please note that these files are internal to CMake and you should not call configure_file() on them yourself, but they can be used as starting point to create more sophisticted custom ConfigVersion.cmake files.

This module once implemented the cmake_parse_arguments() command that is now implemented natively by CMake. It is now an empty placeholder for compatibility with projects that include it to get the command from CMake 3.4 and lower.

This module defines three macros: CMAKE_PUSH_CHECK_STATE() CMAKE_POP_CHECK_STATE() and CMAKE_RESET_CHECK_STATE() These macros can be used to save, restore and reset (i.e., clear contents) the state of the variables CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_INCLUDES and CMAKE_EXTRA_INCLUDE_FILES used by the various Check-files coming with CMake, like e.g. check_function_exists() etc. The variable contents are pushed on a stack, pushing multiple times is supported. This is useful e.g. when executing such tests in a Find-module, where they have to be set, but after the Find-module has been executed they should have the same value as they had before.

This script is used to verify that embedded manifests and side by side manifests for a project match. To run this script, cd to a directory and run the script with cmake -P. On the command line you can pass in versions that are OK even if not found in the .manifest files. For example, cmake -Dallow_versions=8.0.50608.0 -PCmakeVerifyManifest.cmake could be used to allow an embedded manifest of 8.0.50608.0 to be used in a project even if that version was not found in the .manifest file.

The CPackComponent module is the module which handles the component part of CPack. See CPack module for general information about CPack.

For certain kinds of binary installers (including the graphical installers on macOS and Windows), CPack generates installers that allow users to select individual application components to install. The contents of each of the components are identified by the COMPONENT argument of CMake’s INSTALL command. These components can be annotated with user-friendly names and descriptions, inter-component dependencies, etc., and grouped in various ways to customize the resulting installer. See the cpack_add_* commands, described below, for more information about component-specific installations.

Component-specific installation allows users to select specific sets of components to install during the install process. Installation components are identified by the COMPONENT argument of CMake’s INSTALL commands, and should be further described by the following CPack commands:

CPACK_COMPONENTS_ALL

The list of component to install.

The default value of this variable is computed by CPack and contains all components defined by the project. The user may set it to only include the specified components.

Instead of specifying all the desired components, it is possible to obtain a list of all defined components and then remove the unwanted ones from the list. The get_cmake_property() command can be used to obtain the COMPONENTS property, then the list(REMOVE_ITEM) command can be used to remove the unwanted ones. For example, to use all defined components except foo and bar:

Specify how components are grouped for multi-package component-aware CPack generators.

Some generators like RPM or ARCHIVE family (TGZ, ZIP, …) generates several packages files when asked for component packaging. They group the component differently depending on the value of this variable:

ONE_PER_GROUP (default): creates one package file per component group

ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components

The cmake_add_component command describes an installation component, which the user can opt to install or remove as part of the graphical installation process. compname is the name of the component, as provided to the COMPONENT argument of one or more CMake INSTALL commands.

DISPLAY_NAME is the displayed name of the component, used in graphical installers to display the component name. This value can be any string.

DESCRIPTION is an extended description of the component, used in graphical installers to give the user additional information about the component. Descriptions can span multiple lines using \n as the line separator. Typically, these descriptions should be no more than a few lines long.

HIDDEN indicates that this component will be hidden in the graphical installer, so that the user cannot directly change whether it is installed or not.

REQUIRED indicates that this component is required, and therefore will always be installed. It will be visible in the graphical installer, but it cannot be unselected. (Typically, required components are shown greyed out).

DISABLED indicates that this component should be disabled (unselected) by default. The user is free to select this component for installation, unless it is also HIDDEN.

DEPENDS lists the components on which this component depends. If this component is selected, then each of the components listed must also be selected. The dependency information is encoded within the installer itself, so that users cannot install inconsistent sets of components.

GROUP names the component group of which this component is a part. If not provided, the component will be a standalone component, not part of any component group. Component groups are described with the cpack_add_component_group command, detailed below.

INSTALL_TYPES lists the installation types of which this component is a part. When one of these installations types is selected, this component will automatically be selected. Installation types are described with the cpack_add_install_type command, detailed below.

DOWNLOADED indicates that this component should be downloaded on-the-fly by the installer, rather than packaged in with the installer itself. For more information, see the cpack_configure_downloads command.

ARCHIVE_FILE provides a name for the archive file created by CPack to be used for downloaded components. If not supplied, CPack will create a file with some name based on CPACK_PACKAGE_FILE_NAME and the name of the component. See cpack_configure_downloads for more information.

PLIST gives a filename that is passed to pkgbuild with the --component-plist argument when using the productbuild generator.

The cpack_add_component_group describes a group of installation components, which will be placed together within the listing of options. Typically, component groups allow the user to select/deselect all of the components within a single group via a single group-level option. Use component groups to reduce the complexity of installers with many options. groupname is an arbitrary name used to identify the group in the GROUP argument of the cpack_add_component command, which is used to place a component in a group. The name of the group must not conflict with the name of any component.

DISPLAY_NAME is the displayed name of the component group, used in graphical installers to display the component group name. This value can be any string.

DESCRIPTION is an extended description of the component group, used in graphical installers to give the user additional information about the components within that group. Descriptions can span multiple lines using \n as the line separator. Typically, these descriptions should be no more than a few lines long.

PARENT_GROUP, if supplied, names the parent group of this group. Parent groups are used to establish a hierarchy of groups, providing an arbitrary hierarchy of groups.

EXPANDED indicates that, by default, the group should show up as “expanded”, so that the user immediately sees all of the components within the group. Otherwise, the group will initially show up as a single entry.

BOLD_TITLE indicates that the group title should appear in bold, to call the user’s attention to the group.

cpack_add_install_type

Add a new installation type containing a set of predefined component selections to the graphical installer.

cpack_add_install_type(typename
[DISPLAY_NAME name])

The cpack_add_install_type command identifies a set of preselected components that represents a common use case for an application. For example, a “Developer” install type might include an application along with its header and library files, while an “End user” install type might just include the application’s executable. Each component identifies itself with one or more install types via the INSTALL_TYPES argument to cpack_add_component.

DISPLAY_NAME is the displayed name of the install type, which will typically show up in a drop-down box within a graphical installer. This value can be any string.

cpack_configure_downloads

Configure CPack to download selected components on-the-fly as part of the installation process.

The cpack_configure_downloads command configures installation-time downloads of selected components. For each downloadable component, CPack will create an archive containing the contents of that component, which should be uploaded to the given site. When the user selects that component for installation, the installer will download and extract the component in place. This feature is useful for creating small installers that only download the requested components, saving bandwidth. Additionally, the installers are small enough that they will be installed as part of the normal installation process, and the “Change” button in Windows Add/Remove Programs control panel will allow one to add or remove parts of the application after the original installation. On Windows, the downloaded-components functionality requires the ZipDLL plug-in for NSIS, available at:

http://nsis.sourceforge.net/ZipDLL_plug-in

On macOS, installers that download components on-the-fly can only be built and installed on system using macOS 10.5 or later.

The site argument is a URL where the archives for downloadable components will reside, e.g., https://cmake.org/files/2.6.1/installer/ All of the archives produced by CPack should be uploaded to that location.

UPLOAD_DIRECTORY is the local directory where CPack will create the various archives for each of the components. The contents of this directory should be uploaded to a location accessible by the URL given in the site argument. If omitted, CPack will use the directory CPackUploads inside the CMake binary directory to store the generated archives.

The ALL flag indicates that all components be downloaded. Otherwise, only those components explicitly marked as DOWNLOADED or that have a specified ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies ADD_REMOVE (unless NO_ADD_REMOVE is specified).

ADD_REMOVE indicates that CPack should install a copy of the installer that can be called from Windows’ Add/Remove Programs dialog (via the “Modify” button) to change the set of installed components. NO_ADD_REMOVE turns off this behavior. This option is ignored on Mac OS X.

if set, then the component will be packaged and installed as part of a group to which it belongs.

ESSENTIAL

if set, then the package manager stays disabled until that component is updated.

VIRTUAL

if set, then the component will be hidden from the installer. It is a equivalent of the HIDDEN option from the cpack_add_component() command.

FORCED_INSTALLATION

if set, then the component must always be installed. It is a equivalent of the REQUARED option from the cpack_add_component() command.

REQUIRES_ADMIN_RIGHTS

set it if the component needs to be installed with elevated permissions.

NAME

is used to create domain-like identification for this component. By default used origin component name.

DISPLAY_NAME

set to rewrite original name configured by cpack_add_component() command.

DESCRIPTION

set to rewrite original description configured by cpack_add_component() command.

UPDATE_TEXT

will be added to the component description if this is an update to the component.

VERSION

is version of component. By default used CPACK_PACKAGE_VERSION.

RELEASE_DATE

keep empty to auto generate.

SCRIPT

is a relative or absolute path to operations script for this component.

PRIORITY | SORTING_PRIORITY

is priority of the component in the tree. The PRIORITY option is deprecated and will be removed in a future version of CMake. Please use SORTING_PRIORITY option instead.

DEPENDS | DEPENDENCIES

list of dependency component or component group identifiers in QtIFW style.

AUTO_DEPEND_ON

list of identifiers of component or component group in QtIFW style that this component has an automatic dependency on.

LICENSES

pair of <display_name> and <file_path> of license text for this component. You can specify more then one license.

DEFAULT

Possible values are: TRUE, FALSE, and SCRIPT. Set to FALSE to disable the component in the installer or to SCRIPT to resolved during runtime (don’t forget add the file of the script as a value of the SCRIPT option).

USER_INTERFACES

is a list of <file_path> (‘.ui’ files) representing pages to load.

TRANSLATIONS

is a list of <file_path> (‘.qm’ files) representing translations to load.

REPLACES

list of identifiers of component or component group to replace.

CHECKABLE

Possible values are: TRUE, FALSE. Set to FALSE if you want to hide the checkbox for an item. This is useful when only a few subcomponents should be selected instead of all.

This command should be called after cpack_add_component_group() command.

VIRTUAL

if set, then the group will be hidden from the installer. Note that setting this on a root component does not work.

FORCED_INSTALLATION

if set, then the group must always be installed.

REQUIRES_ADMIN_RIGHTS

set it if the component group needs to be installed with elevated permissions.

NAME

is used to create domain-like identification for this component group. By default used origin component group name.

DISPLAY_NAME

set to rewrite original name configured by cpack_add_component_group() command.

DESCRIPTION

set to rewrite original description configured by cpack_add_component_group() command.

UPDATE_TEXT

will be added to the component group description if this is an update to the component group.

VERSION

is version of component group. By default used CPACK_PACKAGE_VERSION.

RELEASE_DATE

keep empty to auto generate.

SCRIPT

is a relative or absolute path to operations script for this component group.

PRIORITY | SORTING_PRIORITY

is priority of the component group in the tree. The PRIORITY option is deprecated and will be removed in a future version of CMake. Please use SORTING_PRIORITY option instead.

DEPENDS | DEPENDENCIES

list of dependency component or component group identifiers in QtIFW style.

AUTO_DEPEND_ON

list of identifiers of component or component group in QtIFW style that this component group has an automatic dependency on.

LICENSES

pair of <display_name> and <file_path> of license text for this component group. You can specify more then one license.

DEFAULT

Possible values are: TRUE, FALSE, and SCRIPT. Set to TRUE to preselect the group in the installer (this takes effect only on groups that have no visible child components) or to SCRIPT to resolved during runtime (don’t forget add the file of the script as a value of the SCRIPT option).

USER_INTERFACES

is a list of <file_path> (‘.ui’ files) representing pages to load.

TRANSLATIONS

is a list of <file_path> (‘.qm’ files) representing translations to load.

REPLACES

list of identifiers of component or component group to replace.

CHECKABLE

Possible values are: TRUE, FALSE. Set to FALSE if you want to hide the checkbox for an item. This is useful when only a few subcomponents should be selected instead of all.

Copies an <input> file to an <output> file and substitutes variable values referenced as %{VAR} or %VAR% in the input file content. Each variable reference will be replaced with the current value of the variable, or the empty string if the variable is not defined.

The CPack module generates binary and source installers in a variety of formats using the cpack program. Inclusion of the CPack module adds two new build targets, package and package_source, which build the binary and source installers respectively. The generated binary installers contain everything installed via CMake’s install() command (and the deprecated install_files(), install_programs() and install_targets() commands).

For certain kinds of binary installers (including the graphical installers on macOS and Windows), CPack generates installers that allow users to select individual application components to install. See CPackComponent module for further details.

The CPACK_GENERATOR variable has different meanings in different contexts. In a CMakeLists.txt file, CPACK_GENERATOR is a list of generators: and when cpack is run with no other arguments, it will iterate over that list and produce one package for each generator. In a CPACK_PROJECT_CONFIG_FILE, CPACK_GENERATOR is a string naming a single generator. If you need per-cpack-generator logic to control other cpack settings, then you need a CPACK_PROJECT_CONFIG_FILE.

The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE. See the top level file CMakeCPackOptions.cmake.in for an example.

If set, the CPACK_PROJECT_CONFIG_FILE is included automatically on a per-generator basis. It only need contain overrides.

Here’s how it works:

cpack runs

it includes CPackConfig.cmake

it iterates over the generators given by the -G command line option, or if no such option was specified, over the list of generators given by the CPACK_GENERATOR variable set in the CPackConfig.cmake input file.

foreach generator, it then

sets CPACK_GENERATOR to the one currently being iterated

includes the CPACK_PROJECT_CONFIG_FILE

produces the package for that generator

This is the key: For each generator listed in CPACK_GENERATOR in CPackConfig.cmake, cpack will reset CPACK_GENERATOR internally to the one currently being used and then include the CPACK_PROJECT_CONFIG_FILE.

Before including this CPack module in your CMakeLists.txt file, there are a variety of variables that can be set to customize the resulting installers. The most commonly-used variables are:

CPACK_PACKAGE_NAME

The name of the package (or application). If not specified, it defaults to the project name.

CPACK_PACKAGE_VENDOR

The name of the package vendor. (e.g., “Kitware”). The default is “Humanity”.

CPACK_PACKAGE_DIRECTORY

The directory in which CPack is doing its packaging. If it is not set then this will default (internally) to the build dir. This variable may be defined in a CPack config file or from the cpack command line option -B. If set, the command line option overrides the value found in the config file.

CPACK_PACKAGE_VERSION_MAJOR

Package major version. This variable will always be set, but its default value depends on whether or not version details were given to the project() command in the top level CMakeLists.txt file. If version details were given, the default value will be CMAKE_PROJECT_VERSION_MAJOR. If no version details were given, a default version of 0.1.1 will be assumed, leading to CPACK_PACKAGE_VERSION_MAJOR having a default value of 0.

CPACK_PACKAGE_VERSION_MINOR

Package minor version. The default value is determined based on whether or not version details were given to the project() command in the top level CMakeLists.txt file. If version details were given, the default value will be CMAKE_PROJECT_VERSION_MINOR, but if no minor version component was specified then CPACK_PACKAGE_VERSION_MINOR will be left unset. If no project version was given at all, a default version of 0.1.1 will be assumed, leading to CPACK_PACKAGE_VERSION_MINOR having a default value of 1.

CPACK_PACKAGE_VERSION_PATCH

Package patch version. The default value is determined based on whether or not version details were given to the project() command in the top level CMakeLists.txt file. If version details were given, the default value will be CMAKE_PROJECT_VERSION_PATCH, but if no patch version component was specified then CPACK_PACKAGE_VERSION_PATCH will be left unset. If no project version was given at all, a default version of 0.1.1 will be assumed, leading to CPACK_PACKAGE_VERSION_PATCH having a default value of 1.

CPACK_PACKAGE_DESCRIPTION

A description of the project, used in places such as the introduction screen of CPack-generated Windows installers. If not set, the value of this variable is populated from the file named by CPACK_PACKAGE_DESCRIPTION_FILE.

CPACK_PACKAGE_DESCRIPTION_FILE

A text file used to describe the project when CPACK_PACKAGE_DESCRIPTION is not explicitly set. The default value for CPACK_PACKAGE_DESCRIPTION_FILE points to a built-in template file Templates/CPack.GenericDescription.txt.

CPACK_PACKAGE_DESCRIPTION_SUMMARY

Short description of the project (only a few words). If the CMAKE_PROJECT_DESCRIPTION variable is set, it is used as the default value, otherwise the default will be a string generated by CMake based on CMAKE_PROJECT_NAME.

CPACK_PACKAGE_HOMEPAGE_URL

Project homepage URL. The default value is taken from the CMAKE_PROJECT_HOMEPAGE_URL variable, which is set by the top level project() command, or else the default will be empty if no URL was provided to project().

CPACK_PACKAGE_FILE_NAME

The name of the package file to generate, not including the extension. For example, cmake-2.6.1-Linux-i686. The default value is:

${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}

CPACK_PACKAGE_INSTALL_DIRECTORY

Installation directory on the target system. This may be used by some CPack generators like NSIS to create an installation directory e.g., “CMake 2.5” below the installation prefix. All installed elements will be put inside this directory.

CPACK_PACKAGE_ICON

A branding image that will be displayed inside the installer (used by GUI installers).

CPACK_PACKAGE_CHECKSUM

An algorithm that will be used to generate an additional file with the checksum of the package. The output file name will be:

${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}

Supported algorithms are those listed by the string(<HASH>) command.

CPACK_PROJECT_CONFIG_FILE

CPack-time project CPack configuration file. This file is included at cpack time, once per generator after CPack has set CPACK_GENERATOR to the actual generator being used. It allows per-generator setting of CPACK_* variables at cpack time.

CPACK_RESOURCE_FILE_LICENSE

License to be embedded in the installer. It will typically be displayed to the user by the produced installer (often with an explicit “Accept” button, for graphical installers) prior to installation. This license file is NOT added to the installed files but is used by some CPack generators like NSIS. If you want to install a license file (may be the same as this one) along with your project, you must add an appropriate CMake install() command in your CMakeLists.txt.

CPACK_RESOURCE_FILE_README

ReadMe file to be embedded in the installer. It typically describes in some detail the purpose of the project during the installation. Not all CPack generators use this file.

CPACK_RESOURCE_FILE_WELCOME

Welcome file to be embedded in the installer. It welcomes users to this installer. Typically used in the graphical installers on Windows and Mac OS X.

CPACK_MONOLITHIC_INSTALL

Disables the component-based installation mechanism. When set, the component specification is ignored and all installed items are put in a single “MONOLITHIC” package. Some CPack generators do monolithic packaging by default and may be asked to do component packaging by setting CPACK_<GENNAME>_COMPONENT_INSTALL to TRUE.

CPACK_GENERATOR

List of CPack generators to use. If not specified, CPack will create a set of options following the naming pattern CPACK_BINARY_<GENNAME> (e.g. CPACK_BINARY_NSIS) allowing the user to enable/disable individual generators. If the -G option is given on the cpack command line, it will override this variable and any CPACK_BINARY_<GENNAME> options.

CPACK_OUTPUT_CONFIG_FILE

The name of the CPack binary configuration file. This file is the CPack configuration generated by the CPack module for binary installers. Defaults to CPackConfig.cmake.

CPACK_PACKAGE_EXECUTABLES

Lists each of the executables and associated text label to be used to create Start Menu shortcuts. For example, setting this to the list ccmake;CMake will create a shortcut named “CMake” that will execute the installed executable ccmake. Not all CPack generators use it (at least NSIS, WIX and OSXX11 do).

CPACK_STRIP_FILES

List of files to be stripped. Starting with CMake 2.6.0, CPACK_STRIP_FILES will be a boolean variable which enables stripping of all files (a list of files evaluates to TRUE in CMake, so this change is compatible).

CPACK_VERBATIM_VARIABLES

If set to TRUE, values of variables prefixed with CPACK_ will be escaped before being written to the configuration files, so that the cpack program receives them exactly as they were specified. If not, characters like quotes and backslashes can cause parsing errors or alter the value received by the cpack program. Defaults to FALSE for backwards compatibility.

The following CPack variables are specific to source packages, and will not affect binary packages:

CPACK_SOURCE_PACKAGE_FILE_NAME

The name of the source package. For example cmake-2.6.1.

CPACK_SOURCE_STRIP_FILES

List of files in the source tree that will be stripped. Starting with CMake 2.6.0, CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables stripping of all files (a list of files evaluates to TRUE in CMake, so this change is compatible).

CPACK_SOURCE_GENERATOR

List of generators used for the source packages. As with CPACK_GENERATOR, if this is not specified then CPack will create a set of options (e.g. CPACK_SOURCE_ZIP) allowing users to select which packages will be generated.

CPACK_SOURCE_OUTPUT_CONFIG_FILE

The name of the CPack source configuration file. This file is the CPack configuration generated by the CPack module for source installers. Defaults to CPackSourceConfig.cmake.

CPACK_SOURCE_IGNORE_FILES

Pattern of files in the source tree that won’t be packaged when building a source package. This is a list of regular expression patterns (that must be properly escaped), e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*

The following variables are for advanced uses of CPack:

CPACK_CMAKE_GENERATOR

What CMake generator should be used if the project is a CMake project. Defaults to the value of CMAKE_GENERATOR. Few users will want to change this setting.

CPACK_INSTALL_CMAKE_PROJECTS

List of four values that specify what project to install. The four values are: Build directory, Project Name, Project Component, Directory. If omitted, CPack will build an installer that installs everything.

CPACK_SYSTEM_NAME

System name, defaults to the value of CMAKE_SYSTEM_NAME, except on Windows where it will be win32 or win64.

CPACK_PACKAGE_VERSION

Package full version, used internally. By default, this is built from CPACK_PACKAGE_VERSION_MAJOR, CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.

CPACK_TOPLEVEL_TAG

Directory for the installed files.

CPACK_INSTALL_COMMANDS

Extra commands to install components.

CPACK_INSTALLED_DIRECTORIES

Extra directories to install.

CPACK_PACKAGE_INSTALL_REGISTRY_KEY

Registry key used when installing this project. This is only used by installers for Windows. The default value is based on the installation directory.

CPACK_CREATE_DESKTOP_LINKS

List of desktop links to create. Each desktop link requires a corresponding start menu shortcut as created by CPACK_PACKAGE_EXECUTABLES.

CPACK_BINARY_<GENNAME>

CPack generated options for binary generators. The CPack.cmake module generates (when CPACK_GENERATOR is not set) a set of CMake options (see CMake option() command) which may then be used to select the CPack generator(s) to be used when building the package target or when running cpack without the -G option.

List of all source files which are relevant for setting the VS_CSHARP_<tagname> properties (including .cs, .resx and .Designer.cs extensions).

In the list of all given files for all files ending with .Designer.cs and .resx is searched. For every designer or resource file a file with the same base name but only .cs as extension is searched. If this is found, the VS_CSHARP_<tagname> properties are set as follows:

List of all source files which are relevant for setting the VS_CSHARP_<tagname> properties (including .cs, .resx, .settings and .Designer.cs extensions).

In the list of all given files for all files ending with .Designer.cs is searched. For every designer file all files with the same base name but different extensions are searched. If a match is found, the source file properties of the designer file are set depending on the extension of the matched file:

if match is .resx file:

VS_CSHARP_AutoGen “True”

VS_CSHARP_DesignTime “True”

VS_CSHARP_DependentUpon <resx-filename>

if match is .cs file:

VS_CSHARP_DependentUpon <cs-filename>

if match is .settings file:

VS_CSHARP_AutoGen “True”

VS_CSHARP_DesignTimeSharedInput “True”

VS_CSHARP_DependentUpon <settings-filename>

NOTE:

Because the source file properties of the .Designer.cs file are set according to the found matches and every match sets the VS_CSHARP_DependentUpon property, there should only be one match for each Designer.cs file.

List of all source files which are relevant for setting the VS_CSHARP_<tagname> properties (including .cs, .xaml, and .xaml.cs extensions).

In the list of all given files for all files ending with .xaml.cs is searched. For every xaml-cs file, a file with the same base name but extension .xaml is searched. If a match is found, the source file properties of the .xaml.cs file are set:

Helper function which computes a list of key values to identify source files independently of relative/absolute paths given in cmake and eliminates case sensitivity:

csharp_get_filename_keys(OUT [<file1> [<file2> [...]]])

OUT

Name of the variable in which the list of keys is stored

<fileN>

filename(s) as given to to CSharp target using add_library() or add_executable()

In some way the function applies a canonicalization to the source names. This is necessary to find file matches if the files have been added to the target with different directory prefixes:

add_library(lib
myfile.cs
${CMAKE_CURRENT_SOURCE_DIR}/myfile.Designer.cs)
set_source_files_properties(myfile.Designer.cs PROPERTIES
VS_CSHARP_DependentUpon myfile.cs)
# this will fail, because in cmake
# - ${CMAKE_CURRENT_SOURCE_DIR}/myfile.Designer.cs
# - myfile.Designer.cs
# are not the same source file. The source file property is not set.

csharp_get_filename_key_base

Returns the full filepath and name without extension of a key. KEY is expected to be a key from csharp_get_filename_keys. In BASE the value of KEY without the file extension is returned:

csharp_get_filename_key_base(BASE KEY)

BASE

Name of the variable with the computed “base” of KEY.

KEY

The key of which the base will be computed. Expected to be a upper case full filename.

csharp_get_dependentupon_name

Computes a string which can be used as value for the source file property VS_CSHARP_<tagname> with target being DependentUpon:

csharp_get_dependentupon_name(NAME FILE)

NAME

Name of the variable with the result value

FILE

Filename to convert to <DependentUpon> value

Actually this is only the filename without any path given at the moment.

(the CDash server can provide the file to a project administrator who configures MyProject). Settings in the config file are shared by both this CTest module and the ctest(1) command-line Dashboard Client mode (ctest -S).

While building a project for submission to CDash, CTest scans the build output for errors and warnings and reports them with surrounding context from the build log. This generic approach works for all build tools, but does not give details about the command invocation that produced a given problem. One may get more detailed reports by setting the CTEST_USE_LAUNCHERS variable:

Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on.

CTestUseLaunchers is automatically included when you include(CTest). However, it is split out into its own module file so projects can use the CTEST_USE_LAUNCHERS functionality independently.

To use launchers, set CTEST_USE_LAUNCHERS to ON in a ctest -S dashboard script, and then also set it in the cache of the configured project. Both cmake and ctest need to know the value of it for the launchers to work properly. CMake needs to know in order to generate proper build rules, and ctest, in order to produce the proper error and warning analysis.

For convenience, you may set the ENV variable CTEST_USE_LAUNCHERS_DEFAULT in your ctest -S script, too. Then, as long as your CMakeLists uses include(CTest) or include(CTestUseLaunchers), it will use the value of the ENV variable to initialize a CTEST_USE_LAUNCHERS cache variable. This cache variable initialization only occurs if CTEST_USE_LAUNCHERS is not already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE to the cmake command used to configure the project.

This file is the backwards-compatibility version of the CTest module. It supports using the old Dart 1 Tcl client for driving dashboard submissions as well as testing with CTest. This module should be included in the CMakeLists.txt file at the top of a project. Typical usage:

Copies Qt plugins, writes a Qt configuration file (if needed) and fixes up a Qt4 executable using BundleUtilities so it is standalone and can be drag-and-drop copied to another machine as long as all of the system libraries are compatible.

<executable> should point to the executable to be fixed-up.

<qtplugins> should contain a list of the names or paths of any Qt plugins to be installed.

<libs> will be passed to BundleUtilities and should be a list of any already installed plugins, libraries or executables to also be fixed-up.

<dirs> will be passed to BundleUtilities and should contain and directories to be searched to find library dependencies.

<plugins_dir> allows an custom plugins directory to be used.

<request_qt_conf> will force a qt.conf file to be written even if not needed.

Install (or copy) an unresolved <plugin> to the default plugins directory (or <plugins_dir>) relative to <executable> and store the result in <installed_plugin_path_var>. See documentation of INSTALL_QT4_PLUGIN_PATH.

Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up a Qt4 executable using BundleUtilities so it is standalone and can be drag-and-drop copied to another machine as long as all of the system libraries are compatible. The executable will be fixed-up at install time. <component> is the COMPONENT used for bundle fixup and plugin installation. See documentation of FIXUP_QT4_BUNDLE.

Use this module to unambiguously reference data files stored outside the source tree and fetch them at build time from arbitrary local and remote content-addressed locations. Functions provided by this module recognize arguments with the syntax DATA{<name>} as references to external data, replace them with full paths to local copies of those data, and create build rules to fetch and update the local copies.

When test MyTest runs the DATA{MyInput.png} argument will be replaced by the full path to a real instance of the data file MyInput.png on disk. If the source tree contains a content link such as MyInput.png.md5 then the MyData target creates a real MyInput.png in the build tree.

It passes its arguments through ExternalData_Expand_Arguments and then invokes the add_test() command using the results.

ExternalData_Add_Target

The ExternalData_Add_Target function creates a custom target to manage local instances of data files stored externally:

ExternalData_Add_Target(
<target> # Name of data management target
)

It creates custom commands in the target as necessary to make data files available for each DATA{} reference previously evaluated by other functions provided by this module. Data files may be fetched from one of the URL templates specified in the ExternalData_URL_TEMPLATES variable, or may be found locally in one of the paths specified in the ExternalData_OBJECT_STORES variable.

Typically only one target is needed to manage all external data within a project. Call this function once at the end of configuration after all data references have been processed.

The following variables configure behavior. They should be set before calling any of the functions provided by this module.

ExternalData_BINARY_ROOT

The ExternalData_BINARY_ROOT variable may be set to the directory to hold the real data files named by expanded DATA{} references. The default is CMAKE_BINARY_DIR. The directory layout will mirror that of content links under ExternalData_SOURCE_ROOT.

ExternalData_CUSTOM_SCRIPT_<key>

Specify a full path to a .cmake custom fetch script identified by <key> in entries of the ExternalData_URL_TEMPLATES list. See Custom Fetch Scripts.

ExternalData_LINK_CONTENT

The ExternalData_LINK_CONTENT variable may be set to the name of a supported hash algorithm to enable automatic conversion of real data files referenced by the DATA{} syntax into content links. For each such <file> a content link named <file><ext> is created. The original file is renamed to the form .ExternalData_<algo>_<hash> to stage it for future transmission to one of the locations in the list of URL templates (by means outside the scope of this module). The data fetch rule created for the content link will use the staged object if it cannot be found using any URL template.

ExternalData_NO_SYMLINKS

The real data files named by expanded DATA{} references may be made available under ExternalData_BINARY_ROOT using symbolic links on some platforms. The ExternalData_NO_SYMLINKS variable may be set to disable use of symbolic links and enable use of copies instead.

ExternalData_OBJECT_STORES

The ExternalData_OBJECT_STORES variable may be set to a list of local directories that store objects using the layout <dir>/%(algo)/%(hash). These directories will be searched first for a needed object. If the object is not available in any store then it will be fetched remotely using the URL templates and added to the first local store listed. If no stores are specified the default is a location inside the build tree.

ExternalData_SERIES_PARSE

ExternalData_SERIES_PARSE_PREFIX

ExternalData_SERIES_PARSE_NUMBER

ExternalData_SERIES_PARSE_SUFFIX

ExternalData_SERIES_MATCH

See Referencing File Series.

ExternalData_SOURCE_ROOT

The ExternalData_SOURCE_ROOT variable may be set to the highest source directory containing any path named by a DATA{} reference. The default is CMAKE_SOURCE_DIR. ExternalData_SOURCE_ROOT and CMAKE_SOURCE_DIR must refer to directories within a single source distribution (e.g. they come together in one tarball).

ExternalData_TIMEOUT_ABSOLUTE

The ExternalData_TIMEOUT_ABSOLUTE variable sets the download absolute timeout, in seconds, with a default of 300 seconds. Set to 0 to disable enforcement.

ExternalData_TIMEOUT_INACTIVITY

The ExternalData_TIMEOUT_INACTIVITY variable sets the download inactivity timeout, in seconds, with a default of 60 seconds. Set to 0 to disable enforcement.

ExternalData_URL_ALGO_<algo>_<key>

Specify a custom URL component to be substituted for URL template placeholders of the form %(algo:<key>), where <key> is a valid C identifier, when fetching an object referenced via hash algorithm <algo>. If not defined, the default URL component is just <algo> for any <key>.

ExternalData_URL_TEMPLATES

The ExternalData_URL_TEMPLATES may be set to provide a list of of URL templates using the placeholders %(algo) and %(hash) in each template. Data fetch rules try each URL template in order by substituting the hash algorithm name for %(algo) and the hash value for %(hash). Alternatively one may use %(algo:<key>) with ExternalData_URL_ALGO_<algo>_<key> variables to gain more flexibility in remote URLs.

The DATA{} syntax is literal and the <name> is a full or relative path within the source tree. The source tree must contain either a real data file at <name> or a “content link” at <name><ext> containing a hash of the real file using a hash algorithm corresponding to <ext>. For example, the argument DATA{img.png} may be satisfied by either a real img.png file in the current source directory or a img.png.md5 file containing its MD5 sum.

Multiple content links of the same name with different hash algorithms are supported (e.g. img.png.sha256 and img.png.sha1) so long as they all correspond to the same real file. This allows objects to be fetched from sources indexed by different hash algorithms.

The DATA{} syntax can be told to fetch a file series using the form DATA{<name>,:}, where the : is literal. If the source tree contains a group of files or content links named like a series then a reference to one member adds rules to fetch all of them. Although all members of a series are fetched, only the file originally named by the DATA{} argument is substituted for it. The default configuration recognizes file series names ending with #.ext, _#.ext, .#.ext, or -#.ext where # is a sequence of decimal digits and .ext is any single extension. Configure it with a regex that parses <number> and <suffix> parts from the end of <name>:

ExternalData_SERIES_PARSE = regex of the form (<number>)(<suffix>)$

For more complicated cases set:

ExternalData_SERIES_PARSE = regex with at least two () groups
ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any
ExternalData_SERIES_PARSE_NUMBER = <number> regex group number
ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number

Configure series number matching with a regex that matches the <number> part of series members named <prefix><number><suffix>:

ExternalData_SERIES_MATCH = regex matching <number> in all series members

Note that the <suffix> of a series does not include a hash-algorithm extension.

The DATA{} syntax can alternatively match files associated with the named file and contained in the same directory. Associated files may be specified by options using the syntax DATA{<name>,<opt1>,<opt2>,...}. Each option may specify one file by name or specify a regular expression to match file names using the syntax REGEX:<regex>. For example, the arguments:

The DATA{} syntax may reference a directory using a trailing slash and a list of associated files. The form DATA{<name>/,<opt1>,<opt2>,...} adds rules to fetch any files in the directory that match one of the associated file options. For example, the argument DATA{MyDataDir/,REGEX:.*} will pass the full path to a MyDataDir directory on the command line and ensure that the directory contains files corresponding to every file or content link in the MyDataDir source directory. In order to match associated files in subdirectories, specify a RECURSE: option, e.g. DATA{MyDataDir/,RECURSE:,REGEX:.*}.

When a data file must be fetched from one of the URL templates specified in the ExternalData_URL_TEMPLATES variable, it is normally downloaded using the file(DOWNLOAD) command. One may specify usage of a custom fetch script by using a URL template of the form ExternalDataCustomScript://<key>/<loc>. The <key> must be a C identifier, and the <loc> must contain the %(algo) and %(hash) placeholders. A variable corresponding to the key, ExternalData_CUSTOM_SCRIPT_<key>, must be set to the full path to a .cmake script file. The script will be included to perform the actual fetch, and provided with the following variables:

ExternalData_CUSTOM_LOCATION

When a custom fetch script is loaded, this variable is set to the location part of the URL, which will contain the substituted hash algorithm name and content hash value.

ExternalData_CUSTOM_FILE

When a custom fetch script is loaded, this variable is set to the full path to a file in which the script must store the fetched content. The name of the file is unspecified and should not be interpreted in any way.

The custom fetch script is expected to store fetched content in the file or set a variable:

ExternalData_CUSTOM_ERROR

When a custom fetch script fails to fetch the requested content, it must set this variable to a short one-line message describing the reason for failure.

The individual steps within the process can be driven independently if required (e.g. for CDash submission) and extra custom steps can be defined, along with the ability to control the step dependencies. The directory structure used for the management of the external project can also be customized. The function supports a large number of options which can be used to tailor the external project behavior.

Directory Options:

Most of the time, the default directory layout is sufficient. It is largely an implementation detail that the main project usually doesn’t need to change. In some circumstances, however, control over the directory layout can be useful or necessary. The directory options are potentially more useful from the point of view that the main build can use the ExternalProject_Get_Property() command to retrieve their values, thereby allowing the main project to refer to build artifacts of the external project.

PREFIX <dir>

Root directory for the external project. Unless otherwise noted below, all other directories associated with the external project will be created under here.

TMP_DIR <dir>

Directory in which to store temporary files.

STAMP_DIR <dir>

Directory in which to store the timestamps of each step. Log files from individual steps are also created in here (see Logging Options below).

DOWNLOAD_DIR <dir>

Directory in which to store downloaded files before unpacking them. This directory is only used by the URL download method, all other download methods use SOURCE_DIR directly instead.

SOURCE_DIR <dir>

Source directory into which downloaded contents will be unpacked, or for non-URL download methods, the directory in which the repository should be checked out, cloned, etc. If no download method is specified, this must point to an existing directory where the external project has already been unpacked or cloned/checked out.

NOTE:

If a download method is specified, any existing contents of the source directory may be deleted. Only the URL download method checks whether this directory is either missing or empty before initiating the download, stopping with an error if it is not empty. All other download methods silently discard any previous contents of the source directory.

BINARY_DIR <dir>

Specify the build directory location. This option is ignored if BUILD_IN_SOURCE is enabled.

INSTALL_DIR <dir>

Installation prefix to be placed in the <INSTALL_DIR> placeholder. This does not actually configure the external project to install to the given prefix. That must be done by passing appropriate arguments to the external project configuration step, e.g. using <INSTALL_DIR>.

If any of the above ..._DIR options are not specified, their defaults are computed as follows. If the PREFIX option is given or the EP_PREFIX directory property is set, then an external project is built and installed under the specified prefix:

If no PREFIX, EP_PREFIX, or EP_BASE is specified, then the default is to set PREFIX to <name>-prefix. Relative paths are interpreted with respect to CMAKE_CURRENT_BINARY_DIR at the point where ExternalProject_Add() is called.

Download Step Options:

A download method can be omitted if the SOURCE_DIR option is used to point to an existing non-empty directory. Otherwise, one of the download methods below must be specified (multiple download methods should not be given) or a custom DOWNLOAD_COMMAND provided.

DOWNLOAD_COMMAND <cmd>...

Overrides the command used for the download step (generator expressions are supported). If this option is specified, all other download options will be ignored. Providing an empty string for <cmd> effectively disables the download step.

URL Download

URL <url1> [<url2>...]

List of paths and/or URL(s) of the external project’s source. When more than one URL is given, they are tried in turn until one succeeds. A URL may be an ordinary path in the local file system (in which case it must be the only URL provided) or any downloadable URL supported by the file(DOWNLOAD) command. A local filesystem path may refer to either an existing directory or to an archive file, whereas a URL is expected to point to a file which can be treated as an archive. When an archive is used, it will be unpacked automatically unless the DOWNLOAD_NO_EXTRACT option is set to prevent it. The archive type is determined by inspecting the actual content rather than using logic based on the file extension.

URL_HASH <algo>=<hashValue>

Hash of the archive file to be downloaded. The argument should be of the form <algo>=<hashValue> where algo can be any of the hashing algorithms supported by the file() command. Specifying this option is strongly recommended for URL downloads, as it ensures the integrity of the downloaded content. It is also used as a check for a previously downloaded file, allowing connection to the remote location to be avoided altogether if the local directory already has a file from an earlier download that matches the specified hash.

URL_MD5 <md5>

Equivalent to URL_HASH MD5=<md5>.

DOWNLOAD_NAME <fname>

File name to use for the downloaded file. If not given, the end of the URL is used to determine the file name. This option is rarely needed, the default name is generally suitable and is not normally used outside of code internal to the ExternalProject module.

DOWNLOAD_NO_EXTRACT <bool>

Allows the extraction part of the download step to be disabled by passing a boolean true value for this option. If this option is not given, the downloaded contents will be unpacked automatically if required. If extraction has been disabled, the full path to the downloaded file is available as <DOWNLOADED_FILE> in subsequent steps or as the property DOWNLOADED_FILE with the ExternalProject_Get_Property() command.

DOWNLOAD_NO_PROGRESS <bool>

Can be used to disable logging the download progress. If this option is not given, download progress messages will be logged.

TIMEOUT <seconds>

Maximum time allowed for file download operations.

HTTP_USERNAME <username>

Username for the download operation if authentication is required.

HTTP_PASSWORD <password>

Password for the download operation if authentication is required.

HTTP_HEADER <header1> [<header2>...]

Provides an arbitrary list of HTTP headers for the download operation. This can be useful for accessing content in systems like AWS, etc.

TLS_VERIFY <bool>

Specifies whether certificate verification should be performed for https URLs. If this option is not provided, the default behavior is determined by the CMAKE_TLS_VERIFY variable (see file(DOWNLOAD)). If that is also not set, certificate verification will not be performed. In situations where URL_HASH cannot be provided, this option can be an alternative verification measure.

TLS_CAINFO <file>

Specify a custom certificate authority file to use if TLS_VERIFY is enabled. If this option is not specified, the value of the CMAKE_TLS_CAINFO variable will be used instead (see file(DOWNLOAD))

NETRC <level>

Specify whether the .netrc file is to be used for operation. If this option is not specified, the value of the CMAKE_NETRC variable will be used instead (see file(DOWNLOAD)) Valid levels are:

IGNORED

The .netrc file is ignored. This is the default.

OPTIONAL

The .netrc file is optional, and information in the URL is preferred. The file will be scanned to find which ever information is not specified in the URL.

REQUIRED

The .netrc file is required, and information in the URL is ignored.

NETRC_FILE <file>

Specify an alternative .netrc file to the one in your home directory if the NETRC level is OPTIONAL or REQUIRED. If this option is not specified, the value of the CMAKE_NETRC_FILE variable will be used instead (see file(DOWNLOAD))

Git

NOTE: A git version of 1.6.5 or later is required if this download method is used.

GIT_REPOSITORY <url>

URL of the git repository. Any URL understood by the git command may be used.

GIT_TAG <tag>

Git branch name, tag or commit hash. Note that branch names and tags should generally be specified as remote names (i.e. origin/myBranch rather than simply myBranch). This ensures that if the remote end has its tag moved or branch rebased or history rewritten, the local clone will still be updated correctly. In general, however, specifying a commit hash should be preferred for a number of reasons:

If the local clone already has the commit corresponding to the hash, no git fetch needs to be performed to check for changes each time CMake is re-run. This can result in a significant speed up if many external projects are being used.

Using a specific git hash ensures that the main project’s own history is fully traceable to a specific point in the external project’s evolution. If a branch or tag name is used instead, then checking out a specific commit of the main project doesn’t necessarily pin the whole build to a specific point in the life of the external project. The lack of such deterministic behavior makes the main project lose traceability and repeatability.

GIT_REMOTE_NAME <name>

The optional name of the remote. If this option is not specified, it defaults to origin.

GIT_SUBMODULES <module>...

Specific git submodules that should also be updated. If this option is not provided, all git submodules will be updated.

GIT_SHALLOW <bool>

When this option is enabled, the git clone operation will be given the --depth 1 option. This performs a shallow clone, which avoids downloading the whole history and instead retrieves just the commit denoted by the GIT_TAG option.

GIT_PROGRESS <bool>

When enabled, this option instructs the git clone operation to report its progress by passing it the --progress option. Without this option, the clone step for large projects may appear to make the build stall, since nothing will be logged until the clone operation finishes. While this option can be used to provide progress to prevent the appearance of the build having stalled, it may also make the build overly noisy if lots of external projects are used.

GIT_CONFIG <option1> [<option2>...]

Specify a list of config options to pass to git clone. Each option listed will be transformed into its own --config <option> on the git clone command line, with each option required to be in the form key=value.

Subversion

SVN_REPOSITORY <url>

URL of the Subversion repository.

SVN_REVISION -r<rev>

Revision to checkout from the Subversion repository.

SVN_USERNAME <username>

Username for the Subversion checkout and update.

SVN_PASSWORD <password>

Password for the Subversion checkout and update.

SVN_TRUST_CERT <bool>

Specifies whether to trust the Subversion server site certificate. If enabled, the --trust-server-cert option is passed to the svn checkout and update commands.

Mercurial

HG_REPOSITORY <url>

URL of the mercurial repository.

HG_TAG <tag>

Mercurial branch name, tag or commit id.

CVS

CVS_REPOSITORY <cvsroot>

CVSROOT of the CVS repository.

CVS_MODULE <mod>

Module to checkout from the CVS repository.

CVS_TAG <tag>

Tag to checkout from the CVS repository.

Update/Patch Step Options:

Whenever CMake is re-run, by default the external project’s sources will be updated if the download method supports updates (e.g. a git repository would be checked if the GIT_TAG does not refer to a specific commit).

UPDATE_COMMAND <cmd>...

Overrides the download method’s update step with a custom command. The command may use generator expressions.

UPDATE_DISCONNECTED <bool>

When enabled, this option causes the update step to be skipped. It does not, however, prevent the download step. The update step can still be added as a step target (see ExternalProject_Add_StepTargets()) and called manually. This is useful if you want to allow developers to build the project when disconnected from the network (the network may still be needed for the download step though).

When this option is present, it is generally advisable to make the value a cache variable under the developer’s control rather than hard-coding it. If this option is not present, the default value is taken from the EP_UPDATE_DISCONNECTED directory property. If that is also not defined, updates are performed as normal. The EP_UPDATE_DISCONNECTED directory property is intended as a convenience for controlling the UPDATE_DISCONNECTED behavior for an entire section of a project’s directory hierarchy and may be a more convenient method of giving developers control over whether or not to perform updates (assuming the project also provides a cache variable or some other convenient method for setting the directory property).

PATCH_COMMAND <cmd>...

Specifies a custom command to patch the sources after an update. By default, no patch command is defined. Note that it can be quite difficult to define an appropriate patch command that performs robustly, especially for download methods such as git where changing the GIT_TAG will not discard changes from a previous patch, but the patch command will be called again after updating to the new tag.

Configure Step Options:

The configure step is run after the download and update steps. By default, the external project is assumed to be a CMake project, but this can be overridden if required.

CONFIGURE_COMMAND <cmd>...

The default configure command runs CMake with options based on the main project. For non-CMake external projects, the CONFIGURE_COMMAND option must be used to override this behavior (generator expressions are supported). For projects that require no configure step, specify this option with an empty string as the command to execute.

CMAKE_COMMAND /.../cmake

Specify an alternative cmake executable for the configure step (use an absolute path). This is generally not recommended, since it is usually desirable to use the same CMake version throughout the whole build. This option is ignored if a custom configure command has been specified with CONFIGURE_COMMAND.

CMAKE_GENERATOR <gen>

Override the CMake generator used for the configure step. Without this option, the same generator as the main build will be used. This option is ignored if a custom configure command has been specified with the CONFIGURE_COMMAND option.

CMAKE_GENERATOR_PLATFORM <platform>

Pass a generator-specific platform name to the CMake command (see CMAKE_GENERATOR_PLATFORM). It is an error to provide this option without the CMAKE_GENERATOR option.

CMAKE_GENERATOR_TOOLSET <toolset>

Pass a generator-specific toolset name to the CMake command (see CMAKE_GENERATOR_TOOLSET). It is an error to provide this option without the CMAKE_GENERATOR option.

CMAKE_GENERATOR_INSTANCE <instance>

Pass a generator-specific instance selection to the CMake command (see CMAKE_GENERATOR_INSTANCE). It is an error to provide this option without the CMAKE_GENERATOR option.

CMAKE_ARGS <arg>...

The specified arguments are passed to the cmake command line. They can be any argument the cmake command understands, not just cache values defined by -D... arguments (see also CMake Options). In addition, arguments may use generator expressions.

CMAKE_CACHE_ARGS <arg>...

This is an alternate way of specifying cache variables where command line length issues may become a problem. The arguments are expected to be in the form -Dvar:STRING=value, which are then transformed into CMake set() commands with the FORCE option used. These set() commands are written to a pre-load script which is then applied using the cmake -C command line option. Arguments may use generator expressions.

CMAKE_CACHE_DEFAULT_ARGS <arg>...

This is the same as the CMAKE_CACHE_ARGS option except the set() commands do not include the FORCE keyword. This means the values act as initial defaults only and will not override any variables already set from a previous run. Use this option with care, as it can lead to different behavior depending on whether the build starts from a fresh build directory or re-uses previous build contents.

SOURCE_SUBDIR <dir>

When no CONFIGURE_COMMAND option is specified, the configure step assumes the external project has a CMakeLists.txt file at the top of its source tree (i.e. in SOURCE_DIR). The SOURCE_SUBDIR option can be used to point to an alternative directory within the source tree to use as the top of the CMake source tree instead. This must be a relative path and it will be interpreted as being relative to SOURCE_DIR.

Build Step Options:

If the configure step assumed the external project uses CMake as its build system, the build step will also. Otherwise, the build step will assume a Makefile-based build and simply run make with no arguments as the default build step. This can be overridden with custom build commands if required.

BUILD_COMMAND <cmd>...

Overrides the default build command (generator expressions are supported). If this option is not given, the default build command will be chosen to integrate with the main build in the most appropriate way (e.g. using recursive make for Makefile generators or cmake --build if the project uses a CMake build). This option can be specified with an empty string as the command to make the build step do nothing.

BUILD_IN_SOURCE <bool>

When this option is enabled, the build will be done directly within the external project’s source tree. This should generally be avoided, the use of a separate build directory is usually preferred, but it can be useful when the external project assumes an in-source build. The BINARY_DIR option should not be specified if building in-source.

BUILD_ALWAYS <bool>

Enabling this option forces the build step to always be run. This can be the easiest way to robustly ensure that the external project’s own build dependencies are evaluated rather than relying on the default success timestamp-based method. This option is not normally needed unless developers are expected to modify something the external project’s build depends on in a way that is not detectable via the step target dependencies (e.g. SOURCE_DIR is used without a download method and developers might modify the sources in SOURCE_DIR).

BUILD_BYPRODUCTS <file>...

Specifies files that will be generated by the build command but which might or might not have their modification time updated by subsequent builds. These ultimately get passed through as BYPRODUCTS to the build step’s own underlying call to add_custom_command().

Install Step Options:

If the configure step assumed the external project uses CMake as its build system, the install step will also. Otherwise, the install step will assume a Makefile-based build and simply run make install as the default build step. This can be overridden with custom install commands if required.

INSTALL_COMMAND <cmd>...

The external project’s own install step is invoked as part of the main project’s build. It is done after the external project’s build step and may be before or after the external project’s test step (see the TEST_BEFORE_INSTALL option below). The external project’s install rules are not part of the main project’s install rules, so if anything from the external project should be installed as part of the main build, these need to be specified in the main build as additional install() commands. The default install step builds the install target of the external project, but this can be overridden with a custom command using this option (generator expressions are supported). Passing an empty string as the <cmd> makes the install step do nothing.

Test Step Options:

The test step is only defined if at least one of the following TEST_... options are provided.

TEST_COMMAND <cmd>...

Overrides the default test command (generator expressions are supported). If this option is not given, the default behavior of the test step is to build the external project’s own test target. This option can be specified with <cmd> as an empty string, which allows the test step to still be defined, but it will do nothing. Do not specify any of the other TEST_... options if providing an empty string as the test command, but prefer to omit all TEST_... options altogether if the test step target is not needed.

TEST_BEFORE_INSTALL <bool>

When this option is enabled, the test step will be executed before the install step. The default behavior is for the test step to run after the install step.

TEST_AFTER_INSTALL <bool>

This option is mainly useful as a way to indicate that the test step is desired but all default behavior is sufficient. Specifying this option with a boolean true value ensures the test step is defined and that it comes after the install step. If both TEST_BEFORE_INSTALL and TEST_AFTER_INSTALL are enabled, the latter is silently ignored.

TEST_EXCLUDE_FROM_MAIN <bool>

If enabled, the main build’s default ALL target will not depend on the test step. This can be a useful way of ensuring the test step is defined but only gets invoked when manually requested.

Output Logging Options:

Each of the following LOG_... options can be used to wrap the relevant step in a script to capture its output to files. The log files will be created in the STAMP_DIR directory with step-specific file names.

LOG_DOWNLOAD <bool>

When enabled, the output of the download step is logged to files.

LOG_UPDATE <bool>

When enabled, the output of the update step is logged to files.

LOG_CONFIGURE <bool>

When enabled, the output of the configure step is logged to files.

LOG_BUILD <bool>

When enabled, the output of the build step is logged to files.

LOG_INSTALL <bool>

When enabled, the output of the install step is logged to files.

LOG_TEST <bool>

When enabled, the output of the test step is logged to files.

Terminal Access Options:

Steps can be given direct access to the terminal in some cases. Giving a step access to the terminal may allow it to receive terminal input if required, such as for authentication details not provided by other options. With the Ninja generator, these options place the steps in the console job pool. Each step can be given access to the terminal individually via the following options:

USES_TERMINAL_DOWNLOAD <bool>

Give the download step access to the terminal.

USES_TERMINAL_UPDATE <bool>

Give the update step access to the terminal.

USES_TERMINAL_CONFIGURE <bool>

Give the configure step access to the terminal.

USES_TERMINAL_BUILD <bool>

Give the build step access to the terminal.

USES_TERMINAL_INSTALL <bool>

Give the install step access to the terminal.

USES_TERMINAL_TEST <bool>

Give the test step access to the terminal.

Target Options:

DEPENDS <targets>...

Specify other targets on which the external project depends. The other targets will be brought up to date before any of the external project’s steps are executed. Because the external project uses additional custom targets internally for each step, the DEPENDS option is the most convenient way to ensure all of those steps depend on the other targets. Simply doing add_dependencies(<name> <targets>) will not make any of the steps dependent on <targets>.

EXCLUDE_FROM_ALL <bool>

When enabled, this option excludes the external project from the default ALL target of the main build.

STEP_TARGETS <step-target>...

Generate custom targets for the specified steps. This is required if the steps need to be triggered manually or if they need to be used as dependencies of other targets. If this option is not specified, the default value is taken from the EP_STEP_TARGETS directory property. See ExternalProject_Add_Step() below for further discussion of the effects of this option.

INDEPENDENT_STEP_TARGETS <step-target>...

Generate custom targets for the specified steps and prevent these targets from having the usual dependencies applied to them. If this option is not specified, the default value is taken from the EP_INDEPENDENT_STEP_TARGETS directory property. This option is mostly useful for allowing individual steps to be driven independently, such as for a CDash setup where each step should be initiated and reported individually rather than as one whole build. See ExternalProject_Add_Step() below for further discussion of the effects of this option.

Miscellaneous Options:

LIST_SEPARATOR <sep>

For any of the various ..._COMMAND options, replace ; with <sep> in the specified command lines. This can be useful where list variables may be given in commands where they should end up as space-separated arguments (<sep> would be a single space character string in this case).

COMMAND <cmd>...

Any of the other ..._COMMAND options can have additional commands appended to them by following them with as many COMMAND ... options as needed (generator expressions are supported). For example:

The function stores property values in variables of the same name. Property names correspond to the keyword argument names of ExternalProject_Add(). For example, the source directory might be retrieved like so:

The ExternalProject_Add() function on its own is often sufficient for incorporating an external project into the main build. Certain scenarios require additional work to implement desired behavior, such as adding in a custom step or making steps available as manually triggerable targets. The ExternalProject_Add_Step(), ExternalProject_Add_StepTargets() and ExternalProject_Add_StepDependencies functions provide the lower level control needed to implement such step-level capabilities.

ExternalProject_Add_Step

The ExternalProject_Add_Step() function specifies an additional custom step for an external project defined by an earlier call to ExternalProject_Add():

ExternalProject_Add_Step(<name> <step> [<option>...])

<name> is the same as the name passed to the original call to ExternalProject_Add(). The specified <step> must not be one of the pre-defined steps (mkdir, download, update, skip-update, patch, configure, build, install or test). The supported options are:

COMMAND <cmd>...

The command line to be executed by this custom step (generator expressions are supported). This option can be repeated multiple times to specify multiple commands to be executed in order.

COMMENT <text>...

Text to be printed when the custom step executes.

DEPENDEES <step>...

Other steps (custom or pre-defined) on which this step depends.

DEPENDERS <step>...

Other steps (custom or pre-defined) that depend on this new custom step.

DEPENDS <file>...

Files on which this custom step depends.

BYPRODUCTS <file>...

Files that will be generated by this custom step but which might or might not have their modification time updated by subsequent builds. This list of files will ultimately be passed through as the BYPRODUCTS option to the add_custom_command() used to implement the custom step internally.

ALWAYS <bool>

When enabled, this option specifies that the custom step should always be run (i.e. that it is always considered out of date).

EXCLUDE_FROM_MAIN <bool>

When enabled, this option specifies that the external project’s main target does not depend on the custom step.

WORKING_DIRECTORY <dir>

Specifies the working directory to set before running the custom step’s command. If this option is not specified, the directory will be the value of the CMAKE_CURRENT_BINARY_DIR at the point where ExternalProject_Add_Step() was called.

LOG <bool>

If set, this causes the output from the custom step to be captured to files in the external project’s STAMP_DIR.

USES_TERMINAL <bool>

If enabled, this gives the custom step direct access to the terminal if possible.

The command line, comment, working directory and byproducts of every standard and custom step are processed to replace the tokens <SOURCE_DIR>, <SOURCE_SUBDIR>, <BINARY_DIR>, <INSTALL_DIR> <TMP_DIR>, <DOWNLOAD_DIR> and <DOWNLOADED_FILE> with their corresponding property values defined in the original call to ExternalProject_Add().

ExternalProject_Add_StepTargets

The ExternalProject_Add_StepTargets() function generates targets for the steps listed. The name of each created target will be of the form <name>-<step>:

Creating a target for a step allows it to be used as a dependency of another target or to be triggered manually. Having targets for specific steps also allows them to be driven independently of each other by specifying targets on build command lines. For example, you may be submitting to a sub-project based dashboard where you want to drive the configure portion of the build, then submit to the dashboard, followed by the build portion, followed by tests. If you invoke a custom target that depends on a step halfway through the step dependency chain, then all the previous steps will also run to ensure everything is up to date.

If the NO_DEPENDS option is specified, the step target will not depend on the dependencies of the external project (i.e. on any dependencies of the <name> custom target created by ExternalProject_Add()). This is usually safe for the download, update and patch steps, since they do not typically require that the dependencies are updated and built. Using NO_DEPENDS for any of the other pre-defined steps, however, may break parallel builds. Only use NO_DEPENDS where it is certain that the named steps genuinely do not have dependencies. For custom steps, consider whether or not the custom commands require the dependencies to be configured, built and installed.

Internally, ExternalProject_Add() calls ExternalProject_Add_Step() to create each step. If any STEP_TARGETS or INDEPENDENT_STEP_TARGETS were specified, then ExternalProject_Add_StepTargets() will also be called after ExternalProject_Add_Step(). INDEPENDENT_STEP_TARGETS have the NO_DEPENDS option set, whereas STEP_TARGETS do not. Other than that, the two options result in ExternalProject_Add_StepTargets() being called in the same way. Even if a step is not mentioned in either of those two options, ExternalProject_Add_StepTargets() can still be called later to manually define a target for the step.

The STEP_TARGETS and INDEPENDENT_STEP_TARGETS options for ExternalProject_Add() are generally the easiest way to ensure targets are created for specific steps of interest. For custom steps, ExternalProject_Add_StepTargets() must be called explicitly if a target should also be created for that custom step. An alternative to these two options is to populate the EP_STEP_TARGETS and EP_INDEPENDENT_STEP_TARGETS directory properties. These act as defaults for the step target options and can save having to repeatedly specify the same set of step targets when multiple external projects are being defined.

ExternalProject_Add_StepDependencies

The ExternalProject_Add_StepDependencies() function can be used to add dependencies to a step. The dependencies added must be targets CMake already knows about (these can be ordinary executable or library targets, custom targets or even step targets of another external project):

This function takes care to set both target and file level dependencies and will ensure that parallel builds will not break. It should be used instead of add_dependencies() whenever adding a dependency for some of the step targets generated by the ExternalProject module.

For the sake of the example, also define a second hypothetical external project called SecretSauce, which is downloaded from a web server. Two URLs are given to take advantage of a faster internal network if available, with a fallback to a slower external server. The project is a typical Makefile project with no configure step, so some of the default commands are overridden. The build is only required to build the sauce target:

Suppose the build step of secretsauce requires that foobar must already be built. This could be enforced like so:

ExternalProject_Add_StepDependencies(secretsauce build foobar)

Another alternative would be to create a custom target for foobar’s build step and make secretsauce depend on that rather than the whole foobar project. This would mean foobar only needs to be built, it doesn’t need to run its install or test steps before secretsauce can be built. The dependency can also be defined along with the secretsauce project:

If many external projects should have the same set of step targets, setting a directory property may be more convenient. The build step target could be created automatically by setting the EP_STEP_TARGETS directory property before creating the external projects with ExternalProject_Add():

set_property(DIRECTORY PROPERTY EP_STEP_TARGETS build)

Lastly, suppose that secretsauce provides a script called makedoc which can be used to generate its own documentation. Further suppose that the script expects the output directory to be provided as the only parameter and that it should be run from the secretsauce source directory. A custom step and a custom target to trigger the script can be defined like so:

The global property FeatureSummary_REQUIRED_PKG_TYPES defines which package types are required.

If one or more package in this categories has not been found, CMake will abort when calling feature_summary() with the ‘FATAL_ON_MISSING_REQUIRED_PACKAGES’ option enabled.

The default value for this global property is REQUIRED.

FeatureSummary_DEFAULT_PKG_TYPE

The global property FeatureSummary_DEFAULT_PKG_TYPE defines which package type is the default one. When calling feature_summary(), if the user did not set the package type explicitly, the package will be assigned to this category.

This value must be one of the types defined in the FeatureSummary_PKG_TYPES global property unless the package type is set for all the packages.

The default value for this global property is OPTIONAL.

FeatureSummary_<TYPE>_DESCRIPTION

The global property FeatureSummary_<TYPE>_DESCRIPTION can be defined for each type to replace the type name with the specified string whenever the package type is used in an output string.

The feature_summary() macro can be used to print information about enabled or disabled packages or features of a project. By default, only the names of the features/packages will be printed and their required version when one was specified. Use set_package_properties() to add more useful information, like e.g. a download URL for the respective package or their purpose in the project.

The WHAT option is the only mandatory option. Here you specify what information will be printed:

ALL

print everything

ENABLED_FEATURES

the list of all features which are enabled

DISABLED_FEATURES

the list of all features which are disabled

PACKAGES_FOUND

the list of all packages which have been found

PACKAGES_NOT_FOUND

the list of all packages which have not been found

For each package type <TYPE> defined by the FeatureSummary_PKG_TYPES global property, the following information can also be used:

<TYPE>_PACKAGES_FOUND

only those packages which have been found which have the type <TYPE>

<TYPE>_PACKAGES_NOT_FOUND

only those packages which have not been found which have the type <TYPE>

With the exception of the ALL value, these values can be combined in order to customize the output. For example:

feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)

If a FILENAME is given, the information is printed into this file. If APPEND is used, it is appended to this file, otherwise the file is overwritten if it already existed. If the VAR option is used, the information is “printed” into the specified variable. If FILENAME is not used, the information is printed to the terminal. Using the DESCRIPTION option a description or headline can be set which will be printed above the actual content. If only one type of package was requested, no title is printed, unless it is explicitly set using either DESCRIPTION to use a custom string, or DEFAULT_DESCRIPTION to use a default title for the requested type. If INCLUDE_QUIET_PACKAGES is given, packages which have been searched with find_package(... QUIET) will also be listed. By default they are skipped. If FATAL_ON_MISSING_REQUIRED_PACKAGES is given, CMake will abort if a package which is marked as one of the package types listed in the FeatureSummary_REQUIRED_PKG_TYPES global property has not been found. The default value for the FeatureSummary_REQUIRED_PKG_TYPES global property is REQUIRED.

The FeatureSummary_DEFAULT_PKG_TYPE global property can be modified to change the default package type assigned when not explicitly assigned by the user.

If the QUIET_ON_EMPTY option is used, if only one type of package was requested, and no packages belonging to that category were found, then no output (including the DESCRIPTION) is printed or added to the VAR variable.

Use this macro to set up information about the named package, which can then be displayed via FEATURE_SUMMARY(). This can be done either directly in the Find-module or in the project which uses the module after the find_package() call. The features for which information can be set are added automatically by the find_package() command.

URL <url>

This should be the homepage of the package, or something similar. Ideally this is set already directly in the Find-module.

DESCRIPTION <description>

A short description what that package is, at most one sentence. Ideally this is set already directly in the Find-module.

TYPE <type>

What type of dependency has the using project on that package. Default is OPTIONAL. In this case it is a package which can be used by the project when available at buildtime, but it also work without. RECOMMENDED is similar to OPTIONAL, i.e. the project will build if the package is not present, but the functionality of the resulting binaries will be severely limited. If a REQUIRED package is not available at buildtime, the project may not even build. This can be combined with the FATAL_ON_MISSING_REQUIRED_PACKAGES argument for feature_summary(). Last, a RUNTIME package is a package which is actually not used at all during the build, but which is required for actually running the resulting binaries. So if such a package is missing, the project can still be built, but it may not work later on. If set_package_properties() is called multiple times for the same package with different TYPEs, the TYPE is only changed to higher TYPEs (RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED), lower TYPEs are ignored. The TYPE property is project-specific, so it cannot be set by the Find-module, but must be set in the project. Type accepted can be changed by setting the FeatureSummary_PKG_TYPES global property.

PURPOSE <purpose>

This describes which features this package enables in the project, i.e. it tells the user what functionality he gets in the resulting binaries. If set_package_properties() is called multiple times for a package, all PURPOSE properties are appended to a list of purposes of the package in the project. As the TYPE property, also the PURPOSE property is project-specific, so it cannot be set by the Find-module, but must be set in the project.

Use this macro to add information about a feature with the given <name>. <enabled> contains whether this feature is enabled or not. It can be a variable or a list of conditions. <description> is a text describing the feature. The information can be displayed using feature_summary() for ENABLED_FEATURES and DISABLED_FEATURES respectively.

The following macros are provided for compatibility with previous CMake versions:

set_package_info

set_package_info(<name> <description> [ <url> [<purpose>] ])

Use this macro to set up information about the named package, which can then be displayed via feature_summary(). This can be done either directly in the Find-module or in the project which uses the module after the find_package() call. The features for which information can be set are added automatically by the find_package() command.

This module enables populating content at configure time via any method supported by the ExternalProject module. Whereas ExternalProject_Add() downloads at build time, the FetchContent module makes content available immediately, allowing the configure step to use the content in commands like add_subdirectory(), include() or file() operations.

Content population details would normally be defined separately from the command that performs the actual population. Projects should also check whether the content has already been populated somewhere else in the project hierarchy. Typical usage would look something like this:

When using the above pattern with a hierarchical project arrangement, projects at higher levels in the hierarchy are able to define or override the population details of content specified anywhere lower in the project hierarchy. The ability to detect whether content has already been populated ensures that even if multiple child projects want certain content to be available, the first one to populate it wins. The other child project can simply make use of the already available content instead of repeating the population for itself. See the Examples section which demonstrates this scenario.

The FetchContent module also supports defining and populating content in a single call, with no check for whether the content has been populated elsewhere in the project already. This is a more low level operation and would not normally be the way the module is used, but it is sometimes useful as part of implementing some higher level feature or to populate some content in CMake’s script mode.

The FetchContent_Declare() function records the options that describe how to populate the specified content, but if such details have already been recorded earlier in this project (regardless of where in the project hierarchy), this and all later calls for the same content <name> are ignored. This “first to record, wins” approach is what allows hierarchical projects to have parent projects override content details of child projects.

The content <name> can be any string without spaces, but good practice would be to use only letters, numbers and underscores. The name will be treated case-insensitively and it should be obvious for the content it represents, often being the name of the child project or the value given to its top level project() command (if it is a CMake project). For well-known public projects, the name should generally be the official name of the project. Choosing an unusual name makes it unlikely that other projects needing that same content will use the same name, leading to the content being populated multiple times.

The <contentOptions> can be any of the download or update/patch options that the ExternalProject_Add() command understands. The configure, build, install and test steps are explicitly disabled and therefore options related to them will be ignored. In most cases, <contentOptions> will just be a couple of options defining the download method and method-specific details like a commit tag or archive hash. For example:

In most cases, the only argument given to FetchContent_Populate() is the <name>. When used this way, the command assumes the content details have been recorded by an earlier call to FetchContent_Declare(). The details are stored in a global property, so they are unaffected by things like variable or directory scope. Therefore, it doesn’t matter where in the project the details were previously declared, as long as they have been declared before the call to FetchContent_Populate(). Those saved details are then used to construct a call to ExternalProject_Add() in a private sub-build to perform the content population immediately. The implementation of ExternalProject_Add() ensures that if the content has already been populated in a previous CMake run, that content will be reused rather than repopulating them again. For the common case where population involves downloading content, the cost of the download is only paid once.

An internal global property records when a particular content population request has been processed. If FetchContent_Populate() is called more than once for the same content name within a configure run, the second call will halt with an error. Projects can and should check whether content population has already been processed with the FetchContent_GetProperties() command before calling FetchContent_Populate().

FetchContent_Populate() will set three variables in the scope of the caller; <lcName>_POPULATED, <lcName>_SOURCE_DIR and <lcName>_BINARY_DIR, where <lcName> is the lowercased <name>. <lcName>_POPULATED will always be set to True by the call. <lcName>_SOURCE_DIR is the location where the content can be found upon return (it will have already been populated), while <lcName>_BINARY_DIR is a directory intended for use as a corresponding build directory. The main use case for the two directory variables is to call add_subdirectory() immediately after population, i.e.:

The values of the three variables can also be retrieved from anywhere in the project hierarchy using the FetchContent_GetProperties() command.

A number of cache variables influence the behavior of all content population performed using details saved from a FetchContent_Declare() call:

FETCHCONTENT_BASE_DIR

In most cases, the saved details do not specify any options relating to the directories to use for the internal sub-build, final source and build areas. It is generally best to leave these decisions up to the FetchContent module to handle on the project’s behalf. The FETCHCONTENT_BASE_DIR cache variable controls the point under which all content population directories are collected, but in most cases developers would not need to change this. The default location is ${CMAKE_BINARY_DIR}/_deps, but if developers change this value, they should aim to keep the path short and just below the top level of the build tree to avoid running into path length problems on Windows.

FETCHCONTENT_QUIET

The logging output during population can be quite verbose, making the configure stage quite noisy. This cache option (ON by default) hides all population output unless an error is encountered. If experiencing problems with hung downloads, temporarily switching this option off may help diagnose which content population is causing the issue.

FETCHCONTENT_FULLY_DISCONNECTED

When this option is enabled, no attempt is made to download or update any content. It is assumed that all content has already been populated in a previous run or the source directories have been pointed at existing contents the developer has provided manually (using options described further below). When the developer knows that no changes have been made to any content details, turning this option ON can significantly speed up the configure stage. It is OFF by default.

FETCHCONTENT_UPDATES_DISCONNECTED

This is a less severe download/update control compared to FETCHCONTENT_FULLY_DISCONNECTED. Instead of bypassing all download and update logic, the FETCHCONTENT_UPDATES_DISCONNECTED only disables the update stage. Therefore, if content has not been downloaded previously, it will still be downloaded when this option is enabled. This can speed up the configure stage, but not as much as FETCHCONTENT_FULLY_DISCONNECTED. It is OFF by default.

In addition to the above cache variables, the following cache variables are also defined for each content name (<ucName> is the uppercased value of <name>):

FETCHCONTENT_SOURCE_DIR_<ucName>

If this is set, no download or update steps are performed for the specified content and the <lcName>_SOURCE_DIR variable returned to the caller is pointed at this location. This gives developers a way to have a separate checkout of the content that they can modify freely without interference from the build. The build simply uses that existing source, but it still defines <lcName>_BINARY_DIR to point inside its own build area. Developers are strongly encouraged to use this mechanism rather than editing the sources populated in the default location, as changes to sources in the default location can be lost when content population details are changed by the project.

FETCHCONTENT_UPDATES_DISCONNECTED_<ucName>

This is the per-content equivalent of FETCHCONTENT_UPDATES_DISCONNECTED. If the global option or this option is ON, then updates will be disabled for the named content. Disabling updates for individual content can be useful for content whose details rarely change, while still leaving other frequently changing content with updates enabled.

The FetchContent_Populate() command also supports a syntax allowing the content details to be specified directly rather than using any saved details. This is more low-level and use of this form is generally to be avoided in favour of using saved content details as outlined above. Nevertheless, in certain situations it can be useful to invoke the content population as an isolated operation (typically as part of implementing some other higher level feature or when using CMake in script mode):

This form has a number of key differences to that where only <name> is provided:

All required population details are assumed to have been provided directly in the call to FetchContent_Populate(). Any saved details for <name> are ignored.

No check is made for whether content for <name> has already been populated.

No global property is set to record that the population has occurred.

No global properties record the source or binary directories used for the populated content.

The FETCHCONTENT_FULLY_DISCONNECTED and FETCHCONTENT_UPDATES_DISCONNECTED cache variables are ignored.

The <lcName>_SOURCE_DIR and <lcName>_BINARY_DIR variables are still returned to the caller, but since these locations are not stored as global properties when this form is used, they are only available to the calling scope and below rather than the entire project hierarchy. No <lcName>_POPULATED variable is set in the caller’s scope with this form.

The supported options for FetchContent_Populate() are the same as those for FetchContent_Declare(). Those few options shown just above are either specific to FetchContent_Populate() or their behavior is slightly modified from how ExternalProject_Add() treats them.

QUIET

The QUIET option can be given to hide the output associated with populating the specified content. If the population fails, the output will be shown regardless of whether this option was given or not so that the cause of the failure can be diagnosed. The global FETCHCONTENT_QUIET cache variable has no effect on FetchContent_Populate() calls where the content details are provided directly.

SUBBUILD_DIR

The SUBBUILD_DIR argument can be provided to change the location of the sub-build created to perform the population. The default value is ${CMAKE_CURRENT_BINARY_DIR}/<lcName>-subbuild and it would be unusual to need to override this default. If a relative path is specified, it will be interpreted as relative to CMAKE_CURRENT_BINARY_DIR.

SOURCE_DIR, BINARY_DIR

The SOURCE_DIR and BINARY_DIR arguments are supported by ExternalProject_Add(), but different default values are used by FetchContent_Populate(). SOURCE_DIR defaults to ${CMAKE_CURRENT_BINARY_DIR}/<lcName>-src and BINARY_DIR defaults to ${CMAKE_CURRENT_BINARY_DIR}/<lcName>-build. If a relative path is specified, it will be interpreted as relative to CMAKE_CURRENT_BINARY_DIR.

In addition to the above explicit options, any other unrecognized options are passed through unmodified to ExternalProject_Add() to perform the download, patch and update steps. The following options are explicitly prohibited (they are disabled by the FetchContent_Populate() command):

CONFIGURE_COMMAND

BUILD_COMMAND

INSTALL_COMMAND

TEST_COMMAND

If using FetchContent_Populate() within CMake’s script mode, be aware that the implementation sets up a sub-build which therefore requires a CMake generator and build tool to be available. If these cannot be found by default, then the CMAKE_GENERATOR and/or CMAKE_MAKE_PROGRAM variables will need to be set appropriately on the command line invoking the script.

When using saved content details, a call to FetchContent_Populate() records information in global properties which can be queried at any time. This information includes the source and binary directories associated with the content and also whether or not the content population has been processed during the current configure run.

The SOURCE_DIR, BINARY_DIR and POPULATED options can be used to specify which properties should be retrieved. Each option accepts a value which is the name of the variable in which to store that property. Most of the time though, only <name> is given, in which case the call will then set the same variables as a call to FetchContent_Populate(name). This allows the following canonical pattern to be used, which ensures that the relevant variables will always be defined regardless of whether or not the population has been performed elsewhere in the project already:

FetchContent_GetProperties(foobar)
if(NOT foobar_POPULATED)
FetchContent_Populate(foobar)
# Set any custom variables, etc. here, then
# populate the content as part of this build
add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR})
endif()

The above pattern allows other parts of the overall project hierarchy to re-use the same content and ensure that it is only populated once.

Consider a project hierarchy where projA is the top level project and it depends on projects projB and projC. Both projB and projC can be built standalone and they also both depend on another project projD. For simplicity, this example will assume that all four projects are available on a company git server. The CMakeLists.txt of each project might have sections like the following:

projB and projC define different content details for projD, but projA also defines a set of content details for projD and because projA will define them first, the details from projB and projC will not be used. The override details defined by projA are not required to match either of those from projB or projC, but it is up to the higher level project to ensure that the details it does define still make sense for the child projects.

While projA defined content details for projD, it did not need to explicitly call FetchContent_Populate(projD) itself. Instead, it leaves that to a child project to do (in this case it will be projB since it is added to the build ahead of projC). If projA needed to customize how the projD content was brought into the build as well (e.g. define some CMake variables before calling add_subdirectory() after populating), it would do the call to FetchContent_Populate(), etc. just as it did for the projB and projC content. For higher level projects, it is usually enough to just define the override content details and leave the actual population to the child projects. This saves repeating the same thing at each level of the project hierarchy unnecessarily.

Even though projA is the top level project in this example, it still checks whether projB and projC have already been populated before going ahead to do those populations. This makes projA able to be more easily incorporated as a child of some other higher level project in the future if required. Always protect a call to FetchContent_Populate() with a check to FetchContent_GetProperties(), even in what may be considered a top level project at the time.

The following example demonstrates how one might download and unpack a firmware tarball using CMake’s script mode. The call to FetchContent_Populate() specifies all the content details and the unpacked firmware will be placed in a firmware directory below the current working directory.

ARMADILLO_FOUND - set to true if the library is found
ARMADILLO_INCLUDE_DIRS - list of required include directories
ARMADILLO_LIBRARIES - list of libraries to be linked
ARMADILLO_VERSION_MAJOR - major version number
ARMADILLO_VERSION_MINOR - minor version number
ARMADILLO_VERSION_PATCH - patch version number
ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4")
ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")

AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for i386 machines to use various AVI codecs. Support is limited beyond Linux. Windows provides native AVI support, and so doesn’t need this library. This module defines

AVIFILE_INCLUDE_DIR, where to find avifile.h , etc.
AVIFILE_LIBRARIES, the libraries to link against
AVIFILE_DEFINITIONS, definitions to use when compiling
AVIFILE_FOUND, If false, don't try to use AVIFILE

which will create a custom rule to generate a parser. <YaccInput> is the path to a yacc file. <CodeOutput> is the name of the source file generated by bison. A header file is also be generated, and contains the token list.

The options are:

COMPILE_FLAGS <flags>

Specify flags to be added to the bison command line.

DEFINES_FILE <file>

Specify a non-default header <file> to be generated by bison.

VERBOSE [<file>]

Tell bison to write a report file of the grammar and parser. If <file> is given, it specifies path the report file is copied to. [<file>] is left for backward compatibility of this module. Use VERBOSE REPORT_FILE <file>.

REPORT_FILE <file>

Specify a non-default report <file>, if generated.

The macro defines the following variables:

BISON_<Name>_DEFINED

true is the macro ran successfully

BISON_<Name>_INPUT

The input source file, an alias for <YaccInput>

BISON_<Name>_OUTPUT_SOURCE

The source file generated by bison

BISON_<Name>_OUTPUT_HEADER

The header file generated by bison

BISON_<Name>_OUTPUTS

All files generated by bison including the source, the header and the report

BLAS_FOUND - set to true if a library implementing the BLAS interface
is found
BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
and -L).
BLAS_LIBRARIES - uncached list of libraries (using full path name) to
link against to use BLAS (may be empty if compiler implicitly links
BLAS)
BLAS95_LIBRARIES - uncached list of libraries (using full path name)
to link against to use BLAS95 interface
BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
is found

The following variables can be used to control this module:

BLA_STATIC if set on this determines what kind of linkage we do (static)
BLA_VENDOR if set checks only the specified vendor, if not set checks
all the possibilities
BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS
library first and if one is found that is preferred

This module finds headers and requested component libraries OR a CMake package configuration file provided by a “Boost CMake” build. For the latter case skip to the “Boost CMake” section below. For the former case results are reported in variables:

Note that Boost Python components require a Python version suffix (Boost 1.67 and later), e.g. python36 or python27 for the versions built against Python 3.6 and 2.7, respectively. This also applies to additional components using Python including mpi_python and numpy. Earlier Boost releases may use distribution-specific suffixes such as 2, 3 or 2.7. These may also be used as suffixes, but note that they are not portable.

Implicit dependencies such as Boost::filesystem requiring Boost::system will be automatically detected and satisfied, even if system is not specified when using find_package and if Boost::system is not added to target_link_libraries. If using Boost::thread, then Threads::Threads will also be added automatically.

It is important to note that the imported targets behave differently than variables created by this module: multiple calls to find_package(Boost) in the same directory or sub-directories with different options (e.g. static or shared) will not override the values of the targets created by the first call.

Users may set these hints or results as cache entries. Projects should not read these entries directly but instead use the above result variables. Note that some hint names start in upper-case “BOOST”. One may specify these as environment variables if they are not specified as CMake variables or cache entries.

This module first searches for the Boost header files using the above hint variables (excluding BOOST_LIBRARYDIR) and saves the result in Boost_INCLUDE_DIR. Then it searches for requested component libraries using the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS), “lib” directories near Boost_INCLUDE_DIR, and the library name configuration settings below. It saves the library directories in Boost_LIBRARY_DIR_DEBUG and Boost_LIBRARY_DIR_RELEASE and individual library locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE. When one changes settings used by previous searches in the same build tree (excluding environment variables) this module discards previous search results affected by the changes and searches again.

Boost libraries come in many variants encoded in their file name. Users or projects may tell this module which variant to find by setting variables:

Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search
and use the debug libraries. Default is ON.
Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search
and use the release libraries. Default is ON.
Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded
libraries ('mt' tag). Default is ON.
Boost_USE_STATIC_LIBS - Set to ON to force the use of the static
libraries. Default is OFF.
Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
libraries linked statically to the C++ runtime
('s' tag). Default is platform dependent.
Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use
libraries linked to the MS debug C++ runtime
('g' tag). Default is ON.
Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a
debug Python build ('y' tag). Default is OFF.
Boost_USE_STLPORT - Set to ON to use libraries compiled with
STLPort ('p' tag). Default is OFF.
Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
- Set to ON to use libraries compiled with
STLPort deprecated "native iostreams"
('n' tag). Default is OFF.
Boost_COMPILER - Set to the compiler-specific library suffix
(e.g. "-gcc43"). Default is auto-computed
for the C++ compiler in use. A list may be
used if multiple compatible suffixes should
be tested for, in decreasing order of
preference.
Boost_ARCHITECTURE - Set to the architecture-specific library suffix
(e.g. "-x64"). Default is auto-computed for the
C++ compiler in use.
Boost_THREADAPI - Suffix for "thread" component library name,
such as "pthread" or "win32". Names with
and without this suffix will both be tried.
Boost_NAMESPACE - Alternate namespace used to build boost with
e.g. if set to "myboost", will search for
myboost_thread instead of boost_thread.

Other variables one may set to control this module are:

Boost_DEBUG - Set to ON to enable debug output from FindBoost.
Please enable this before filing any bug report.
Boost_DETAILED_FAILURE_MSG
- Set to ON to add detailed information to the
failure message even when the REQUIRED option
is not given to the find_package call.
Boost_REALPATH - Set to ON to resolve symlinks for discovered
libraries to assist with packaging. For example,
the "system" component library may be resolved to
"/usr/lib/libboost_system.so.1.67.0" instead of
"/usr/lib/libboost_system.so". This does not
affect linking and should not be enabled unless
the user needs this information.
Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
Boost_LIBRARY_DIR_DEBUG.

On Visual Studio and Borland compilers Boost headers request automatic linking to corresponding libraries. This requires matching libraries to be linked explicitly or available in the link library search path. In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking. Boost automatic linking typically requests static libraries with a few exceptions (such as Boost.Python). Use:

If Boost was built using the boost-cmake project it provides a package configuration file for use with find_package’s Config mode. This module looks for the package configuration file called BoostConfig.cmake or boost-config.cmake and stores the result in cache entry “Boost_DIR”. If found, the package configuration file is loaded and this module returns with no further action. See documentation of the Boost CMake package configuration for details on what it provides.

BULLET_FOUND - Was bullet found
BULLET_INCLUDE_DIRS - the Bullet include directories
BULLET_LIBRARIES - Link to this, by default it includes
all bullet components (Dynamics,
Collision, LinearMath, & SoftBody)

The FindCUDA module has been superseded by first-class support for the CUDA language in CMake. It is no longer necessary to use this module or call find_package(CUDA). This module now exists only for compatibility with projects that have not been ported.

Instead, list CUDA among the languages named in the top-level call to the project() command, or call the enable_language() command with CUDA. Then one can add CUDA (.cu) sources to programs directly in calls to add_library() and add_executable().

Tools for building CUDA C files: libraries and build dependencies.

This script locates the NVIDIA CUDA C tools. It should work on Linux, Windows, and macOS and should be reasonably up to date with CUDA C releases.

This script makes use of the standard find_package() arguments of <VERSION>, REQUIRED and QUIET. CUDA_FOUND will report if an acceptable version of CUDA was found.

The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix cannot be determined by the location of nvcc in the system path and REQUIRED is specified to find_package(). To use a different installed version of the toolkit set the environment variable CUDA_BIN_PATH before running cmake (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda) or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be relocated.

It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain platforms, or to use a CUDA runtime not installed in the default location. In newer versions of the toolkit the CUDA library is included with the graphics driver – be sure that the driver version matches what is needed by the CUDA runtime version.

The following variables affect the behavior of the macros in the script (in alphabetical order). Note that any of these flags can be changed multiple times in the same directory before calling CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX, CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS:

CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
-- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
Note that making this different from the host code when generating object
or C files from CUDA code just won't work, because size_t gets defined by
nvcc in the generated source. If you compile to PTX and then load the
file yourself, you can mix bit sizes between device and host.
CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
-- Set to ON if you want the custom build rule to be attached to the source
file in Visual Studio. Turn OFF if you add the same cuda file to multiple
targets.
This allows the user to build the target from the CUDA file; however, bad
things can happen if the CUDA source file is added to multiple targets.
When performing parallel builds it is possible for the custom build
command to be run more than once and in parallel causing cryptic build
errors. VS runs the rules for every source file in the target, and a
source can have only one rule no matter how many projects it is added to.
When the rule is run from multiple targets race conditions can occur on
the generated file. Eventually everything will get built, but if the user
is unaware of this behavior, there may be confusion. It would be nice if
this script could detect the reuse of source files across multiple targets
and turn the option off for the user, but no good solution could be found.
CUDA_BUILD_CUBIN (Default OFF)
-- Set to ON to enable and extra compilation pass with the -cubin option in
Device mode. The output is parsed and register, shared memory usage is
printed during build.
CUDA_BUILD_EMULATION (Default OFF for device mode)
-- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
when CUDA_BUILD_EMULATION is TRUE.
CUDA_LINK_LIBRARIES_KEYWORD (Default "")
-- The <PRIVATE|PUBLIC|INTERFACE> keyword to use for internal
target_link_libraries calls. The default is to use no keyword which
uses the old "plain" form of target_link_libraries. Note that is matters
because whatever is used inside the FindCUDA module must also be used
outside - the two forms of target_link_libraries cannot be mixed.
CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
-- Set to the path you wish to have the generated files placed. If it is
blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
Intermediate files will always be placed in
CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
CUDA_HOST_COMPILATION_CPP (Default ON)
-- Set to OFF for C compilation of host code.
CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER)
-- Set the host compiler to be used by nvcc. Ignored if -ccbin or
--compiler-bindir is already present in the CUDA_NVCC_FLAGS or
CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets,
the host compiler is constructed with one or more visual studio macros
such as $(VCInstallDir), that expands out to the path when
the command is run from within VS.
If the CUDAHOSTCXX environment variable is set it will
be used as the default.
CUDA_NVCC_FLAGS
CUDA_NVCC_FLAGS_<CONFIG>
-- Additional NVCC command line arguments. NOTE: multiple arguments must be
semi-colon delimited (e.g. --compiler-options;-Wall)
CUDA_PROPAGATE_HOST_FLAGS (Default ON)
-- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
host compiler through nvcc's -Xcompiler flag. This helps make the
generated host code match the rest of the system better. Sometimes
certain flags give nvcc problems, and this will help you turn the flag
propagation off. This does not affect the flags supplied directly to nvcc
via CUDA_NVCC_FLAGS or through the OPTION flags specified through
CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
shared library compilation are not affected by this flag.
CUDA_SEPARABLE_COMPILATION (Default OFF)
-- If set this will enable separable compilation for all CUDA runtime object
files. If used outside of CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY
(e.g. calling CUDA_WRAP_SRCS directly),
CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called.
CUDA_SOURCE_PROPERTY_FORMAT
-- If this source file property is set, it can override the format specified
to CUDA_WRAP_SRCS (OBJ, PTX, CUBIN, or FATBIN). If an input source file
is not a .cu file, setting this file will cause it to be treated as a .cu
file. See documentation for set_source_files_properties on how to set
this property.
CUDA_USE_STATIC_CUDA_RUNTIME (Default ON)
-- When enabled the static version of the CUDA runtime library will be used
in CUDA_LIBRARIES. If the version of CUDA configured doesn't support
this option, then it will be silently disabled.
CUDA_VERBOSE_BUILD (Default OFF)
-- Set to ON to see all the commands used when building the CUDA file. When
using a Makefile generator the value defaults to VERBOSE (run make
VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
always print the output.

The script creates the following macros (in alphabetical order):

CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
-- Adds the cufft library to the target (can be any target). Handles whether
you are in emulation mode or not.
CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
-- Adds the cublas library to the target (can be any target). Handles
whether you are in emulation mode or not.
CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
[WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
-- Creates an executable "cuda_target" which is made up of the files
specified. All of the non CUDA C files are compiled using the standard
build rules specified by CMAKE and the cuda files are compiled to object
files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is
added automatically to include_directories(). Some standard CMake target
calls can be used on the target after calling this macro
(e.g. set_target_properties and target_link_libraries), but setting
properties that adjust compilation flags will not affect code compiled by
nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
[STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
-- Same as CUDA_ADD_EXECUTABLE except that a library is created.
CUDA_BUILD_CLEAN_TARGET()
-- Creates a convenience target that deletes all the dependency files
generated. You should make clean after running this target to ensure the
dependency files get regenerated.
CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
[OPTIONS ...] )
-- Returns a list of generated files from the input source files to be used
with ADD_LIBRARY or ADD_EXECUTABLE.
CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
-- Returns a list of PTX files generated from the input source files.
CUDA_COMPILE_FATBIN( generated_files file0 file1 ... [OPTIONS ...] )
-- Returns a list of FATBIN files generated from the input source files.
CUDA_COMPILE_CUBIN( generated_files file0 file1 ... [OPTIONS ...] )
-- Returns a list of CUBIN files generated from the input source files.
CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var
cuda_target
object_files )
-- Compute the name of the intermediate link file used for separable
compilation. This file name is typically passed into
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS. output_file_var is produced
based on cuda_target the list of objects files that need separable
compilation as specified by object_files. If the object_files list is
empty, then output_file_var will be empty. This function is called
automatically for CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE. Note that
this is a function and not a macro.
CUDA_INCLUDE_DIRECTORIES( path0 path1 ... )
-- Sets the directories that should be passed to nvcc
(e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu
files.
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target
nvcc_flags object_files)
-- Generates the link object required by separable compilation from the given
object files. This is called automatically for CUDA_ADD_EXECUTABLE and
CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS
directly. When called from CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE the
nvcc_flags passed in are the same as the flags passed in via the OPTIONS
argument. The only nvcc flag added automatically is the bitness flag as
specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function
instead of a macro.
CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures])
-- Selects GPU arch flags for nvcc based on target_CUDA_architectures
target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...)
- "Auto" detects local machine GPU compute arch at runtime.
- "Common" and "All" cover common and entire subsets of architectures
ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
NUM: Any number. Only those pairs are currently accepted by NVCC though:
2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2
Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
Additionally, sets ${out_variable}_readable to the resulting numeric list
Example:
CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
Note that this is a function instead of a macro.
CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
[STATIC | SHARED | MODULE] [OPTIONS ...] )
-- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
function under the hood.
Given the list of files (file0 file1 ... fileN) this macro generates
custom commands that generate either PTX or linkable objects (use "PTX" or
"OBJ" for the format argument to switch). Files that don't end with .cu
or have the HEADER_FILE_ONLY property are ignored.
The arguments passed in after OPTIONS are extra command line options to
give to nvcc. You can also specify per configuration options by
specifying the name of the configuration followed by the options. General
options must precede configuration specific options. Not all
configurations need to be specified, only the ones provided will be used.
OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
DEBUG -g
RELEASE --use_fast_math
RELWITHDEBINFO --use_fast_math;-g
MINSIZEREL --use_fast_math
For certain configurations (namely VS generating object files with
CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
be produced for the given cuda file. This is because when you add the
cuda file to Visual Studio it knows that this file produces an object file
and will link in the resulting object file automatically.
This script will also generate a separate cmake script that is used at
build time to invoke nvcc. This is for several reasons.
1. nvcc can return negative numbers as return values which confuses
Visual Studio into thinking that the command succeeded. The script now
checks the error codes and produces errors when there was a problem.
2. nvcc has been known to not delete incomplete results when it
encounters problems. This confuses build systems into thinking the
target was generated when in fact an unusable file exists. The script
now deletes the output files if there was an error.
3. By putting all the options that affect the build into a file and then
make the build rule dependent on the file, the output files will be
regenerated when the options change.
This script also looks at optional arguments STATIC, SHARED, or MODULE to
determine when to target the object compilation for a shared library.
BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
CUDA_ADD_LIBRARY. On some systems special flags are added for building
objects intended for shared libraries. A preprocessor macro,
<target_name>_EXPORTS is defined when a shared library compilation is
detected.
Flags passed into add_definitions with -D or /D are passed along to nvcc.

The script defines the following variables:

CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
CUDA_VERSION_MINOR -- The minor version.
CUDA_VERSION
CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
CUDA_HAS_FP16 -- Whether a short float (float16,fp16) is supported.
CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
SDK. This script will not directly support finding
specific libraries or headers, as that isn't
supported by NVIDIA. If you want to change
libraries when the path changes see the
FindCUDA.cmake script for an example of how to clear
these variables. There are also examples of how to
use the CUDA_SDK_ROOT_DIR to locate headers or
libraries, if you so choose (at your own risk).
CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically
for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY.
CUDA_LIBRARIES -- Cuda RT library.
CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT
implementation (alternative to:
CUDA_ADD_CUFFT_TO_TARGET macro)
CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS
implementation (alternative to:
CUDA_ADD_CUBLAS_TO_TARGET macro).
CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library.
Only available for CUDA version 5.5+
CUDA_cudadevrt_LIBRARY -- Device runtime library.
Required for separable compilation.
CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library.
Only available for CUDA version 4.0+.
CUDA_curand_LIBRARY -- CUDA Random Number Generation library.
Only available for CUDA version 3.2+.
CUDA_cusolver_LIBRARY -- CUDA Direct Solver library.
Only available for CUDA version 7.0+.
CUDA_cusparse_LIBRARY -- CUDA Sparse Matrix library.
Only available for CUDA version 3.2+.
CUDA_npp_LIBRARY -- NVIDIA Performance Primitives lib.
Only available for CUDA version 4.0+.
CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core).
Only available for CUDA version 5.5+.
CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 5.5 - 8.0.
CUDA_nppial_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppicc_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppicom_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppidei_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppif_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppig_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppim_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppist_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppisu_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_nppitc_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
Only available for CUDA version 9.0.
CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing).
Only available for CUDA version 5.5+.
CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library.
Only available for CUDA version 3.2+.
Windows only.
CUDA_nvcuvid_LIBRARY -- CUDA Video Decoder library.
Only available for CUDA version 3.2+.
Windows only.

CUPS_FOUND - system has Cups
CUPS_INCLUDE_DIR - the Cups include directory
CUPS_LIBRARIES - Libraries needed to use Cups
CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8)
Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
features this function (i.e. at least 1.1.19)

Set CURSES_NEED_NCURSES to TRUE before the find_package(Curses) call if NCurses functionality is required. Set CURSES_NEED_WIDE to TRUE before the find_package(Curses) call if unicode functionality is required.

Find the CxxTest suite and declare a helper macro for creating unit tests and integrating them with CTest. For more details on CxxTest see http://cxxtest.tigris.org

INPUT Variables

CXXTEST_USE_PYTHON [deprecated since 1.3]
Only used in the case both Python & Perl
are detected on the system to control
which CxxTest code generator is used.
Valid only for CxxTest version 3.

NOTE: In older versions of this Find Module,
this variable controlled if the Python test
generator was used instead of the Perl one,
regardless of which scripting language the
user had installed.

CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
Specify a list of options to pass to the CxxTest code
generator. If not defined, --error-printer is
passed.

OUTPUT Variables

CXXTEST_FOUND
True if the CxxTest framework was found
CXXTEST_INCLUDE_DIRS
Where to find the CxxTest include directory
CXXTEST_PERL_TESTGEN_EXECUTABLE
The perl-based test generator
CXXTEST_PYTHON_TESTGEN_EXECUTABLE
The python-based test generator
CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
The test generator that is actually used (chosen using user preferences
and interpreters found in the system)
CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
The full path to the Perl or Python executable on the system, on
platforms where the script cannot be executed using its shebang line.

CXXTEST_ADD_TEST(<test_name> <gen_source_file> <input_files_to_testgen...>)
Creates a CxxTest runner and adds it to the CTest testing suite
Parameters:
test_name The name of the test
gen_source_file The generated source filename to be
generated by CxxTest
input_files_to_testgen The list of header files containing the
CxxTest::TestSuite's to be included in
this runner

This will (if CxxTest is found):
1. Invoke the testgen executable to autogenerate foo_test.cc in the
binary tree from "foo_test.h" in the current source directory.
2. Create an executable and test called unittest_foo.

DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
DCMTK_LIBRARIES - Files to link against to use DCMTK
DCMTK_FOUND - If false, don't try to use DCMTK
DCMTK_DIR - (optional) Source directory for DCMTK

IL_LIBRARIES - the name of the IL library. These include the full path to
the core DevIL library. This one has to be linked into the
application.
ILU_LIBRARIES - the name of the ILU library. Again, the full path. This
library is for filters and effects, not actual loading. It
doesn't have to be linked if the functionality it provides
is not used.
ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the
library interfaces with OpenGL. It is not strictly needed
in applications.
IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files.
DevIL_FOUND - this is set to TRUE if all the above variables were set.
This will be set to false if ILU or ILUT are not found,
even if they are not needed. In most systems, if one
library is found all the others are as well. That's the
way the DevIL developers release it.

Doxygen is a documentation generation tool (see http://www.doxygen.org). This module looks for Doxygen and some optional tools it supports. These tools are enabled as components in the find_package() command:

The module defines IMPORTED targets for Doxygen and each component found. These can be used as part of custom commands, etc. and should be preferred over old-style (and now deprecated) variables like DOXYGEN_EXECUTABLE. The following import targets are defined if their corresponding executable could be found (the component import targets will only be defined if that component was requested):

This function is intended as a convenience for adding a target for generating documentation with Doxygen. It aims to provide sensible defaults so that projects can generally just provide the input files and directories and that will be sufficient to give sensible results. The function supports the ability to customize the Doxygen configuration used to build the documentation.

The function constructs a Doxyfile and defines a custom target that runs Doxygen on that generated file. The listed files and directories are used as the INPUT of the generated Doxyfile and they can contain wildcards. Any files that are listed explicitly will also be added as SOURCES of the custom target so they will show up in an IDE project’s source list.

So that relative input paths work as expected, by default the working directory of the Doxygen command will be the current source directory (i.e. CMAKE_CURRENT_SOURCE_DIR). This can be overridden with the WORKING_DIRECTORY option to change the directory used as the relative base point. Note also that Doxygen’s default behavior is to strip the working directory from relative paths in the generated documentation (see the STRIP_FROM_PATHDoxygen config option for details).

If provided, the optional comment will be passed as the COMMENT for the add_custom_target() command used to create the custom target internally.

If ALL is set, the target will be added to the default build target.

The contents of the generated Doxyfile can be customized by setting CMake variables before calling doxygen_add_docs(). Any variable with a name of the form DOXYGEN_<tag> will have its value substituted for the corresponding <tag> configuration option in the Doxyfile. See the Doxygen documentation for the full list of supported configuration options.

Some of Doxygen’s defaults are overridden to provide more appropriate behavior for a CMake project. Each of the following will be explicitly set unless the variable already has a value before doxygen_add_docs() is called (with some exceptions noted):

DOXYGEN_HAVE_DOT

Set to YES if the dot component was requested and it was found, NO otherwise. Any existing value of DOXYGEN_HAVE_DOT is ignored.

DOXYGEN_DOT_MULTI_TARGETS

Set to YES by this module (note that this requires a dot version newer than 1.8.10). This option is only meaningful if DOXYGEN_HAVE_DOT is also set to YES.

DOXYGEN_GENERATE_LATEX

Set to NO by this module.

DOXYGEN_WARN_FORMAT

For Visual Studio based generators, this is set to the form recognized by the Visual Studio IDE: $file($line) : $text. For all other generators, Doxygen’s default value is not overridden.

DOXYGEN_PROJECT_NAME

Populated with the name of the current project (i.e. PROJECT_NAME).

DOXYGEN_PROJECT_NUMBER

Populated with the version of the current project (i.e. PROJECT_VERSION).

DOXYGEN_PROJECT_BRIEF

Populated with the description of the current project (i.e. PROJECT_DESCRIPTION).

DOXYGEN_INPUT

Projects should not set this variable. It will be populated with the set of files and directories passed to doxygen_add_docs(), thereby providing consistent behavior with the other built-in commands like add_executable(), add_library() and add_custom_target(). If a variable named DOXYGEN_INPUT is set by the project, it will be ignored and a warning will be issued.

DOXYGEN_RECURSIVE

Set to YES by this module.

DOXYGEN_EXCLUDE_PATTERNS

If the set of inputs includes directories, this variable will specify patterns used to exclude files from them. The following patterns are added by doxygen_add_docs() to ensure CMake-specific files and directories are not included in the input. If the project sets DOXYGEN_EXCLUDE_PATTERNS, those contents are merged with these additional patterns rather than replacing them:

Set to CMAKE_CURRENT_BINARY_DIR by this module. Note that if the project provides its own value for this and it is a relative path, it will be converted to an absolute path relative to the current binary directory. This is necessary because doxygen will normally be run from a directory within the source tree so that relative source paths work as expected. If this directory does not exist, it will be recursively created prior to executing the doxygen commands.

To change any of these defaults or override any other Doxygen config option, set relevant variables before calling doxygen_add_docs(). For example:

A number of Doxygen config options accept lists of values, but Doxygen requires them to be separated by whitespace. CMake variables hold lists as a string with items separated by semi-colons, so a conversion needs to be performed. The doxygen_add_docs() command specifically checks the following Doxygen config options and will convert their associated CMake variable’s contents into the required form if set.

There are situations where it may be undesirable for a particular config option to be automatically quoted by doxygen_add_docs(), such as ALIASES which may need to include its own embedded quoting. The DOXYGEN_VERBATIM_VARS variable can be used to specify a list of Doxygen variables (including the leading DOXYGEN_ prefix) which should not be quoted. The project is then responsible for ensuring that those variables’ values make sense when placed directly in the Doxygen input file. In the case of list variables, list items are still separated by spaces, it is only the automatic quoting that is skipped. For example, the following allows doxygen_add_docs() to apply quoting to DOXYGEN_PROJECT_BRIEF, but not each item in the DOXYGEN_ALIASES list (bracket syntax can also be used to make working with embedded quotes easier):

For compatibility with previous versions of CMake, the following variables are also defined but they are deprecated and should no longer be used:

DOXYGEN_EXECUTABLE

The path to the doxygen command. If projects need to refer to the doxygen executable directly, they should use the Doxygen::doxygen import target instead.

DOXYGEN_DOT_FOUND

True if the dot executable was found.

DOXYGEN_DOT_EXECUTABLE

The path to the dot command. If projects need to refer to the dot executable directly, they should use the Doxygen::dot import target instead.

DOXYGEN_DOT_PATH

The path to the directory containing the dot executable as reported in DOXYGEN_DOT_EXECUTABLE. The path may have forward slashes even on Windows and is not suitable for direct substitution into a Doxyfile.in template. If you need this value, get the IMPORTED_LOCATION property of the Doxygen::dot target and use get_filename_component() to extract the directory part of that path. You may also want to consider using file(TO_NATIVE_PATH) to prepare the path for a Doxygen configuration file.

This variable has no effect for the component form of find_package. In backward compatibility mode (i.e. without components list) it prevents the finder module from searching for Graphviz’s dot utility.

FLEX_FOUND - true is flex executable is found
FLEX_EXECUTABLE - the path to the flex executable
FLEX_VERSION - the version of flex
FLEX_LIBRARIES - The flex libraries
FLEX_INCLUDE_DIRS - The path to the flex headers

The minimum required version of flex can be specified using the standard syntax, e.g. find_package(FLEX 2.5.13)

which creates a custom command to generate the <FlexOutput> file from the <FlexInput> file. If COMPILE_FLAGS option is specified, the next parameter is added to the flex command line. If flex is configured to output a header file, the DEFINES_FILE option may be used to specify its name. Name is an alias used to get details of this custom command. Indeed the macro defines the following variables:

FLEX_${Name}_DEFINED - true is the macro ran successfully
FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
alias for FlexOutput
FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any.

Flex scanners often use tokens defined by Bison: the code generated by Flex depends of the header generated by Bison. This module also defines a macro:

ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)

which adds the required dependency between a scanner and a parser where <FlexTarget> and <BisonTarget> are the first parameters of respectively FLEX_TARGET and BISON_TARGET macros.

FLTK2_FLUID_EXECUTABLE, where to find the Fluid tool
FLTK2_WRAP_UI, This enables the FLTK2_WRAP_UI command
FLTK2_INCLUDE_DIR, where to find include files
FLTK2_LIBRARIES, list of fltk2 libraries
FLTK2_FOUND, Don't use FLTK2 if false.

The following settings should not be used in general.

FLTK2_BASE_LIBRARY = the full path to fltk2.lib
FLTK2_GL_LIBRARY = the full path to fltk2_gl.lib
FLTK2_IMAGES_LIBRARY = the full path to fltk2_images.lib

By default this module will search for all of the FLTK components and add them to the FLTK_LIBRARIES variable. You can limit the components which get placed in FLTK_LIBRARIES by defining one or more of the following three options:

FLTK_SKIP_OPENGL

Set to true to disable searching for the FLTK GL library

FLTK_SKIP_FORMS

Set to true to disable searching for the FLTK Forms library

FLTK_SKIP_IMAGES

Set to true to disable searching for the FLTK Images library

FLTK is composed also by a binary tool. You can set the following option:

This module looks for the GNU gettext tools. This module defines the following values:

GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
GETTEXT_FOUND: True if gettext has been found.
GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)

Additionally it provides the following macros:

GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 … fileN )

This will create a target "translations" which will convert the
given input po files into the binary output mo file. If the
ALL option is used, the translations will also be created when
building the default target.

Process the given pot file to mo files.
If INSTALL_DESTINATION is given then automatically install rules will
be created, the language subdirectory will be taken into account
(by default use share/locale/).
If ALL is specified, the pot file is processed when building the all traget.
It creates a custom target "potfile".

Process the given po files to mo files for the given language.
If INSTALL_DESTINATION is given then automatically install rules will
be created, the language subdirectory will be taken into account
(by default use share/locale/).
If ALL is specified, the po files are processed when building the all traget.
It creates a custom target "pofiles".

GNUTLS_FOUND - System has gnutls
GNUTLS_INCLUDE_DIR - The gnutls include directory
GNUTLS_LIBRARIES - The libraries needed to use gnutls
GNUTLS_DEFINITIONS - Compiler switches required for using gnutls

This script expects to find libraries at $GSL_ROOT_DIR/lib and the GSL headers at $GSL_ROOT_DIR/include/gsl. The library directory may optionally provide Release and Debug folders. If available, the libraries named gsld, gslblasd or cblasd are recognized as debug libraries. For Unix-like systems, this script will use $GSL_ROOT_DIR/bin/gsl-config (if found) to aid in the discovery of GSL.

This module invokes the HDF5 wrapper compiler that should be installed alongside HDF5. Depending upon the HDF5 Configuration, the wrapper compiler is called either h5cc or h5pcc. If this succeeds, the module will then call the compiler with the -show argument to see what flags are used when compiling an HDF5 client application.

The module will optionally accept the COMPONENTS argument. If no COMPONENTS are specified, then the find module will default to finding only the HDF5 C library. If one or more COMPONENTS are specified, the module will attempt to find the language bindings for the specified components. The only valid components are C, CXX, Fortran, HL, and Fortran_HL. If the COMPONENTS argument is not given, the module will attempt to find only the C bindings.

This module will read the variable HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a static link to a dynamic link for HDF5 and all of it’s dependencies. To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES variable is set before the call to find_package.

To provide the module with a hint about where to find your HDF5 installation, you can set the environment variable HDF5_ROOT. The Find module will then look in this path when searching for HDF5 executables, paths, and libraries.

Both the serial and parallel HDF5 wrappers are considered and the first directory to contain either one will be used. In the event that both appear in the same directory the serial version is preferentially selected. This behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to true.

In addition to finding the includes and libraries required to compile an HDF5 client application, this module also makes an effort to find tools that come with the HDF5 distribution that may be useful for regression testing.

This module will define the following variables:

HDF5_FOUND - true if HDF5 was found on the system
HDF5_VERSION - HDF5 version in format Major.Minor.Release
HDF5_INCLUDE_DIRS - Location of the hdf5 includes
HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
HDF5_DEFINITIONS - Required compiler definitions for HDF5
HDF5_LIBRARIES - Required libraries for all requested bindings
HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all
bindings, if the HL component is enabled

Available components are: C CXX Fortran and HL. For each enabled language binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially HDF5_${LANG}_DEFINITIONS, will be defined. If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will also be defined. With all components enabled, the following variables will be defined:

HSPELL_FOUND - system has Hspell
HSPELL_INCLUDE_DIR - the Hspell include directory
HSPELL_LIBRARIES - The libraries needed to use Hspell
HSPELL_DEFINITIONS - Compiler switches required for using Hspell

HSPELL_VERSION_STRING - The version of Hspell found (x.y)
HSPELL_MAJOR_VERSION - the major version of Hspell
HSPELL_MINOR_VERSION - The minor version of Hspell

Ice_<C>_FOUND - ON if component was found
Ice_<C>_LIBRARIES - libraries for component

Note that <C> is the uppercased name of the component.

This module reads hints about search results from:

Ice_HOME - the root of the Ice installation

The environment variable ICE_HOME may also be used; the Ice_HOME variable takes precedence.

NOTE:

On Windows, Ice 3.7.0 and later provide libraries via the NuGet package manager. Appropriate NuGet packages will be searched for using CMAKE_PREFIX_PATH, or alternatively Ice_HOME may be set to the location of a specific NuGet package to restrict the search.

In most cases none of the above variables will require setting, unless multiple Ice versions are available and a specific version is required. On Windows, the most recent version of Ice will be found through the registry. On Unix, the programs, headers and libraries will usually be in standard locations, but Ice_SLICE_DIRS might not be automatically detected (commonly known locations are searched). All the other variables are defaulted using Ice_HOME, if set. It’s possible to set Ice_HOME and selectively specify alternative locations for the other components; this might be required for e.g. newer versions of Visual Studio if the heuristics are not sufficient to identify the correct programs and libraries for the specific Visual Studio version.

Note that on Windows data is named dt and i18n is named in; any of the names may be used, and the appropriate platform-specific library name will be automatically selected.

This module reports information about the ICU installation in several variables. General variables:

ICU_VERSION - ICU release version
ICU_FOUND - true if the main programs and libraries were found
ICU_LIBRARIES - component libraries to be linked
ICU_INCLUDE_DIRS - the directories containing the ICU headers

This module will search for a set of ImageMagick tools specified as components in the FIND_PACKAGE call. Typical components include, but are not limited to (future versions of ImageMagick might have additional components not listed here):

If no component is specified in the FIND_PACKAGE call, then it only searches for the ImageMagick executable directory. This code defines the following variables:

ImageMagick_FOUND - TRUE if all components are found.
ImageMagick_EXECUTABLE_DIR - Full path to executables directory.
ImageMagick_<component>_FOUND - TRUE if <component> is found.
ImageMagick_<component>_EXECUTABLE - Full path to <component> executable.
ImageMagick_VERSION_STRING - the version of ImageMagick found
(since CMake 2.8.8)

ImageMagick_VERSION_STRING will not work for old versions like 5.2.3.

There are also components for the following ImageMagick APIs:

Magick++
MagickWand
MagickCore

For these components the following variables are set:

ImageMagick_FOUND - TRUE if all components are found.
ImageMagick_INCLUDE_DIRS - Full paths to all include dirs.
ImageMagick_LIBRARIES - Full paths to all libraries.
ImageMagick_<component>_FOUND - TRUE if <component> is found.
ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs.
ImageMagick_<component>_LIBRARIES - Full path to <component> libraries.

This module finds the iconv() POSIX.1 functions on the system. These functions might be provided in the regular C library or externally in the form of an additional library.

The following variables are provided to indicate iconv support:

Iconv_FOUND

Variable indicating if the iconv support was found.

Iconv_INCLUDE_DIRS

The directories containing the iconv headers.

Iconv_LIBRARIES

The iconv libraries to be linked.

Iconv_IS_BUILT_IN

A variable indicating whether iconv support is stemming from the C library or not. Even if the C library provides iconv(), the presence of an external libiconv implementation might lead to this being false.

Additionally, the following IMPORTED target is being provided:

Iconv::Iconv

Imported target for using iconv.

The following cache variables may also be set:

Iconv_INCLUDE_DIR

The directory containing the iconv headers.

Iconv_LIBRARY

The iconv library (if not implicitly given in the C library).

NOTE:

On POSIX platforms, iconv might be part of the C library and the cache variables Iconv_INCLUDE_DIR and Iconv_LIBRARY might be empty.

This module existed in versions of CMake prior to 3.1, but became only a thin wrapper around find_package(ITK NO_MODULE) to provide compatibility for projects using long-outdated conventions. Now find_package(ITK) will search for ITKConfig.cmake directly.

JASPER_FOUND - system has Jasper
JASPER_INCLUDE_DIR - the Jasper include directory
JASPER_LIBRARIES - the libraries needed to use Jasper
JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)

Java_JAVA_EXECUTABLE = the full path to the Java runtime
Java_JAVAC_EXECUTABLE = the full path to the Java compiler
Java_JAVAH_EXECUTABLE = the full path to the Java header generator
Java_JAVADOC_EXECUTABLE = the full path to the Java documentation generator
Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
Java_JAR_EXECUTABLE = the full path to the Java archiver
Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
Java_VERSION_MAJOR = The major version of the package found.
Java_VERSION_MINOR = The minor version of the package found.
Java_VERSION_PATCH = The patch version of the package found.
Java_VERSION_TWEAK = The tweak version of the package found (after '_')
Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]]

The minimum required version of Java can be specified using the find_package() syntax, e.g.

find_package(Java 1.8)

NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be identical. For example some java version may return: Java_VERSION_STRING = 1.8.0_17 and Java_VERSION = 1.8.0.17

JNI enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications and libraries written in other languages such as C, C++.

This module finds if Java is installed and determines where the include files and libraries are. It also determines what the name of the library is. The caller may set variable JAVA_HOME to specify a Java installation prefix explicitly.

Find the KDE3 include and library dirs, KDE preprocessors and define a some macros

This module defines the following variables:

KDE3_DEFINITIONS

compiler definitions required for compiling KDE software

KDE3_INCLUDE_DIR

the KDE include directory

KDE3_INCLUDE_DIRS

the KDE and the Qt include directory, for use with include_directories()

KDE3_LIB_DIR

the directory where the KDE libraries are installed, for use with link_directories()

QT_AND_KDECORE_LIBS

this contains both the Qt and the kdecore library

KDE3_DCOPIDL_EXECUTABLE

the dcopidl executable

KDE3_DCOPIDL2CPP_EXECUTABLE

the dcopidl2cpp executable

KDE3_KCFGC_EXECUTABLE

the kconfig_compiler executable

KDE3_FOUND

set to TRUE if all of the above has been found

The following user adjustable options are provided:

KDE3_BUILD_TESTS

enable this to build KDE testcases

It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is always the variable which contains the list of source files for your application or library.

KDE3_AUTOMOC(file1 … fileN)

Call this if you want to have automatic moc file handling.
This means if you include "foo.moc" in the source file foo.cpp
a moc file for the header foo.h will be created automatically.
You can set the property SKIP_AUTOMAKE using set_source_files_properties()
to exclude some files in the list from being processed.

KDE3_ADD_MOC_FILES(SRCS_VAR file1 … fileN )

If you don't use the KDE3_AUTOMOC() macro, for the files
listed here moc files will be created (named "foo.moc.cpp")

KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h … headerN.h )

Use this to generate DCOP skeletions from the listed headers.

KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h … headerN.h )

Use this to generate DCOP stubs from the listed headers.

KDE3_ADD_UI_FILES(SRCS_VAR file1.ui … fileN.ui )

Use this to add the Qt designer ui files to your application/library.

KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc … fileN.kcfgc )

Use this to add KDE kconfig compiler files to your application/library.

KDE3_INSTALL_LIBTOOL_FILE(target)

This will create and install a simple libtool file for the given target.

KDE3_ADD_EXECUTABLE(name file1 … fileN )

Currently identical to add_executable(), may provide some advanced
features in the future.

KDE3_ADD_KPART(name [WITH_PREFIX] file1 … fileN )

Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
If WITH_PREFIX is given, the resulting plugin will have the prefix "lib",
otherwise it won't.
It creates and installs an appropriate libtool la-file.

KDE3_ADD_KDEINIT_EXECUTABLE(name file1 … fileN )

Create a KDE application in the form of a module loadable via kdeinit.
A library named kdeinit_<name> will be created and a small executable
which links to it.

The option KDE3_ENABLE_FINAL to enable all-in-one compilation is no longer supported.

LAPACK_FOUND - set to true if a library implementing the LAPACK interface
is found
LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
and -L).
LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
link against to use LAPACK
LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
link against to use LAPACK95
LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
interface is found
BLA_STATIC if set on this determines what kind of linkage we do (static)
BLA_VENDOR if set checks only the specified vendor, if not set checks
all the possibilities
BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK

This module finds an installed Latex and determines the location of the compiler. Additionally the module looks for Latex-related software like BibTeX.

This module sets the following result variables:

LATEX_FOUND: whether found Latex and requested components
LATEX_<component>_FOUND: whether found <component>
LATEX_COMPILER: path to the LaTeX compiler
PDFLATEX_COMPILER: path to the PdfLaTeX compiler
XELATEX_COMPILER: path to the XeLaTeX compiler
LUALATEX_COMPILER: path to the LuaLaTeX compiler
BIBTEX_COMPILER: path to the BibTeX compiler
BIBER_COMPILER: path to the Biber compiler
MAKEINDEX_COMPILER: path to the MakeIndex compiler
XINDY_COMPILER: path to the xindy compiler
DVIPS_CONVERTER: path to the DVIPS converter
DVIPDF_CONVERTER: path to the DVIPDF converter
PS2PDF_CONVERTER: path to the PS2PDF converter
PDFTOPS_CONVERTER: path to the pdftops converter
LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
HTLATEX_COMPILER: path to the htlatex compiler

LIBLZMA_FOUND - True if liblzma is found.
LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located.
LIBLZMA_LIBRARIES - Lzma libraries to link against.
LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required).
LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required).
LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required).
LIBLZMA_VERSION_MAJOR - The major version of lzma
LIBLZMA_VERSION_MINOR - The minor version of lzma
LIBLZMA_VERSION_PATCH - The patch version of lzma
LIBLZMA_VERSION_STRING - version number as a string (ex: "5.0.3")

LIBXSLT_FOUND - system has LibXslt
LIBXSLT_INCLUDE_DIR - the LibXslt include directory
LIBXSLT_LIBRARIES - Link these to LibXslt
LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8)

Additionally, the following two variables are set (but not required for using xslt):

LUA_FOUND - if false, do not try to link to Lua
LUA_LIBRARIES - both lua and lualib
LUA_INCLUDE_DIR - where to find lua.h
LUA_VERSION_STRING - the version of Lua found
LUA_VERSION_MAJOR - the major version of Lua
LUA_VERSION_MINOR - the minor version of Lua
LUA_VERSION_PATCH - the patch version of Lua

Note that the expected include convention is

#include "lua.h"

and not

#include <lua/lua.h>

This is because, the lua location is not standardized and may exist in locations other than lua/

MAIN_PROGRAM the Matlab binary program. Note that this component is not available on the MCR version, and will yield an error if the MCR is found instead of the regular Matlab installation.

MEX_COMPILER the MEX compiler.

MCC_COMPILER the MCC compiler, included with the Matlab Compiler add-on.

SIMULINK the Simulink environment.

NOTE:

The version given to the find_package() directive is the Matlab version, which should not be confused with the Matlab release name (eg. R2014). The matlab_get_version_from_release_name() and matlab_get_release_name_from_version() provide a mapping between the release name and the version.

The variable Matlab_ROOT_DIR may be specified in order to give the path of the desired Matlab version. Otherwise, the behaviour is platform specific:

Windows: The installed versions of Matlab/MCR are retrieved from the Windows registry

OS X: The installed versions of Matlab/MCR are given by the MATLAB default installation paths in /Application. If no such application is found, it falls back to the one that might be accessible from the PATH.

Unix: The desired Matlab should be accessible from the PATH. This does not work for MCR installation and Matlab_ROOT_DIR should be specified on this platform.

Additional information is provided when MATLAB_FIND_DEBUG is set. When a Matlab/MCR installation is found automatically and the MATLAB_VERSION is not given, the version is queried from Matlab directly (on Windows this may pop up a Matlab window) or from the MCR installation.

The mapping of the release names and the version of Matlab is performed by defining pairs (name, version). The variable MATLAB_ADDITIONAL_VERSIONS may be provided before the call to the find_package() in order to handle additional versions.

A Matlab scripts can be added to the set of tests using the matlab_add_unit_test(). By default, the Matlab unit test framework will be used (>= 2013a) to run this script, but regular .m files returning an exit code can be used as well (0 indicating a success).

parses the registry for all Matlab versions. Available on Windows only. The part of the registry parsed is dependent on the host processor

matlab_get_all_valid_matlab_roots_from_registry()

returns all the possible Matlab or MCR paths, according to a previously given list. Only the existing/accessible paths are kept. This is mainly useful for the searching all possible Matlab installation.

matlab_get_mex_suffix()

returns the suffix to be used for the mex files (platform/architecture dependent)

matlab_get_version_from_matlab_run()

returns the version of Matlab/MCR, given the full directory of the Matlab/MCR installation path.

By default, every symbols inside a MEX file defined with the command matlab_add_mex() have hidden visibility, except for the entry point. This is the default behaviour of the MEX compiler, which lowers the risk of symbol collision between the libraries shipped with Matlab, and the libraries to which the MEX file is linking to. This is also the default on Windows platforms.

However, this is not sufficient in certain case, where for instance your MEX file is linking against libraries that are already loaded by Matlab, even if those libraries have different SONAMES. A possible solution is to hide the symbols of the libraries to which the MEX target is linking to. This can be achieved in GNU GCC compilers with the linker option -Wl,--exclude-libs,ALL.

Tests using GPU resources

in case your MEX file is using the GPU and in order to be able to run unit tests on this MEX file, the GPU resources should be properly released by Matlab. A possible solution is to make Matlab aware of the use of the GPU resources in the session, which can be performed by a command such as D = gpuDevice() at the beginning of the test script (or via a fixture).

The root folder of the Matlab installation. If set before the call to find_package(), the module will look for the components in that path. If not set, then an automatic search of Matlab will be performed. If set, it should point to a valid version of Matlab.

MATLAB_FIND_DEBUG

If set, the lookup of Matlab and the intermediate configuration steps are outputted to the console.

MATLAB_ADDITIONAL_VERSIONS

If set, specifies additional versions of Matlab that may be looked for. The variable should be a list of strings, organised by pairs of release name and versions, such as follows:

The order of entries in this list matters when several versions of Matlab are installed. The priority is set according to the ordering in this list.

matlab_get_version_from_release_name

Returns the version of Matlab (17.58) from a release name (R2017k)

matlab_get_release_name_from_version

Returns the release name (R2017k) from the version of Matlab (17.58)

matlab_extract_all_installed_versions_from_registry

This function parses the registry and founds the Matlab versions that are installed. The found versions are returned in matlab_versions. Set win64 to TRUE if the 64 bit version of Matlab should be looked for The returned list contains all versions under HKLM\\SOFTWARE\\Mathworks\\MATLAB and HKLM\\SOFTWARE\\Mathworks\\MATLAB Runtime or an empty list in case an error occurred (or nothing found).

NOTE:

Only the versions are provided. No check is made over the existence of the installation referenced in the registry,

matlab_get_all_valid_matlab_roots_from_registry

Populates the Matlab root with valid versions of Matlab or Matlab Runtime (MCR). The returned matlab_roots is organized in triplets (type,version_number,matlab_root_path), where type indicates either MATLAB or MCR.

Returns the extension of the mex files (the suffixes). This function should not be called before the appropriate Matlab root has been found.

matlab_get_mex_suffix(
matlab_root
mex_suffix)

matlab_root

the root of the Matlab/MCR installation

mex_suffix

the variable name in which the suffix will be returned.

matlab_get_version_from_matlab_run

This function runs Matlab program specified on arguments and extracts its version. If the path provided for the Matlab installation points to an MCR installation, the version is extracted from the installed files.

Adds a Matlab unit test to the test set of cmake/ctest. This command requires the component MAIN_PROGRAM and hence is not available for an MCR installation.

The unit test uses the Matlab unittest framework (default, available starting Matlab 2013b+) except if the option NO_UNITTEST_FRAMEWORK is given.

The function expects one Matlab test script file to be given. In the case NO_UNITTEST_FRAMEWORK is given, the unittest script file should contain the script to be run, plus an exit command with the exit value. This exit value will be passed to the ctest framework (0 success, non 0 failure). Additional arguments accepted by add_test() can be passed through TEST_ARGS (eg. CONFIGURATION <config> ...).

the matlab unittest file. Its path will be automatically added to the Matlab path.

CUSTOM_TEST_COMMAND

Matlab script command to run as the test. If this is not set, then the following is run: runtests('matlab_file_name'), exit(max([ans(1,:).Failed])) where matlab_file_name is the UNITTEST_FILE without the extension.

UNITTEST_PRECOMMAND

Matlab script command to be ran before the file containing the test (eg. GPU device initialisation based on CMake variables).

TIMEOUT

the test timeout in seconds. Defaults to 180 seconds as the Matlab unit test may hang.

ADDITIONAL_PATH

a list of paths to add to the Matlab path prior to running the unit test.

MATLAB_ADDITIONAL_STARTUP_OPTIONS

a list of additional option in order to run Matlab from the command line. -nosplash -nodesktop -nodisplay are always added.

TEST_ARGS

Additional options provided to the add_test command. These options are added to the default options (eg. “CONFIGURATIONS Release”)

NO_UNITTEST_FRAMEWORK

when set, indicates that the test should not use the unittest framework of Matlab (available for versions >= R2013a).

WORKING_DIRECTORY

This will be the working directory for the test. If specified it will also be the output directory used for the log file of the test run. If not specified the temporary directory ${CMAKE_BINARY_DIR}/Matlab will be used as the working directory and the log location.

matlab_add_mex

Adds a Matlab MEX target. This commands compiles the given sources with the current tool-chain in order to produce a MEX file. The final name of the produced output may be specified, as well as additional link libraries, and a documentation entry for the MEX file. Remaining arguments of the call are passed to the add_library() or add_executable() command.

a list of additional link dependencies. The target links to libmex by default. If Matlab_MX_LIBRARY is defined, it also links to libmx.

OUTPUT_NAME

if given, overrides the default name. The default name is the name of the target without any prefix and with Matlab_MEX_EXTENSION suffix.

DOCUMENTATION

if given, the file file.txt will be considered as being the documentation file for the MEX file. This file is copied into the same folder without any processing, with the same name as the final mex file, and with extension .m. In that case, typing help <name> in Matlab prints the documentation contained in this file.

MODULE or SHARED may be given to specify the type of library to be

created. EXECUTABLE may be given to create an executable instead of a library. If no type is given explicitly, the type is SHARED.

The documentation file is not processed and should be in the following format:

% This is the documentation
function ret = mex_target_output_name(input1)

The Message Passing Interface (MPI) is a library used to write high-performance distributed-memory parallel applications, and is typically deployed on a cluster. MPI is a standard interface (defined by the MPI forum) for which many implementations are available.

The module exposes the components C, CXX, MPICXX and Fortran. Each of these controls the various MPI languages to search for. The difference between CXX and MPICXX is that CXX refers to the MPI C API being usable from C++, whereas MPICXX refers to the MPI-2 C++ API that was removed again in MPI-3.

Depending on the enabled components the following variables will be set:

MPI_FOUND

Variable indicating that MPI settings for all requested languages have been found. If no components are specified, this is true if MPI settings for all enabled languages were detected. Note that the MPICXX component does not affect this variable.

MPI_VERSION

Minimal version of MPI detected among the requested languages, or all enabled languages if no components were specified.

This module will set the following variables per language in your project, where <lang> is one of C, CXX, or Fortran:

MPI_<lang>_FOUND

Variable indicating the MPI settings for <lang> were found and that simple MPI test programs compile with the provided settings.

MPI_<lang>_COMPILER

MPI compiler for <lang> if such a program exists.

MPI_<lang>_COMPILE_OPTIONS

Compilation options for MPI programs in <lang>, given as a ;-list.

MPI_<lang>_COMPILE_DEFINITIONS

Compilation definitions for MPI programs in <lang>, given as a ;-list.

MPI_<lang>_INCLUDE_DIRS

Include path(s) for MPI header.

MPI_<lang>_LINK_FLAGS

Linker flags for MPI programs.

MPI_<lang>_LIBRARIES

All libraries to link MPI programs against.

Additionally, the following IMPORTED targets are defined:

MPI::MPI_<lang>

Target for using MPI from <lang>.

The following variables indicating which bindings are present will be defined:

Check if the compiler has MPI support built-in. This is the case if the user passed a compiler wrapper as CMAKE_<LANG>_COMPILER or if they’re on a Cray system.

2.

Attempt to find an MPI compiler wrapper and determine the compiler information from it.

3.

Try to find an MPI implementation that does not ship such a wrapper by guessing settings. Currently, only Microsoft MPI and MPICH2 on Windows are supported.

For controlling the second step, the following variables may be set:

MPI_<lang>_COMPILER

Search for the specified compiler wrapper and use it.

MPI_<lang>_COMPILER_FLAGS

Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers support linking debug or tracing libraries if a specific flag is passed and this variable may be used to obtain them.

MPI_COMPILER_FLAGS

Used to initialize MPI_<lang>_COMPILER_FLAGS if no language specific flag has been given. Empty by default.

MPI_EXECUTABLE_SUFFIX

A suffix which is appended to all names that are being looked for. For instance you may set this to .mpich or .openmpi to prefer the one or the other on Debian and its derivatives.

In order to control the guessing step, the following variable may be set:

MPI_GUESS_LIBRARY_NAME

Valid values are MSMPI and MPICH2. If set, only the given library will be searched for. By default, MSMPI will be preferred over MPICH2 if both are available. This also sets MPI_SKIP_COMPILER_WRAPPER to true, which may be overridden.

Each of the search steps may be skipped with the following control variables:

MPI_ASSUME_NO_BUILTIN_MPI

If true, the module assumes that the compiler itself does not provide an MPI implementation and skips to step 2.

MPI_SKIP_COMPILER_WRAPPER

If true, no compiler wrapper will be searched for.

MPI_SKIP_GUESSING

If true, the guessing step will be skipped.

Additionally, the following control variable is available to change search behavior:

MPI_CXX_SKIP_MPICXX

Add some definitions that will disable the MPI-2 C++ bindings. Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, for example MVAPICH or Intel MPI.

If the find procedure fails for a variable MPI_<lang>_WORKS, then the settings detected by or passed to the module did not work and even a simple MPI test program failed to compile.

If all of these parameters were not sufficient to find the right MPI implementation, a user may disable the entire autodetection process by specifying both a list of libraries in MPI_<lang>_LIBRARIES and a list of include directories in MPI_<lang>_ADDITIONAL_INCLUDE_DIRS. Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the settings in the cache.

The module can perform some advanced feature detections upon explicit request.

Important notice: The following checks cannot be performed without executing an MPI test program. Consider the special considerations for the behavior of try_run() during cross compilation. Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. You should only enable these detections if you absolutely need the information.

If the following variables are set to true, the respective search will be performed:

MPI_DETERMINE_Fortran_CAPABILITIES

Determine for all available Fortran bindings what the values of MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING are and make their values available as MPI_Fortran_<binding>_SUBARRAYS and MPI_Fortran_<binding>_ASYNCPROT, where <binding> is one of F77_HEADER, F90_MODULE and F08_MODULE.

MPI_DETERMINE_LIBRARY_VERSION

For each language, find the output of MPI_Get_library_version and make it available as MPI_<lang>_LIBRARY_VERSION. This information is usually tied to the runtime component of an MPI implementation and might differ depending on <lang>. Note that the return value is entirely implementation defined. This information might be used to identify the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.

Paths to include directories listed in one variable for use by ODBC client. May be empty on Windows, where the include directory corresponding to the expected Windows SDK is already available in the compilation environment.

ODBC_LIBRARIES

Paths to libraries to linked against to use ODBC. May just a library name on Windows, where the library directory corresponding to the expected Windows SDK is already available in the compilation environment.

On Windows, this module does not search for iODBC. On Unix, there is no way to prefer unixODBC over iODBC, or vice versa, other than providing the config program location using the ODBC_CONFIG. This module does not allow to search for a specific ODBC driver.

This module can be used to detect OpenACC support in a compiler. If the compiler supports OpenACC, the flags required to compile with OpenACC support are returned in variables for the different languages. Currently, only PGI, GNU and Cray compilers are supported.

OpenCL_FOUND - True if OpenCL was found
OpenCL_INCLUDE_DIRS - include directories for OpenCL
OpenCL_LIBRARIES - link against this library to use OpenCL
OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation

The module will also define two cache variables:

OpenCL_INCLUDE_DIR - the OpenCL include directory
OpenCL_LIBRARY - the path to the OpenCL library

Paths to the OpenGL library, windowing system libraries, and GLU libraries. On Linux, this assumes GLX and is never correct for EGL-based targets. Clients are encouraged to use the OpenGL::* import targets instead.

Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates context libraries from OpenGL itself; OpenGL lives in “libOpenGL”, and contexts are defined in “libGLX” or “libEGL”. GLVND is currently the only way to get OpenGL 3+ functionality via EGL in a manner portable across vendors. Projects may use GLVND explicitly with target OpenGL::OpenGL and either OpenGL::GLX or OpenGL::EGL.

Projects may use the OpenGL::GL target (or OPENGL_LIBRARIES variable) to use legacy GL interfaces. These will use the legacy GL library located by OPENGL_gl_LIBRARY, if available. If OPENGL_gl_LIBRARY is empty or not found and GLVND is available, the OpenGL::GL target will use GLVND OpenGL::OpenGL and OpenGL::GLX (and the OPENGL_LIBRARIES variable will use the corresponding libraries). Thus, for non-EGL-based Linux targets, the OpenGL::GL target is most portable.

A OpenGL_GL_PREFERENCE variable may be set to specify the preferred way to provide legacy GL interfaces in case multiple choices are available. The value may be one of:

GLVND

If the GLVND OpenGL and GLX libraries are available, prefer them. This forces OPENGL_gl_LIBRARY to be empty. This is the default if components were requested (since components correspond to GLVND libraries) or if policy CMP0072 is set to NEW.

LEGACY

Prefer to use the legacy libGL library, if available. This is the default if no components were requested and policy CMP0072 is not set to NEW.

For EGL targets the client must rely on GLVND support on the user’s system. Linking should use the OpenGL::OpenGL OpenGL::EGL targets. Using GLES* libraries is theoretically possible in place of OpenGL::OpenGL, but this module does not currently support that; contributions welcome.

OPENGL_egl_LIBRARY and OPENGL_EGL_INCLUDE_DIRS are defined in the case of GLVND. For non-GLVND Linux and other systems these are left undefined.

This module can be used to detect OpenMP support in a compiler. If the compiler supports OpenMP, the flags required to compile with OpenMP support are returned in variables for the different languages. The variables may be empty if the compiler does not need a special flag to support OpenMP.

This module searches for the OpenSceneGraph core “osg” library as well as OpenThreads, and whatever additional COMPONENTS (nodekits) that you specify.

See http://www.openscenegraph.org

NOTE: To use this module effectively you must either require CMake >= 2.6.3 with cmake_minimum_required(VERSION 2.6.3) or download and place FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, and Find<etc>.cmake files into your CMAKE_MODULE_PATH.

Set OPENSSL_ROOT_DIR to the root directory of an OpenSSL installation. Set OPENSSL_USE_STATIC_LIBS to TRUE to look for static libraries. Set OPENSSL_MSVC_STATIC_RT set TRUE to choose the MT version of the lib.

OpenThreads is a C++ based threading library. Its largest userbase seems to OpenSceneGraph so you might notice I accept OSGDIR as an environment path. I consider this part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module.

Locate OpenThreads This module defines OPENTHREADS_LIBRARY OPENTHREADS_FOUND, if false, do not try to link to OpenThreads OPENTHREADS_INCLUDE_DIR, where to find the headers

$OPENTHREADS_DIR is an environment variable that would correspond to the ./configure –prefix=$OPENTHREADS_DIR used in building osg.

[CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now be used as well to influence detection, instead of needing to specify an environment variable.

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgAnimation This module defines

OSGANIMATION_FOUND - Was osgAnimation found? OSGANIMATION_INCLUDE_DIR - Where to find the headers OSGANIMATION_LIBRARIES - The libraries to link against for the OSG (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgDB This module defines

OSGDB_FOUND - Was osgDB found? OSGDB_INCLUDE_DIR - Where to find the headers OSGDB_LIBRARIES - The libraries to link against for the osgDB (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgFX This module defines

OSGFX_FOUND - Was osgFX found? OSGFX_INCLUDE_DIR - Where to find the headers OSGFX_LIBRARIES - The libraries to link against for the osgFX (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgGA This module defines

OSGGA_FOUND - Was osgGA found? OSGGA_INCLUDE_DIR - Where to find the headers OSGGA_LIBRARIES - The libraries to link against for the osgGA (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgINTROSPECTION This module defines

OSGINTROSPECTION_FOUND - Was osgIntrospection found? OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers OSGINTROSPECTION_LIBRARIES - The libraries to link for osgIntrospection (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgManipulator This module defines

OSGMANIPULATOR_FOUND - Was osgManipulator found? OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgParticle This module defines

OSGPARTICLE_FOUND - Was osgParticle found? OSGPARTICLE_INCLUDE_DIR - Where to find the headers OSGPARTICLE_LIBRARIES - The libraries to link for osgParticle (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgPresentation This module defines

OSGPRESENTATION_FOUND - Was osgPresentation found? OSGPRESENTATION_INCLUDE_DIR - Where to find the headers OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgProducer This module defines

OSGPRODUCER_FOUND - Was osgProducer found? OSGPRODUCER_INCLUDE_DIR - Where to find the headers OSGPRODUCER_LIBRARIES - The libraries to link for osgProducer (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgQt This module defines

OSGQT_FOUND - Was osgQt found? OSGQT_INCLUDE_DIR - Where to find the headers OSGQT_LIBRARIES - The libraries to link for osgQt (use this)

NOTE: It is highly recommended that you use the new FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this Find module directly.

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osg This module defines

OSG_FOUND - Was the Osg found? OSG_INCLUDE_DIR - Where to find the headers OSG_LIBRARIES - The libraries to link against for the OSG (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgShadow This module defines

OSGSHADOW_FOUND - Was osgShadow found? OSGSHADOW_INCLUDE_DIR - Where to find the headers OSGSHADOW_LIBRARIES - The libraries to link for osgShadow (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgSim This module defines

OSGSIM_FOUND - Was osgSim found? OSGSIM_INCLUDE_DIR - Where to find the headers OSGSIM_LIBRARIES - The libraries to link for osgSim (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgTerrain This module defines

OSGTERRAIN_FOUND - Was osgTerrain found? OSGTERRAIN_INCLUDE_DIR - Where to find the headers OSGTERRAIN_LIBRARIES - The libraries to link for osgTerrain (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgText This module defines

OSGTEXT_FOUND - Was osgText found? OSGTEXT_INCLUDE_DIR - Where to find the headers OSGTEXT_LIBRARIES - The libraries to link for osgText (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgUtil This module defines

OSGUTIL_FOUND - Was osgUtil found? OSGUTIL_INCLUDE_DIR - Where to find the headers OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgViewer This module defines

OSGVIEWER_FOUND - Was osgViewer found? OSGVIEWER_INCLUDE_DIR - Where to find the headers OSGVIEWER_LIBRARIES - The libraries to link for osgViewer (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgVolume This module defines

OSGVOLUME_FOUND - Was osgVolume found? OSGVOLUME_INCLUDE_DIR - Where to find the headers OSGVOLUME_LIBRARIES - The libraries to link for osgVolume (use this)

This is part of the Findosg* suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate osgWidget This module defines

OSGWIDGET_FOUND - Was osgWidget found? OSGWIDGET_INCLUDE_DIR - Where to find the headers OSGWIDGET_LIBRARIES - The libraries to link for osgWidget (use this)

This module provides a function intended to be used in Find Modules implementing find_package(<PackageName>) calls. It handles the REQUIRED, QUIET and version-related arguments of find_package. It also sets the <PackageName>_FOUND variable. The package is considered found if all variables listed contain valid results, e.g. valid filepaths.

The <PackageName>_FOUND variable will be set to TRUE if all the variables <required-var>... are valid and any optional constraints are satisfied, and FALSE otherwise. A success or failure message may be displayed based on the results and on whether the REQUIRED and/or QUIET option was given to the find_package() call.

The options are:

(DEFAULT_MSG|<custom-failure-message>)

In the simple signature this specifies the failure message. Use DEFAULT_MSG to ask for a default message to be computed (recommended). Not valid in the full signature.

FOUND_VAR <result-var>

Obsolete. Specifies either <PackageName>_FOUND or <PACKAGENAME>_FOUND as the result variable. This exists only for compatibility with older versions of CMake and is now ignored. Result variables of both names are always set for compatibility.

REQUIRED_VARS <required-var>...

Specify the variables which are required for this package. These may be named in the generated failure message asking the user to set the missing variable values. Therefore these should typically be cache entries such as FOO_LIBRARY and not output variables like FOO_LIBRARIES.

VERSION_VAR <version-var>

Specify the name of a variable that holds the version of the package that has been found. This version will be checked against the (potentially) specified required version given to the find_package() call, including its EXACT option. The default messages include information about the required version and the version which has been actually found, both if the version is ok or not.

HANDLE_COMPONENTS

Enable handling of package components. In this case, the command will report which components have been found and which are missing, and the <PackageName>_FOUND variable will be set to FALSE if any of the required components (i.e. not the ones listed after the OPTIONAL_COMPONENTS option of find_package()) are missing.

CONFIG_MODE

Specify that the calling find module is a wrapper around a call to find_package(<PackageName> NO_MODULE). This implies a VERSION_VAR value of <PackageName>_VERSION. The command will automatically check whether the package configuration file was found.

FAIL_MESSAGE <custom-failure-message>

Specify a custom failure message instead of using the default generated message. Not recommended.

The LibXml2 package is considered to be found if both LIBXML2_LIBRARY and LIBXML2_INCLUDE_DIR are valid. Then also LibXml2_FOUND is set to TRUE. If it is not found and REQUIRED was used, it fails with a message(FATAL_ERROR), independent whether QUIET was used or not. If it is found, success will be reported, including the content of the first <required-var>. On repeated CMake runs, the same message will not be printed again.

In this case, the LibArchive package is considered to be found if both LibArchive_LIBRARY and LibArchive_INCLUDE_DIR are valid. Also the version of LibArchive will be checked by using the version contained in LibArchive_VERSION. Since no FAIL_MESSAGE is given, the default messages will be printed.

In this case, a FindAutmoc4.cmake module wraps a call to find_package(Automoc4 NO_MODULE) and adds an additional search directory for automoc4. Then the call to find_package_handle_standard_args produces a proper success/failure message.

This macro is intended to be used in FindXXX.cmake modules files. It will print a message once for each unique find result. This is useful for telling the user where a package was found. The first argument specifies the name (XXX) of the package. The second argument specifies the message to display. The third argument lists details about the find result so that if they change the message will be displayed again. The macro also obeys the QUIET argument to the find_package command.

Finds the pkg-config executable and adds the pkg_get_variable(), pkg_check_modules() and pkg_search_module() commands. The following variables will also be set:

PKG_CONFIG_FOUND ... if pkg-config executable was found
PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
(since CMake 2.8.8)

pkg_get_variable

Retrieves the value of a pkg-config variable varName and stores it in the result variable resultVar in the calling scope.

pkg_get_variable(<resultVar> <moduleName> <varName>)

If pkg-config returns multiple values for the specified variable, resultVar will contain a ;-list.

For example:

pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)

pkg_check_modules

Checks for all the given modules, setting a variety of result variables in the calling scope.

When the REQUIRED argument is given, the command will fail with an error if module(s) could not be found.

When the QUIET argument is given, no status messages will be printed.

By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later, or if PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set to a boolean True value, then the CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment variables will be added to the pkg-config search path. The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this behavior for the cache variables and environment variables respectively.

The IMPORTED_TARGET argument will create an imported target named PkgConfig::<prefix> that can be passed directly as an argument to target_link_libraries(). The GLOBAL argument will make the imported target available in global scope.

Each <moduleSpec> can be either a bare module name or it can be a module name with a version constraint (operators =, <, >, <= and >= are supported). The following are examples for a module named foo with various constraints:

foo # Any version matches
foo<2 # Only match versions before 2
foo>=3.1 # Match any version from 3.1 or later
foo=1.2.3 # Foo must be exactly version 1.2.3

The following variables may be set upon return. Two sets of values exist, one for the common case (<XXX> = <prefix>) and another for the information pkg-config provides when it is called with the --static option (<XXX> = <prefix>_STATIC):

<XXX>_FOUND ... set to 1 if module(s) exist
<XXX>_LIBRARIES ... only the libraries (without the '-l')
<XXX>_LINK_LIBRARIES ... the libraries and their absolute paths
<XXX>_LIBRARY_DIRS ... the paths of the libraries (without the '-L')
<XXX>_LDFLAGS ... all required linker flags
<XXX>_LDFLAGS_OTHER ... all other linker flags
<XXX>_INCLUDE_DIRS ... the '-I' preprocessor flags (without the '-I')
<XXX>_CFLAGS ... all required cflags
<XXX>_CFLAGS_OTHER ... the other compiler flags

All but <XXX>_FOUND may be a ;-list if the associated variable returned from pkg-config has multiple values.

There are some special variables whose prefix depends on the number of <moduleSpec> given. When there is only one <moduleSpec>, <YYY> will simply be <prefix>, but if two or more <moduleSpec> items are given, <YYY> will be <prefix>_<moduleName>:

<YYY>_VERSION ... version of the module
<YYY>_PREFIX ... prefix directory of the module
<YYY>_INCLUDEDIR ... include directory of the module
<YYY>_LIBDIR ... lib directory of the module

Examples

pkg_check_modules (GLIB2 glib-2.0)

Looks for any version of glib2. If found, the output variable GLIB2_VERSION will hold the actual version found.

pkg_check_modules (GLIB2 glib-2.0>=2.10)

Looks for at least version 2.10 of glib2. If found, the output variable GLIB2_VERSION will hold the actual version found.

pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)

Looks for both glib2-2.0 (at least version 2.10) and any version of gtk2+-2.0. Only if both are found will FOO be considered found. The FOO_glib-2.0_VERSION and FOO_gtk+-2.0_VERSION variables will be set to their respective found module versions.

pkg_check_modules (XRENDER REQUIRED xrender)

Requires any version of xrender. Example output variables set by a successful call:

This can be set to the path of the pkg-config executable. If not provided, it will be set by the module as a result of calling find_program() internally. The PKG_CONFIG environment variable can be used as a hint.

PKG_CONFIG_USE_CMAKE_PREFIX_PATH

Specifies whether pkg_check_modules() and pkg_search_module() should add the paths in the CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH cache and environment variables to the pkg-config search path.

If this variable is not set, this behavior is enabled by default if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later, disabled otherwise.

PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries
PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)

Though Producer isn’t directly part of OpenSceneGraph, its primary user is OSG so I consider this part of the Findosg* suite used to find OpenSceneGraph components. You’ll notice that I accept OSGDIR as an environment path.

Each component is separate and you must opt in to each module. You must also opt into OpenGL (and OpenThreads?) as these modules won’t do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular module (perhaps because the default FindOpenGL.cmake module doesn’t work with your system as an example). If you want to use a more convenient module that includes everything, use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.

Locate Producer This module defines PRODUCER_LIBRARY PRODUCER_FOUND, if false, do not try to link to Producer PRODUCER_INCLUDE_DIR, where to find the headers

When compiling with MSVC, if this cache variable is set the protobuf-default VS project build locations (vsprojects/Debug and vsprojects/Release or vsprojects/x64/Debug and vsprojects/x64/Release) will be searched for libraries and binaries.

Protobuf_IMPORT_DIRS

List of additional directories to be searched for imported .proto files.

Development: search for development artifacts (include directories and libraries).

If no COMPONENTS is specified, Interpreter is assumed.

To ensure consistent versions between components Interpreter, Compiler and Development, specify all components at the same time:

find_package (Python COMPONENTS Interpreter Development)

This module looks preferably for version 3 of Python. If not found, version 2 is searched. To manage concurrent versions 3 and 2 of Python, use FindPython3 and FindPython2 modules rather than this one.

If not defined, search for shared libraries and static libraries in that order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Python_FIND_REGISTRY

On Windows the Python_FIND_REGISTRY variable determine the order of preference between registry and environment variables. the Python_FIND_REGISTRY variable can be set to empty or one of the following:

FIRST: Try to use registry before environment variables. This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

CMAKE_FIND_FRAMEWORK

On OS X the CMAKE_FIND_FRAMEWORK variable determine the order of preference between Apple-style and unix-style package components.

NOTE:

Value ONLY is not supported so FIRST will be used instead.

NOTE:

If a Python virtual environment is configured, set variable Python_FIND_REGISTRY (Windows) or CMAKE_FIND_FRAMEWORK (macOS) with value LAST or NEVER to select it preferably.

This module defines the command Python_add_library which have the same semantic as add_library() but take care of Python module naming rules (only applied if library is of type MODULE) and add dependency to target Python::Python:

If not defined, search for shared libraries and static libraries in that order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Python2_FIND_REGISTRY

On Windows the Python2_FIND_REGISTRY variable determine the order of preference between registry and environment variables. the Python2_FIND_REGISTRY variable can be set to empty or one of the following:

FIRST: Try to use registry before environment variables. This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

CMAKE_FIND_FRAMEWORK

On macOS the CMAKE_FIND_FRAMEWORK variable determine the order of preference between Apple-style and unix-style package components.

NOTE:

Value ONLY is not supported so FIRST will be used instead.

NOTE:

If a Python virtual environment is configured, set variable Python_FIND_REGISTRY (Windows) or CMAKE_FIND_FRAMEWORK (macOS) with value LAST or NEVER to select it preferably.

This module defines the command Python2_add_library which have the same semantic as add_library() but take care of Python module naming rules (only applied if library is of type MODULE) and add dependency to target Python2::Python:

If not defined, search for shared libraries and static libraries in that order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Python3_FIND_REGISTRY

On Windows the Python3_FIND_REGISTRY variable determine the order of preference between registry and environment variables. the Python3_FIND_REGISTRY variable can be set to empty or one of the following:

FIRST: Try to use registry before environment variables. This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

CMAKE_FIND_FRAMEWORK

On OS X the CMAKE_FIND_FRAMEWORK variable determine the order of preference between Apple-style and unix-style package components.

NOTE:

Value ONLY is not supported so FIRST will be used instead.

NOTE:

If a Python virtual environment is configured, set variable Python_FIND_REGISTRY (Windows) or CMAKE_FIND_FRAMEWORK (macOS) with value LAST or NEVER to select it preferably.

This module defines the command Python3_add_library which have the same semantic as add_library() but take care of Python module naming rules (only applied if library is of type MODULE) and add dependency to target Python3::Python:

The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of version numbers that should be taken into account when searching for Python. You need to set this variable before calling find_package(PythonInterp).

If calling both find_package(PythonInterp) and find_package(PythonLibs), call find_package(PythonInterp) first to get the currently active Python version by default with a consistent version of PYTHON_LIBRARIES.

Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

This module finds if Python is installed and determines where the include files and libraries are. It also determines what the name of the library is. This code sets the following variables:

PYTHONLIBS_FOUND - have the Python libs been found
PYTHON_LIBRARIES - path to the python library
PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
PYTHON_INCLUDE_DIRS - path to where Python.h is found
PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)

The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of version numbers that should be taken into account when searching for Python. You need to set this variable before calling find_package(PythonLibs).

If you’d like to specify the installation of Python to use, you should modify the following cache variables:

PYTHON_LIBRARY - path to the python library
PYTHON_INCLUDE_DIR - path to where Python.h is found

If calling both find_package(PythonInterp) and find_package(PythonLibs), call find_package(PythonInterp) first to get the currently active Python version by default with a consistent version of PYTHON_LIBRARIES.

QT_INCLUDE_DIR - where to find qt.h, etc.
QT_LIBRARIES - the libraries to link against to use Qt.
QT_DEFINITIONS - definitions to use when
compiling code that uses Qt.
QT_FOUND - If false, don't try to use Qt.
QT_VERSION_STRING - the version of Qt found

If you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE

Also defined, but not for general use are:

QT_MOC_EXECUTABLE, where to find the moc tool.
QT_UIC_EXECUTABLE, where to find the uic tool.
QT_QT_LIBRARY, where to find the Qt library.
QT_QTMAIN_LIBRARY, where to find the qtmain
library. This is only required by Qt3 on Windows.

This module can be used to find Qt4. The most important issue is that the Qt4 qmake is available via the system path. This qmake is then used to detect basically everything else. This module defines a number of IMPORTED targets, macros and variables.

When using IMPORTED targets, the qtmain.lib static library is automatically linked on Windows for WIN32 executables. To disable that globally, set the QT4_NO_LINK_QTMAIN variable before finding Qt4. To disable that for a particular executable, set the QT4_NO_LINK_QTMAIN target property to TRUE on the executable.

Qt relies on some bundled tools for code generation, such as moc for meta-object code generation,``uic`` for widget layout and population, and rcc for virtual filesystem content generation. These tools may be automatically invoked by cmake(1) if the appropriate conditions are met. See cmake-qt(7) for more.

In some cases it can be necessary or useful to invoke the Qt build tools in a more-manual way. Several macros are available to add targets for such uses.

macro QT4_WRAP_CPP(outfiles inputfile ... [TARGET tgt] OPTIONS ...)
create moc code from a list of files containing Qt class with
the Q_OBJECT declaration. Per-directory preprocessor definitions
are also added. If the <tgt> is specified, the
INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
the <tgt> are passed to moc. Options may be given to moc, such as
those found when executing "moc -help".

macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
create code from a list of Qt designer ui files.
Options may be given to uic, such as those found
when executing "uic -help"

macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
create code from a list of Qt resource files.
Options may be given to rcc, such as those found
when executing "rcc -help"

macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt])
creates a rule to run moc on infile and create outfile.
Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g.
because you need a custom filename for the moc file or something
similar. If the <tgt> is specified, the
INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
the <tgt> are passed to moc.

macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
Create the interface header and implementation files with the
given basename from the given interface xml file and add it to
the list of sources.
You can pass additional parameters to the qdbusxml2cpp call by setting
properties on the input file:
INCLUDE the given file will be included in the generate interface header
CLASSNAME the generated class is named accordingly
NO_NAMESPACE the generated class is not wrapped in a namespace

macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
Create the interface header and implementation files
for all listed interface xml files.
The basename will be automatically determined from the name
of the xml file.
The source file properties described for
QT4_ADD_DBUS_INTERFACE also apply here.

macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname
[basename] [classname])
create a dbus adaptor (header and implementation file) from the xml file
describing the interface, and add it to the list of sources. The adaptor
forwards the calls to a parent class, defined in parentheader and named
parentclassname. The name of the generated files will be
<basename>adaptor.{cpp,h} where basename defaults to the basename of the
xml file.
If <classname> is provided, then it will be used as the classname of the
adaptor itself.

macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
generate the xml interface file from the given header.
If the optional argument interfacename is omitted, the name of the
interface file is constructed from the basename of the header with
the suffix .xml appended.
Options may be given to qdbuscpp2xml, such as those found when
executing "qdbuscpp2xml --help"

macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
ts_files ... OPTIONS ...)
out: qm_files
in: directories sources ts_files
options: flags to pass to lupdate, such as -extensions to specify
extensions for a directory scan.
generates commands to create .ts (vie lupdate) and .qm
(via lrelease) - files from directories and/or sources. The ts files are
created and/or updated in the source tree (unless given with full paths).
The qm files are generated in the build tree.
Updating the translations can be done by adding the qm_files
to the source list of your library/executable, so they are
always updated, or by adding a custom target to control when
they get updated/generated.

macro QT4_ADD_TRANSLATION( qm_files ts_files ... )
out: qm_files
in: ts_files
generates commands to create .qm from .ts - files. The generated
filenames can be found in qm_files. The ts_files
must exist and are not updated in any way.

macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt])
The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
This macro is still experimental.
It can be used to have moc automatically handled.
So if you have the files foo.h and foo.cpp, and in foo.h a
a class uses the Q_OBJECT macro, moc has to run on it. If you don't
want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
#include "foo.moc"
in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will
scan all listed files at cmake-time for such included moc files and if it
finds them cause a rule to be generated to run moc at build time on the
accompanying header file foo.h.
If a source file has the SKIP_AUTOMOC property set it will be ignored by
this macro.
If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and
INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc.

function QT4_USE_MODULES( target [link_type] modules...)
This function is obsolete. Use target_link_libraries with IMPORTED targets
instead.
Make <target> use the <modules> from Qt. Using a Qt module means
to link to the library, add the relevant include directories for the
module, and add the relevant compiler defines for using the module.
Modules are roughly equivalent to components of Qt4, so usage would be
something like:
qt4_use_modules(myexe Core Gui Declarative)
to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument
can be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the
same argument to the target_link_libraries call.

A particular Qt library may be used by using the corresponding IMPORTED target with the target_link_libraries() command:

target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)

Using a target in this way causes :cmake(1)` to use the appropriate include directories and compile definitions for the target when compiling myexe.

Targets are aware of their dependencies, so for example it is not necessary to list Qt4::QtCore if another Qt library is listed, and it is not necessary to list Qt4::QtGui if Qt4::QtDeclarative is listed. Targets may be tested for existence in the usual way with the if(TARGET) command.

The Qt toolkit may contain both debug and release libraries. cmake(1) will choose the appropriate version based on the build configuration.

This should only be used if your project can work with multiple versions of Qt. If not, you should just directly use FindQt4 or FindQt3. If multiple versions of Qt are found on the machine, then The user must set the option DESIRED_QT_VERSION to the version they want to use. If only one version of qt is found on the machine, then the DESIRED_QT_VERSION is set to that version and the matching FindQt3 or FindQt4 module is included. Once the user sets DESIRED_QT_VERSION, then the FindQt3 or FindQt4 module is included.

This module can only detect and switch between Qt versions 3 and 4. It cannot handle Qt5 or any later versions.

QT_REQUIRED if this is set to TRUE then if CMake can
not find Qt4 or Qt3 an error is raised
and a message is sent to the user.

DESIRED_QT_VERSION OPTION is created
QT4_INSTALLED is set to TRUE if qt4 is found.
QT3_INSTALLED is set to TRUE if qt3 is found.

This module finds if any HLA RTI is installed and locates the standard RTI include files and libraries.

RTI is a simulation infrastructure standardized by IEEE and SISO. It has a well defined C++ API that assures that simulation applications are independent on a particular RTI implementation.

http://en.wikipedia.org/wiki/Run-Time_Infrastructure_(simulation)

This code sets the following variables:

RTI_INCLUDE_DIR = the directory where RTI includes file are found
RTI_LIBRARIES = The libraries to link against to use RTI
RTI_DEFINITIONS = -DRTI_USES_STD_FSTREAM
RTI_FOUND = Set to FALSE if any HLA RTI was not found

SDL_IMAGE_LIBRARIES, the name of the library to link against
SDL_IMAGE_INCLUDE_DIRS, where to find the headers
SDL_IMAGE_FOUND, if false, do not try to link against
SDL_IMAGE_VERSION_STRING - human-readable string containing the
version of SDL_image

SDL_MIXER_LIBRARIES, the name of the library to link against
SDL_MIXER_INCLUDE_DIRS, where to find the headers
SDL_MIXER_FOUND, if false, do not try to link against
SDL_MIXER_VERSION_STRING - human-readable string containing the
version of SDL_mixer

SDL_NET_LIBRARIES, the name of the library to link against
SDL_NET_INCLUDE_DIRS, where to find the headers
SDL_NET_FOUND, if false, do not try to link against
SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net

SDL_LIBRARY, the name of the library to link against
SDL_FOUND, if false, do not try to link to SDL
SDL_INCLUDE_DIR, where to find SDL.h
SDL_VERSION_STRING, human-readable string containing the version of SDL

This module responds to the flag:

SDL_BUILDING_LIBRARY
If this is defined, then no SDL_main will be linked in because
only applications need main().
Otherwise, it is assumed you are building an application and this
module will attempt to locate and set the proper link flags
as part of the returned SDL_LIBRARY variable.

Don’t forget to include SDLmain.h and SDLmain.m your project for the OS X framework based version. (Other versions link to -lSDLmain which this module will try to find on your behalf.) Also for OS X, this module will automatically add the -framework Cocoa on your behalf.

Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration and no SDL_LIBRARY, it means CMake did not find your SDL library (SDL.dll, libsdl.so, SDL.framework, etc). Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value as appropriate. These values are used to generate the final SDL_LIBRARY variable, but when these values are unset, SDL_LIBRARY does not get created.

$SDLDIR is an environment variable that would correspond to the

Modified by Eric Wing. Added code to assist with automated building by using environmental variables and providing a more controlled/consistent search behavior. Added new modifications to recognize OS X frameworks and additional Unix paths (FreeBSD, etc). Also corrected the header search path to follow “proper” SDL guidelines. Added a search for SDLmain which is needed by some platforms. Added a search for threads which is needed by some platforms. Added needed compile switches for MinGW.

On OSX, this will prefer the Framework version (if found) over others. People will have to manually change the cache values of SDL_LIBRARY to override this selection or set the CMake environment CMAKE_INCLUDE_PATH to modify the search paths.

Note that the header path has changed from SDL/SDL.h to just SDL.h This needed to change because “proper” SDL convention is #include “SDL.h”, not <SDL/SDL.h>. This is done for portability reasons because not all systems place things in SDL/ (see FreeBSD).

This module depends on SDL being found and must be called AFTER FindSDL.cmake is called.

This module defines

SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
to link against.
SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
This is available mostly for cases this module failed to anticipate for
and you must add additional flags. This is marked as ADVANCED.
SDL_SOUND_VERSION_STRING, human-readable string containing the
version of SDL_sound

This module also defines (but you shouldn’t need to use directly)

SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.

Typically, you should not use these variables directly, and you should use SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries (if needed) to successfully compile on your system.

Created by Eric Wing. This module is a bit more complicated than the other FindSDL* family modules. The reason is that SDL_sound can be compiled in a large variety of different ways which are independent of platform. SDL_sound may dynamically link against other 3rd party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug, MikMod, FLAC, Speex, and potentially others. Under some circumstances which I don’t fully understand, there seems to be a requirement that dependent libraries of libraries you use must also be explicitly linked against in order to successfully compile. SDL_sound does not currently have any system in place to know how it was compiled. So this CMake module does the hard work in trying to discover which 3rd party libraries are required for building (if any). This module uses a brute force approach to create a test program that uses SDL_sound, and then tries to build it. If the build fails, it parses the error output for known symbol names to figure out which libraries are needed.

Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would correspond to the ./configure –prefix=$SDLDIR used in building SDL.

On OSX, this will prefer the Framework version (if found) over others. People will have to manually change the cache values of SDL_LIBRARY to override this selectionor set the CMake environment CMAKE_INCLUDE_PATH to modify the search paths.

SDL_TTF_LIBRARIES, the name of the library to link against
SDL_TTF_INCLUDE_DIRS, where to find the headers
SDL_TTF_FOUND, if false, do not try to link against
SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf

This module can be used to find Squish. Currently Squish versions 3 and 4 are supported.

SQUISH_FOUND If false, don't try to use Squish
SQUISH_VERSION The full version of Squish found
SQUISH_VERSION_MAJOR The major version of Squish found
SQUISH_VERSION_MINOR The minor version of Squish found
SQUISH_VERSION_PATCH The patch version of Squish found

the name of the cmake target which will be used as AUT, i.e. the executable which will be tested.

SUITE suiteName

this is either the full path to the squish suite, or just the last directory of the suite, i.e. the suite name. In this case the CMakeLists.txt which calls squish_add_test() must be located in the parent directory of the suite directory.

TEST squishTestName

the name of the squish test, i.e. the name of the subdirectory of the test inside the suite directory.

SETTINGSGROUP group

if specified, the given settings group will be used for executing the test. If not specified, the groupname will be “CTest_<username>”

PRE_COMMAND command

if specified, the given command will be executed before starting the squish test.

Subversion_SVN_EXECUTABLE - path to svn command line client
Subversion_VERSION_SVN - version of svn command line client
Subversion_FOUND - true if the command line client was found
SUBVERSION_FOUND - same as Subversion_FOUND, set for compatibility reasons

The minimum required version of Subversion can be specified using the standard syntax, e.g. find_package(Subversion 1.4).

If the command line client executable is found two macros are defined:

Subversion_WC_INFO extracts information of a subversion working copy at a given location. This macro defines the following variables if running Subversion’s info command on <dir> succeeds; otherwise a SEND_ERROR message is generated. The error can be ignored by providing the IGNORE_SVN_FAILURE option, which causes these variables to remain undefined.

This module finds if Tcl is installed and determines where the include files and libraries are. It also determines what the name of the library is. This code sets the following variables:

TCL_FOUND = Tcl was found
TK_FOUND = Tk was found
TCLTK_FOUND = Tcl and Tk were found
TCL_LIBRARY = path to Tcl library (tcl tcl80)
TCL_INCLUDE_PATH = path to where tcl.h can be found
TCL_TCLSH = path to tclsh binary (tcl tcl80)
TK_LIBRARY = path to Tk library (tk tk80 etc)
TK_INCLUDE_PATH = path to where tk.h can be found
TK_WISH = full path to the wish executable

In an effort to remove some clutter and clear up some issues for people who are not necessarily Tcl/Tk gurus/developers, some variables were moved or removed. Changes compared to CMake 2.4 are:

=> they were only useful for people writing Tcl/Tk extensions.
=> these libs are not packaged by default with Tcl/Tk distributions.
Even when Tcl/Tk is built from source, several flavors of debug libs
are created and there is no real reason to pick a single one
specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx).
Let's leave that choice to the user by allowing him to assign
TCL_LIBRARY to any Tcl library, debug or not.
=> this ended up being only a Win32 variable, and there is a lot of
confusion regarding the location of this file in an installed Tcl/Tk
tree anyway (see 8.5 for example). If you need the internal path at
this point it is safer you ask directly where the *source* tree is
and dig from there.

In an effort to remove some clutter and clear up some issues for people who are not necessarily Tcl/Tk gurus/developers, some variables were moved or removed. Changes compared to CMake 2.4 are:

=> these libs are not packaged by default with Tcl/Tk distributions.
Even when Tcl/Tk is built from source, several flavors of debug libs
are created and there is no real reason to pick a single one
specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx).
Let's leave that choice to the user by allowing him to assign
TCL_STUB_LIBRARY to any Tcl library, debug or not.

CMAKE_THREAD_LIBS_INIT - the thread library
CMAKE_USE_SPROC_INIT - are we using sproc?
CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
CMAKE_USE_PTHREADS_INIT - are we using pthreads
CMAKE_HP_PTHREADS_INIT - are we using hp pthreads

The following import target is created

Threads::Threads

For systems with multiple thread libraries, caller can set

CMAKE_THREAD_PREFER_PTHREAD

If the use of the -pthread compiler and linker flag is preferred then the caller can set

THREADS_PREFER_PTHREAD_FLAG

Please note that the compiler flag can only be used with the imported target. Use of both the imported target as well as this switch is highly recommended for new code.

This module existed in versions of CMake prior to 3.1, but became only a thin wrapper around find_package(VTK NO_MODULE) to provide compatibility for projects using long-outdated conventions. Now find_package(VTK) will search for VTKConfig.cmake directly.

This module finds if wxWidgets is installed and selects a default configuration to use. wxWidgets is a modular library. To specify the modules that you will use, you need to name them as components to the package:

find_package(wxWidgets COMPONENTS core base …)

There are two search branches: a windows style and a unix style. For windows, the following variables are searched for and set to defaults in case of multiple choices. Change them if the defaults are not desired (i.e., these are the only variables you should change to select a configuration):

For unix style it uses the wx-config utility. You can select between debug/release, unicode/ansi, universal/non-universal, and static/shared in the QtDialog or ccmake interfaces by turning ON/OFF the following variables:

There is also a wxWidgets_CONFIG_OPTIONS variable for all other options that need to be passed to the wx-config utility. For example, to use the base toolkit found in the /usr/local path, set the variable (before calling the FIND_PACKAGE command) as such:

set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)

The following are set after the configuration is done for both windows and unix style:

This module finds if wxWindows/wxWidgets is installed and determines where the include files and libraries are. It also determines what the name of the library is. Please note this file is DEPRECATED and replaced by FindwxWidgets.cmake. This code sets the following variables:

ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
ZLIB_VERSION_MAJOR - The major version of zlib
ZLIB_VERSION_MINOR - The minor version of zlib
ZLIB_VERSION_PATCH - The patch version of zlib
ZLIB_VERSION_TWEAK - The tweak version of zlib

If the mangling for some symbol is not known then no preprocessor definition is created, and a warning is displayed.

SYMBOL_NAMESPACE

Prefix all preprocessor definitions generated by the SYMBOLS option with a given namespace <ns>.

FortranCInterface_VERIFY

The FortranCInterface_VERIFY function is provided to verify that the Fortran and C/C++ compilers work together:

FortranCInterface_VERIFY([CXX] [QUIET])

It tests whether a simple test executable using Fortran and C (and C++ when the CXX option is given) compiles and links successfully. The result is stored in the cache entry FortranCInterface_VERIFIED_C (or FortranCInterface_VERIFIED_CXX if CXX is given) as a boolean. If the check fails and QUIET is not given the function terminates with a fatal error message describing the problem. The purpose of this check is to stop a build early for incompatible compiler combinations. The test is built in the Release configuration.

The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN can be used to add the appropriate compile flags for targets. See the documentation of those target properties, and the convenience variables CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN.

By default GENERATE_EXPORT_HEADER() generates macro names in a file name determined by the name of the library. This means that in the simplest case, users of GenerateExportHeader will be equivalent to:

The CMake fragment will generate a file in the ${CMAKE_CURRENT_BINARY_DIR} called somelib_export.h containing the macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT, SOMELIB_DEPRECATED, SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT. They will be followed by content taken from the variable specified by the CUSTOM_CONTENT_FROM_VARIABLE option, if any. The resulting file should be installed with other headers in the library.

The BASE_NAME argument can be used to override the file name and the names used for the macros:

If PREFIX_NAME is specified, the argument will be used as a prefix to all generated macros.

For example:

generate_export_header(somelib PREFIX_NAME VTK_)

Generates the macros VTK_SOMELIB_EXPORT etc.

ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )

The ADD_COMPILER_EXPORT_FLAGS function adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on Windows which does not need extra compiler flags for exporting support. You may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will be populated with the CXX_FLAGS required to enable visibility support for the compiler/architecture in use.

This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN instead.

Get the list of shared library files required by <target>. The list in the variable named <prerequisites_var> should be empty on first entry to this function. On exit, <prerequisites_var> will contain the list of required shared library files.

<target> is the full path to an executable file. <prerequisites_var> is the name of a CMake variable to contain the results. <exclude_system> must be 0 or 1 indicating whether to include or exclude “system” prerequisites. If <recurse> is set to 1 all prerequisites will be found recursively, if set to 0 only direct prerequisites are listed. <exepath> is the path to the top level executable used for @executable_path replacment on the Mac. <dirs> is a list of paths where libraries might be found: these paths are searched first when a target without any path info is given. Then standard system locations are also searched: PATH, Framework locations, /usr/lib…

<target> is the name of a shared library or executable target or the full path to a shared library or executable file. If <recurse> is set to 1 all prerequisites will be found recursively, if set to 0 only direct prerequisites are listed. <exclude_system> must be 0 or 1 indicating whether to include or exclude “system” prerequisites. With <verbose> set to 0 only the full path names of the prerequisites are printed, set to 1 extra informatin will be displayed.

LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)

Print the prerequisites of shared library and executable files matching a globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and <glob_exp> is a globbing expression used with “file(GLOB” or “file(GLOB_RECURSE” to retrieve a list of matching files. If a matching file is executable, its prerequisites are listed.

Any additional (optional) arguments provided are passed along as the optional arguments to the list_prerequisites calls.

GP_APPEND_UNIQUE(<list_var> <value>)

Append <value> to the list variable <list_var> only if the value is not already in the list.

IS_FILE_EXECUTABLE(<file> <result_var>)

Return 1 in <result_var> if <file> is a binary executable, 0 otherwise.

GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)

Return the path that others should refer to the item by when the item is embedded inside a bundle.

Override on a per-project basis by providing a project-specific gp_item_default_embedded_path_override function.

Destination for files of a given type. This value may be passed to the DESTINATION options of install() commands for the corresponding file type.

CMAKE_INSTALL_FULL_<dir>

The absolute path generated from the corresponding CMAKE_INSTALL_<dir> value. If the value is not already an absolute path, an absolute path is constructed typically by prepending the value of the CMAKE_INSTALL_PREFIX variable. However, there are some special cases as documented below.

where <dir> is one of:

BINDIR

user executables (bin)

SBINDIR

system admin executables (sbin)

LIBEXECDIR

program executables (libexec)

SYSCONFDIR

read-only single-machine data (etc)

SHAREDSTATEDIR

modifiable architecture-independent data (com)

LOCALSTATEDIR

modifiable single-machine data (var)

RUNSTATEDIR

run-time variable data (LOCALSTATEDIR/run)

LIBDIR

object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)

INCLUDEDIR

C header files (include)

OLDINCLUDEDIR

C header files for non-gcc (/usr/include)

DATAROOTDIR

read-only architecture-independent data root (share)

DATADIR

read-only architecture-independent data (DATAROOTDIR)

INFODIR

info documentation (DATAROOTDIR/info)

LOCALEDIR

locale-dependent data (DATAROOTDIR/locale)

MANDIR

man documentation (DATAROOTDIR/man)

DOCDIR

documentation root (DATAROOTDIR/doc/PROJECT_NAME)

If the includer does not define a value the above-shown default will be used and the value will appear in the cache for editing by the user.

For <dir> other than the SYSCONFDIR, LOCALSTATEDIR and RUNSTATEDIR, the value of CMAKE_INSTALL_<dir> is prefixed with usr/ if it is not user-specified as an absolute path. For example, the INCLUDEDIR value include becomes usr/include. This is required by the GNU Coding Standards, which state:

When building the complete GNU system, the prefix will be empty and /usr will be a symbolic link to /.

/usr

For <dir> equal to SYSCONFDIR, LOCALSTATEDIR or RUNSTATEDIR, the CMAKE_INSTALL_FULL_<dir> is computed by prepending just / to the value of CMAKE_INSTALL_<dir> if it is not user-specified as an absolute path. For example, the SYSCONFDIR value etc becomes /etc. This is required by the GNU Coding Standards.

/opt/...

For <dir> equal to SYSCONFDIR, LOCALSTATEDIR or RUNSTATEDIR, the CMAKE_INSTALL_FULL_<dir> is computed by appending the prefix to the value of CMAKE_INSTALL_<dir> if it is not user-specified as an absolute path. For example, the SYSCONFDIR value etc becomes /etc/opt/.... This is defined by the Filesystem Hierarchy Standard.

Set the given variable absvar to the absolute path contained within the variable var. This is to allow the computation of an absolute path, accounting for all the special cases documented above. While this macro is used to compute the various CMAKE_INSTALL_FULL_<dir> variables, it is exposed publicly to allow users who create additional path variables to also compute absolute paths where necessary, using the same logic.

This module defines functions to help use the Google Test infrastructure. Two mechanisms for adding tests are provided. gtest_add_tests() has been around for some time, originally via find_package(GTest). gtest_discover_tests() was introduced in CMake 3.10.

The (older) gtest_add_tests() scans source files to identify tests. This is usually effective, with some caveats, including in cross-compiling environments, and makes setting additional properties on tests more convenient. However, its handling of parameterized tests is less comprehensive, and it requires re-running CMake to detect changes to the list of tests.

The (newer) gtest_discover_tests() discovers tests by asking the compiled test executable to enumerate its tests. This is more robust and provides better handling of parameterized tests, and does not require CMake to be re-run when tests change. However, it may not work in a cross-compiling environment, and setting test properties is less convenient.

More details can be found in the documentation of the respective functions.

Both commands are intended to replace use of add_test() to register tests, and will create a separate CTest test for each Google Test test case. Note that this is in some cases less efficient, as common set-up and tear-down logic cannot be shared by multiple test cases executing in the same instance. However, it provides more fine-grained pass/fail information to CTest, which is usually considered as more beneficial. By default, the CTest test name is the same as the Google Test name (i.e. suite.testcase); see also TEST_PREFIX and TEST_SUFFIX.

gtest_add_tests attempts to identify tests by scanning source files. Although this is generally effective, it uses only a basic regular expression match, which can be defeated by atypical test declarations, and is unable to fully “split” parameterized tests. Additionally, it requires that CMake be re-run to discover any newly added, removed or renamed tests (by default, this means that CMake is re-run when any test source file is changed, but see SKIP_DEPENDENCY). However, it has the advantage of declaring tests at CMake time, which somewhat simplifies setting additional properties on tests, and always works in a cross-compiling environment.

The options are:

TARGET target

Specifies the Google Test executable, which must be a known CMake executable target. CMake will substitute the location of the built executable when running the test.

SOURCES src1...

When provided, only the listed files will be scanned for test cases. If this option is not given, the SOURCES property of the specified target will be used to obtain the list of sources.

EXTRA_ARGS arg1...

Any extra arguments to pass on the command line to each test case.

WORKING_DIRECTORY dir

Specifies the directory in which to run the discovered test cases. If this option is not provided, the current binary directory is used.

TEST_PREFIX prefix

Specifies a prefix to be prepended to the name of each discovered test case. This can be useful when the same source files are being used in multiple calls to gtest_add_test() but with different EXTRA_ARGS.

TEST_SUFFIX suffix

Similar to TEST_PREFIX except the suffix is appended to the name of every discovered test case. Both TEST_PREFIX and TEST_SUFFIX may be specified.

SKIP_DEPENDENCY

Normally, the function creates a dependency which will cause CMake to be re-run if any of the sources being scanned are changed. This is to ensure that the list of discovered tests is updated. If this behavior is not desired (as may be the case while actually writing the test cases), this option can be used to prevent the dependency from being added.

TEST_LIST outVar

The variable named by outVar will be populated in the calling scope with the list of discovered test cases. This allows the caller to do things like manipulate test properties of the discovered tests.

gtest_discover_tests sets up a post-build command on the test executable that generates the list of tests by parsing the output from running the test with the --gtest_list_tests argument. Compared to the source parsing approach of gtest_add_tests(), this ensures that the full list of tests, including instantiations of parameterized tests, is obtained. Since test discovery occurs at build time, it is not necessary to re-run CMake when the list of tests changes. However, it requires that CROSSCOMPILING_EMULATOR is properly set in order to function in a cross-compiling environment.

Additionally, setting properties on tests is somewhat less convenient, since the tests are not available at CMake time. Additional test properties may be assigned to the set of tests as a whole using the PROPERTIES option. If more fine-grained test control is needed, custom content may be provided through an external CTest script using the TEST_INCLUDE_FILES directory property. The set of discovered tests is made accessible to such a script via the <target>_TESTS variable.

The options are:

target

Specifies the Google Test executable, which must be a known CMake executable target. CMake will substitute the location of the built executable when running the test.

EXTRA_ARGS arg1...

Any extra arguments to pass on the command line to each test case.

WORKING_DIRECTORY dir

Specifies the directory in which to run the discovered test cases. If this option is not provided, the current binary directory is used.

TEST_PREFIX prefix

Specifies a prefix to be prepended to the name of each discovered test case. This can be useful when the same test executable is being used in multiple calls to gtest_discover_tests() but with different EXTRA_ARGS.

TEST_SUFFIX suffix

Similar to TEST_PREFIX except the suffix is appended to the name of every discovered test case. Both TEST_PREFIX and TEST_SUFFIX may be specified.

NO_PRETTY_TYPES

By default, the type index of type-parameterized tests is replaced by the actual type name in the CTest test name. If this behavior is undesirable (e.g. because the type names are unwieldy), this option will suppress this behavior.

NO_PRETTY_VALUES

By default, the value index of value-parameterized tests is replaced by the actual value in the CTest test name. If this behavior is undesirable (e.g. because the value strings are unwieldy), this option will suppress this behavior.

PROPERTIES name1 value1...

Specifies additional properties to be set on all tests discovered by this invocation of gtest_discover_tests.

TEST_LIST var

Make the list of tests available in the variable var, rather than the default <target>_TESTS. This can be useful when the same test executable is being used in multiple calls to gtest_discover_tests(). Note that this variable is only available in CTest.

DISCOVERY_TIMEOUT num

Specifies how long (in seconds) CMake will wait for the test to enumerate available tests. If the test takes longer than this, discovery (and your build) will fail. Most test executables will enumerate their tests very quickly, but under some exceptional circumstances, a test may require a longer timeout. The default is 5. See also the TIMEOUT option of execute_process().

NOTE:

In CMake versions 3.10.1 and 3.10.2, this option was called TIMEOUT. This clashed with the TIMEOUT test property, which is one of the common properties that would be set with the PROPERTIES keyword, usually leading to legal but unintended behavior. The keyword was changed to DISCOVERY_TIMEOUT in CMake 3.10.3 to address this problem. The ambiguous behavior of the TIMEOUT keyword in 3.10.1 and 3.10.2 has not been preserved.

Include this module to search for compiler-provided system runtime libraries and add install rules for them. Some optional variables may be set prior to including the module to adjust behavior:

CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS

Specify additional runtime libraries that may not be detected. After inclusion any detected libraries will be appended to this.

CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP

Set to TRUE to skip calling the install(PROGRAMS) command to allow the includer to specify its own install rule, using the value of CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to get the list of libraries.

CMAKE_INSTALL_DEBUG_LIBRARIES

Set to TRUE to install the debug runtime libraries when available with MSVC tools.

CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY

Set to TRUE to install only the debug runtime libraries with MSVC tools even if the release runtime libraries are also available.

CMAKE_INSTALL_UCRT_LIBRARIES

Set to TRUE to install the Windows Universal CRT libraries for app-local deployment (e.g. to Windows XP). This is meaningful only with MSVC from Visual Studio 2015 or higher.

One may set a CMAKE_WINDOWS_KITS_10_DIRenvironment variable to an absolute path to tell CMake to look for Windows 10 SDKs in a custom location. The specified directory is expected to contain Redist/ucrt/DLLs/* directories.

CMAKE_INSTALL_MFC_LIBRARIES

Set to TRUE to install the MSVC MFC runtime libraries.

CMAKE_INSTALL_OPENMP_LIBRARIES

Set to TRUE to install the MSVC OpenMP runtime libraries

CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION

Specify the install(PROGRAMS) command DESTINATION option. If not specified, the default is bin on Windows and lib elsewhere.

CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS

Set to TRUE to disable warnings about required library files that do not exist. (For example, Visual Studio Express editions may not provide the redistributable files.)

CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT

Specify the install(PROGRAMS) command COMPONENT option. If not specified, no such option will be used.

Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There are usually better ways to specify the correct dependencies.

MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files…) is just a convenience wrapper around the OBJECT_DEPENDS source file property. You can just use set_property(SOURCE <file> APPEND PROPERTY OBJECT_DEPENDS depend_files) instead.

Sets the variable named ${var} to the number of physical cores available on the machine if the information can be determined. Otherwise it is set to 0. Currently this functionality is implemented for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and Windows.

This function is guaranteed to return a positive integer (>=1) if it succeeds. It returns 0 if there’s a problem determining the processor count.

This function is intended to offer an approximation of the value of the number of compute cores available on the current machine, such that you may use that value for parallel building and parallel testing. It is meant to help utilize as much of the machine as seems reasonable. Of course, knowledge of what else might be running on the machine simultaneously should be used when deciding whether to request a machine’s full capacity all for yourself.

This macro takes a library base name as an argument, and will choose good values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what has been found and set. If only basename_LIBRARY_RELEASE is defined, basename_LIBRARY will be set to the release value, and basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will take the debug value, and basename_LIBRARY_RELEASE will be set to basename_LIBRARY_RELEASE-NOTFOUND.

If the generator supports configuration types, then basename_LIBRARY and basename_LIBRARIES will be set with debug and optimized flags specifying the library to be used for the given configuration. If no build type has been set or the generator in use does not support configuration types, then basename_LIBRARY and basename_LIBRARIES will take only the release value, or the debug value if the release one is not set.

This script launches a GUI test using Squish. You should not call the script directly; instead, you should access it via the SQUISH_ADD_TEST macro that is defined in FindSquish.cmake.

This script starts the Squish server, launches the test on the client, and finally stops the squish server. If any of these steps fail (including if the tests do not pass) then a fatal error is raised.

This file contains the following macros: ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs ECOS_ADD_EXECUTABLE(name source1 … sourceN ) - create an eCos executable ECOS_ADJUST_DIRECTORY(VAR source1 … sourceN ) - adjusts the path of the source files and puts the result into VAR

Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable the ARM ELF toolchain for the directory where it is called ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain for the directory where it is called

It contains the following variables: ECOS_DEFINITIONS ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your eCos configuration file has a different name, adjust this variable for internal use only:

This command creates a <target_name>.jar. It compiles the given source files (source) and adds the given resource files (resource) to the jar file. Source files can be java files or listing files (prefixed by ‘@’). If only resource files are given then just a jar file is created. The list of include jars are added to the classpath when compiling the java sources and also to the dependencies of the target. INCLUDE_JARS also accepts other target names created by add_jar. For backwards compatibility, jar files listed as sources are ignored (as they have been since the first version of this module).

The default OUTPUT_DIR can also be changed by setting the variable CMAKE_JAVA_TARGET_OUTPUT_DIR.

Optionally, using option GENERATE_NATIVE_HEADERS, native header files can be generated for methods declared as native. These files provide the connective glue that allow your Java and C code to interact. An INTERFACE target will be created for an easy usage of generated files. Sub-option DESTINATION can be used to specify output directory for generated header files.

GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.

Additional instructions:

To add compile flags to the target you can set these flags with
the following variable:

set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)

To add a path or a jar file to the class path you can do this
with the CMAKE_JAVA_INCLUDE_PATH variable.

set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)

To use a different output name for the target you can set it with:

add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)

To use a different output directory than CMAKE_CURRENT_BINARY_DIR
you can set it with:

add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)

To define an entry point in your jar you can set it with the ENTRY_POINT
named argument:

add_jar(example ENTRY_POINT com/examples/MyProject/Main)

To define a custom manifest for the jar, you can set it with the manifest
named argument:

add_jar(example MANIFEST /path/to/manifest)

To add a VERSION to the target output name you can set it using
the VERSION named argument to add_jar. This will create a jar file with the
name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
pointing to the jar with the version information.

add_jar(shibboleet shibbotleet.java VERSION 1.2.0)

If the target is a JNI library, utilize the following commands to
create a JNI symbolic link:

If a single target needs to produce more than one jar from its
java source code, to prevent the accumulation of duplicate class
files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior
to calling the add_jar() function:

set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
add_jar(foo foo.java)

set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
add_jar(bar bar.java)

For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
include module JNI before any call to add_jar. The produced target for native
headers can then be used to compile C/C++ sources with command
target_link_libraries.

The add_jar() function sets some target properties. You can get these
properties with the
get_property(TARGET <target_name> PROPERTY <propery_name>)
command.

INSTALL_FILES The files which should be installed. This is used by
install_jar().
JNI_SYMLINK The JNI symlink which should be installed.
This is used by install_jni_symlink().
JAR_FILE The location of the jar file so that you can include
it.
CLASSDIR The directory where the class files can be found. For
example to use them with javah.

This command is used to find a full path to the named jar. A cache entry named by <VAR> is created to stor the result of this command. If the full path to a jar is found the result is stored in the variable and the search will not repeated unless the variable is cleared. If nothing is found, the result will be <VAR>-NOTFOUND, and the search will be attempted again next time find_jar is invoked with the same variable. The name of the full path to a file that is searched for is specified by the names listed after NAMES argument. Additional search locations can be specified after the PATHS argument. If you require special a version of a jar file you can specify it with the VERSIONS argument. The argument after DOC will be used for the documentation string in the cache.

This command installs the TARGET_NAME files to the given DESTINATION. It should be called in the same scope as add_jar() or it will fail.

Target Properties:

The install_jar() function sets the INSTALL_DESTINATION target property
on jars so installed. This property holds the DESTINATION as described
above, and is used by install_jar_exports(). You can get this property
with the
get_property(TARGET <target_name> PROPERTY INSTALL_DESTINATION)
command.

Both signatures share most of the options. These options are the same as what you can find in the javadoc manpage. Please look at the manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION.

Calling PKGCONFIG will fill the desired information into the 4 given arguments, e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS) if pkg-config was NOT found or the specified software package doesn’t exist, the variable will be empty when the function returns, otherwise they will contain the respective information

Targets created with the swig_add_library command have the same capabilities as targets created with the add_library() command, so those targets can be used with any command expecting a target (e.g. target_link_libraries()).

NOTE:

This command creates a target with the specified <name> when policy CMP0078 is set to NEW. Otherwise, the legacy behavior will choose a different target name and store it in the SWIG_MODULE_<name>_REAL_NAME variable.

NOTE:

For multi-config generators, this module does not support configuration-specific files generated by SWIG. All build configurations must result in the same generated source file.

TYPE

SHARED, MODULE and STATIC have the same semantic as for the add_library() command. If USE_BUILD_SHARED_LIBS is specified, the library type will be STATIC or SHARED based on whether the current value of the BUILD_SHARED_LIBS variable is ON. If no type is specified, MODULE will be used.

LANGUAGE

Specify the target language.

NO_PROXY

Prevent the generation of the wrapper layer (swig -noproxy option).

OUTPUT_DIR

Specify where to write the language specific files (swig -outdir option). If not given, the CMAKE_SWIG_OUTDIR variable will be used. If neither is specified, the default depends on the value of the UseSWIG_MODULE_VERSION variable as follows:

If UseSWIG_MODULE_VERSION is 1 or is undefined, output is written to the CMAKE_CURRENT_BINARY_DIR directory.

If UseSWIG_MODULE_VERSION is 2, a dedicated directory will be used. The path of this directory can be retrieved from the SWIG_SUPPORT_FILES_DIRECTORY target property.

OUTFILE_DIR

Specify an output directory name where the generated source file will be placed (swig -o option). If not specified, the SWIG_OUTFILE_DIR variable will be used. If neither is specified, OUTPUT_DIR or CMAKE_SWIG_OUTDIR is used instead.

SOURCES

List of sources for the library. Files with extension .i will be identified as sources for the SWIG tool. Other files will be handled in the standard way.

NOTE:

If UseSWIG_MODULE_VERSION is set to 2, it is strongly recommended to use a dedicated directory unique to the target when either the OUTPUT_DIR option or the CMAKE_SWIG_OUTDIR variable are specified. The output directory contents are erased as part of the target build, so to prevent interference between targets or losing other important files, each target should have its own dedicated output directory.

swig_link_libraries

Link libraries to swig module:

swig_link_libraries(<name> <item>...)

This command has same capabilities as target_link_libraries() command.

NOTE:

If variable UseSWIG_TARGET_NAME_PREFERENCE is set to STANDARD, this command is deprecated and target_link_libraries() command must be used instead.

Source file properties on module files must be set before the invocation of the swig_add_library command to specify special behavior of SWIG and ensure generated files will receive the required settings.

Add custom flags to SWIG compiler and have same semantic as properties INCLUDE_DIRECTORIES, COMPILE_DEFINITIONS and COMPILE_OPTIONS.

USE_TARGET_INCLUDE_DIRECTORIES

If set to TRUE, contents of target property INCLUDE_DIRECTORIES will be forwarded to SWIG compiler. If set to FALSE target property INCLUDE_DIRECTORIES will be ignored. If not set, target property SWIG_USE_TARGET_INCLUDE_DIRECTORIES will be considered.

If set to TRUE, contents of target property INCLUDE_DIRECTORIES will be forwarded to SWIG compiler. If set to FALSE or not defined, target property INCLUDE_DIRECTORIES will be ignored. This behavior can be overridden by specifying source property USE_TARGET_INCLUDE_DIRECTORIES.

Only most principal support files are listed. In case some advanced features of SWIG are used (for example %template), associated support files may not be listed. Prefer to use the SWIG_SUPPORT_FILES_DIRECTORY property to handle support files.

SWIG_SUPPORT_FILES_DIRECTORY

This output property specifies the directory where support files will be generated.

Some variables can be set to customize the behavior of swig_add_library as well as SWIG:

UseSWIG_MODULE_VERSION

Specify different behaviors for UseSWIG module.

Set to 1 or undefined: Legacy behavior is applied.

Set to 2: A new strategy is applied regarding support files: the output directory of support files is erased before SWIG interface compilation.

Determines if wxWidgets was FOUND and sets the appropriate libs, incdirs, flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are called.

USAGE

# Note that for MinGW users the order of libs is important!
find_package(wxWidgets REQUIRED net gl core base)
include(${wxWidgets_USE_FILE})
# and for each of your dependent executable/library targets:
target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})

DEPRECATED

LINK_LIBRARIES is not called in favor of adding dependencies per target.

The write_compiler_detection_header function generates the file <file> with macros which all have the prefix <prefix>.

By default, all content is written directly to the <file>. The OUTPUT_FILES_VAR may be specified to cause the compiler-specific content to be written to separate files. The separate files are then available in the <output_files_var> and may be consumed by the caller for installation for example. The OUTPUT_DIR specifies a relative path from the main <file> to the compiler-specific files. For example:

VERSION may be used to specify the API version to be generated. Future versions of CMake may introduce alternative APIs. A given API is selected by any <version> value greater than or equal to the version of CMake that introduced the given API and less than the version of CMake that introduced its succeeding API. The value of the CMAKE_MINIMUM_REQUIRED_VERSION variable is used if no explicit version is specified. (As of CMake version 3.13.3 there is only one API version.)

PROLOG may be specified as text content to write at the start of the header. EPILOG may be specified as text content to write at the end of the header

At least one <compiler> and one <feature> must be listed. Compilers which are known to CMake, but not specified are detected and a preprocessor #error is generated for them. A preprocessor macro matching <PREFIX>_COMPILER_IS_<compiler> is generated for each compiler known to CMake to contain the value 0 or 1.

Possible compiler identifiers are documented with the CMAKE_<LANG>_COMPILER_ID variable. Available features in this version of CMake are listed in the CMAKE_C_KNOWN_FEATURES and CMAKE_CXX_KNOWN_FEATURES global properties. The {c,cxx}_std_* meta-features are ignored if requested.

BARE_FEATURES will define the compatibility macros with the name used in newer versions of the language standard, so the code can use the new feature name unconditionally.

ALLOW_UNKNOWN_COMPILERS and ALLOW_UNKNOWN_COMPILER_VERSIONS cause the module to generate conditions that treat unknown compilers as simply lacking all features. Without these options the default behavior is to generate a #error for unknown compilers and versions.

For each compiler, a preprocessor macro is generated matching <PREFIX>_COMPILER_IS_<compiler> which has the content either 0 or 1, depending on the compiler in use. Preprocessor macros for compiler version components are generated matching <PREFIX>_COMPILER_VERSION_MAJOR <PREFIX>_COMPILER_VERSION_MINOR and <PREFIX>_COMPILER_VERSION_PATCH containing decimal values for the corresponding compiler version components, if defined.

A preprocessor test is generated based on the compiler version denoting whether each feature is enabled. A preprocessor macro matching <PREFIX>_COMPILER_<FEATURE>, where <FEATURE> is the upper-case <feature> name, is generated to contain the value 0 or 1 depending on whether the compiler in use supports the feature:

The ClimbingStats_FINAL macro will expand to final if the compiler (and its flags) support the cxx_final feature, and the ClimbingStats_CONSTEXPR macro will expand to constexpr if cxx_constexpr is supported.

If BARE_FEATURES cxx_final was given as argument the final keyword will be defined for old compilers, too.

The following features generate corresponding symbol defines and if they are available as BARE_FEATURES:

Some features are suitable for wrapping in a macro with a backward compatibility implementation if the compiler does not support the feature.

When the cxx_static_assert feature is not provided by the compiler, a compatibility implementation is available via the <PREFIX>_STATIC_ASSERT(COND) and <PREFIX>_STATIC_ASSERT_MSG(COND, MSG) function-like macros. The macros expand to static_assert where that compiler feature is available, and to a compatibility implementation otherwise. In the first form, the condition is stringified in the message field of static_assert. In the second form, the message MSG is passed to the message field of static_assert, or ignored if using the backward compatibility implementation.

The cxx_attribute_deprecated feature provides a macro definition <PREFIX>_DEPRECATED, which expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __attribute__((__deprecated__)) used by GNU compilers.

The cxx_alignas feature provides a macro definition <PREFIX>_ALIGNAS which expands to either the standard alignas decorator or a compiler-specific decorator such as __attribute__ ((__aligned__)) used by GNU compilers.

The cxx_alignof feature provides a macro definition <PREFIX>_ALIGNOF which expands to either the standard alignof decorator or a compiler-specific decorator such as __alignof__ used by GNU compilers.

Feature

Define

Symbol

bare

cxx_alignas

<PREFIX>_ALIGNAS

alignas

cxx_alignof

<PREFIX>_ALIGNOF

alignof

cxx_nullptr

<PREFIX>_NULLPTR

nullptr

yes

cxx_static_assert

<PREFIX>_STATIC_ASSERT

static_assert

cxx_static_assert

<PREFIX>_STATIC_ASSERT_MSG

static_assert

cxx_attribute_deprecated

<PREFIX>_DEPRECATED

[[deprecated]]

cxx_attribute_deprecated

<PREFIX>_DEPRECATED_MSG

[[deprecated]]

cxx_thread_local

<PREFIX>_THREAD_LOCAL

thread_local

A use-case which arises with such deprecation macros is the deprecation of an entire library. In that case, all public API in the library may be decorated with the <PREFIX>_DEPRECATED macro. This results in very noisy build output when building the library itself, so the macro may be may be defined to empty in that case when building the deprecated library: