Integrated development environments (IDEs) may want to integrate with CMake to
+improve the development experience for CMake users. This document lays out the
+recommended best practices for such integration.
Many IDE vendors will want to bundle a copy of CMake with their IDE. IDEs that
+bundle CMake should present the user with the option of using an external CMake
+installation instead of the bundled one, in case the bundled copy becomes
+outdated and the user wants to use a newer version.
+
While IDE vendors may be tempted to bundle different versions of CMake with
+their application, such practice is not recommended. CMake has strong
+guarantees of backwards compatibility, and there is no reason not to use a
+newer version of CMake than what a project requires, or indeed, the very latest
+version. Therefore, it is recommended that IDE vendors that bundle CMake with
+their application always include the very latest patch version of CMake
+available at the time of release.
+
As a suggestion, IDEs may also ship a copy of the Ninja buildsystem alongside
+CMake. Ninja is highly performant and well-supported on all platforms that
+support CMake. IDEs that bundle Ninja should use Ninja 1.10 or later, which
+contains features needed to support Fortran builds.
CMake supports a file format called CMakePresets.json, and its
+user-specific counterpart, CMakeUserPresets.json. This file contains
+information on the various configure presets that a user may want. Each preset
+may have a different compiler, build flags, etc. The details of this format are
+explained in the cmake(1) manual.
+
IDE vendors are encouraged to read and evaluate this file the same way CMake
+does, and present the user with the presets listed in the file. Users should be
+able to see (and possibly edit) the CMake cache variables, environment
+variables, and command line options that are defined for a given preset. The
+IDE should then construct the list of appropriate cmake(1) command
+line arguments based on these settings, rather than using the
+--preset= option directly. The
+--preset= option is intended only as a convenient
+frontend for command line users, and should not be used by the IDE.
+
For example, if a preset named ninja specifies Ninja as the generator
+and ${sourceDir}/build as the build directory, instead of running:
+
cmake -S /path/to/source --preset=ninja
+
+
+
the IDE should instead calculate the settings of the ninja preset, and then
+run:
In cases where a preset contains lots of cache variables, and passing all of
+them as -D flags would cause the command line length limit
+of the platform to be exceeded, the IDE should instead construct a temporary
+cache script and pass it with the -C flag.
+
While reading, parsing, and evaluating the contents of CMakePresets.json is
+straightforward, it is not trivial. In addition to the documentation, IDE
+vendors may also wish to refer to the CMake source code and test cases for a
+better understanding of how to implement the format.
+Thisfile provides a
+machine-readable JSON schema for the CMakePresets.json format that IDE
+vendors may find useful for validation and providing editing assistance.
IDEs that invoke cmake(1) to run the configure step may wish to
+receive information about the artifacts that the build will produce, as well
+as the include directories, compile definitions, etc. used to build the
+artifacts. Such information can be obtained by using the
+FileAPI. The manual page for the File API
+contains more information about the API and how to invoke it.
+Servermode was removed as of CMake 3.20 and
+should not be used on CMake 3.14 or later.
+
IDEs should avoid creating more build trees than necessary, and only create
+multiple build trees if the user wishes to switch to a different compiler,
+use different compile flags, etc. In particular, IDEs should NOT create
+multiple single-config build trees which all have the same properties except
+for a differing CMAKE_BUILD_TYPE, effectively creating a
+multi-config environment. Instead, the NinjaMulti-Config
+generator, in conjunction with the FileAPI to
+get the list of build configurations, should be used for this purpose.
+
IDEs should not use the "extra generators" with Makefile or Ninja generators,
+which generate IDE project files in addition to the Makefile or Ninja files.
+Instead the FileAPI should be used to get the
+list of build artifacts.
If a Makefile or Ninja generator is used to generate the build tree, it is not
+recommended to invoke make or ninja directly. Instead, it is
+recommended that the IDE invoke cmake(1) with the
+--build argument, which will in turn invoke the
+appropriate build tool.
+
If an IDE project generator is used, such as Xcode or one of the
+Visual Studio generators, and the IDE understands the project format used, the
+IDE should read the project file and build it the same way it would otherwise.
+
The FileAPI can be used to obtain a list of
+build configurations from the build tree, and the IDE should present this list
+to the user to select a build configuration.
ctest(1) supports outputting a JSON format with information about the
+available tests and test configurations. IDEs which want to run CTest should
+obtain this information and use it to present the user with a list of tests.
+
IDEs should not invoke the test target of the generated buildsystem.
+Instead, they should invoke ctest(1) directly.
In this guide, we will present the concept of IMPORTED targets
+and demonstrate how to import existing executable or library files from disk
+into a CMake project. We will then show how CMake supports exporting targets
+from one CMake-based project and importing them into another. Finally, we
+will demonstrate how to package a project with a configuration file to allow
+for easy integration into other CMake projects. This guide and the complete
+example source code can be found in the Help/guide/importing-exporting
+directory of the CMake source code tree.
IMPORTED targets are used to convert files outside of a CMake
+project into logical targets inside of the project. IMPORTED
+targets are created using the IMPORTED option of the
+add_executable() and add_library() commands. No build
+files are generated for IMPORTED targets. Once imported,
+IMPORTED targets may be referenced like any other target within
+the project and provide a convenient, flexible reference to outside
+executables and libraries.
+
By default, the IMPORTED target name has scope in the directory in
+which it is created and below. We can use the GLOBAL option to extended
+visibility so that the target is accessible globally in the build system.
+
Details about the IMPORTED target are specified by setting
+properties whose names begin in IMPORTED_ and INTERFACE_. For example,
+IMPORTED_LOCATION contains the full path to the target on
+disk.
To start, we will walk through a simple example that creates an
+IMPORTED executable target and then references it from the
+add_custom_command() command.
+
We'll need to do some setup to get started. We want to create an executable
+that when run creates a basic main.cc file in the current directory. The
+details of this project are not important. Navigate to
+Help/guide/importing-exporting/MyExe, create a build directory, run
+cmake and build and install the project.
Now we can import this executable into another CMake project. The source code
+for this section is available in Help/guide/importing-exporting/Importing.
+In the CMakeLists file, use the add_executable() command to create a
+new target called myexe. Use the IMPORTED option to tell CMake that
+this target references an executable file located outside of the project. No
+rules will be generated to build it and the IMPORTED target
+property will be set to true.
+
add_executable(myexeIMPORTED)
+
+
+
Next, set the IMPORTED_LOCATION property of the target using
+the set_property() command. This will tell CMake the location of the
+target on disk. The location may need to be adjusted to the
+<installlocation> specified in the previous step.
We can now reference this IMPORTED target just like any target
+built within the project. In this instance, let's imagine that we want to use
+the generated source file in our project. Use the IMPORTED
+target in the add_custom_command() command:
+
add_custom_command(OUTPUTmain.ccCOMMANDmyexe)
+
+
+
As COMMAND specifies an executable target name, it will automatically be
+replaced by the location of the executable given by the
+IMPORTED_LOCATION property above.
While IMPORTED targets on their own are useful, they still
+require that the project that imports them knows the locations of the target
+files on disk. The real power of IMPORTED targets is when the
+project providing the target files also provides a CMake file to help import
+them. A project can be setup to produce the necessary information so that it
+can easily be used by other CMake projects be it from a build directory, a
+local install or when packaged.
+
In the remaining sections, we will walk through a set of example projects
+step-by-step. The first project will create and install a library and
+corresponding CMake configuration and package files. The second project will
+use the generated package.
+
Let's start by looking at the MathFunctions project in the
+Help/guide/importing-exporting/MathFunctions directory. Here we have a
+header file MathFunctions.h that declares a sqrt function:
+
#pragma once
+
+namespaceMathFunctions{
+doublesqrt(doublex);
+}
+
+
+
And a corresponding source file MathFunctions.cxx:
Don't worry too much about the specifics of the C++ files, they are just meant
+to be a simple example that will compile and run on many build systems.
+
Now we can create a CMakeLists.txt file for the MathFunctions
+project. Start by specifying the cmake_minimum_required() version and
+project() name:
+
cmake_minimum_required(VERSION3.15)
+project(MathFunctions)
+
+# make cache variables for install destinations
+include(GNUInstallDirs)
+
+# specify the C++ standard
+set(CMAKE_CXX_STANDARD11)
+set(CMAKE_CXX_STANDARD_REQUIREDTrue)
+
+
+
The GNUInstallDirs module is included in order to provide the
+project with the flexibility to install into different platform layouts by
+making the directories available as cache variables.
+
Create a library called MathFunctions with the add_library()
+command:
We need to tell CMake that we want to use different include directories
+depending on if we're building the library or using it from an installed
+location. If we don't do this, when CMake creates the export information it
+will export a path that is specific to the current build directory
+and will not be valid for other projects. We can use
+generatorexpressions to specify
+that if we're building the library include the current source directory.
+Otherwise, when installed, include the include directory. See the Creating
+Relocatable Packages section for more details.
+
The install(TARGETS) and install(EXPORT) commands
+work together to install both targets (a library in our case) and a CMake
+file designed to make it easy to import the targets into another CMake project.
+
First, in the install(TARGETS) command we will specify the target,
+the EXPORT name and the destinations that tell CMake where to install the
+targets.
Note, we have not asked CMake to install the export yet.
+
We don't want to forget to install the MathFunctions.h header file with the
+install(FILES) command. The header file should be installed to the
+include directory, as specified by the
+target_include_directories() command above.
Now that the MathFunctions library and header file are installed, we also
+need to explicitly install the MathFunctionsTargets export details. Use
+the install(EXPORT) command to export the targets in
+MathFunctionsTargets, as defined by the install(TARGETS)
+command.
This command generates the MathFunctionsTargets.cmake file and arranges
+to install it to ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions. The file
+contains code suitable for use by downstreams to import all targets listed in
+the install command from the installation tree.
+
The NAMESPACE option will prepend MathFunctions:: to the target names
+as they are written to the export file. This convention of double-colons
+gives CMake a hint that the name is an IMPORTED target when it
+is used by downstream projects. This way, CMake can issue a diagnostic
+message if the package providing it was not found.
+
The generated export file contains code that creates an IMPORTED library.
This code is very similar to the example we created by hand in the
+Importing Libraries section. Note that ${_IMPORT_PREFIX} is computed
+relative to the file location.
+
An outside project may load this file with the include() command and
+reference the MathFunctions library from the installation tree as if it
+were built in its own tree. For example:
Line 2 loads the target CMake file. Although we only exported a single
+target, this file may import any number of targets. Their locations are
+computed relative to the file location so that the install tree may be
+easily moved. Line 4 references the imported MathFunctions library. The
+resulting build system will link to the library from its installed location.
+
Executables may also be exported and imported using the same process.
+
Any number of target installations may be associated with the same
+export name. Export names are considered global so any directory may
+contribute a target installation. The install(EXPORT) command only
+needs to be called once to install a file that references all targets. Below
+is an example of how multiple exports may be combined into a single
+export file, even if they are in different subdirectories of the project.
At this point, the MathFunctions project is exporting the target
+information required to be used by other projects. We can make this project
+even easier for other projects to use by generating a configuration file so
+that the CMake find_package() command can find our project.
+
To start, we will need to make a few additions to the CMakeLists.txt
+file. First, include the CMakePackageConfigHelpers module to get
+access to some helper functions for creating config files.
+
include(CMakePackageConfigHelpers)
+
+
+
Then we will create a package configuration file and a package version file.
Use the configure_package_config_file() command provided by the
+CMakePackageConfigHelpers to generate the package configuration
+file. Note that this command should be used instead of the plain
+configure_file() command. It helps to ensure that the resulting
+package is relocatable by avoiding hardcoded paths in the installed
+configuration file. The path given to INSTALL_DESTINATION must be the
+destination where the MathFunctionsConfig.cmake file will be installed.
+We will examine the contents of the package configuration file in the next
+section.
Install the generated configuration files with the INSTALL(files)
+command. Both MathFunctionsConfigVersion.cmake and
+MathFunctionsConfig.cmake are installed to the same location, completing
+the package.
Now we need to create the package configuration file itself. In this case, the
+Config.cmake.in file is very simple but sufficient to allow downstreams
+to use the IMPORTED targets.
The first line of the file contains only the string @PACKAGE_INIT@. This
+expands when the file is configured and allows the use of relocatable paths
+prefixed with PACKAGE_. It also provides the set_and_check() and
+check_required_components() macros.
+
The check_required_components helper macro ensures that all requested,
+non-optional components have been found by checking the
+<Package>_<Component>_FOUND variables for all required components. This
+macro should be called at the end of the package configuration file even if the
+package does not have any components. This way, CMake can make sure that the
+downstream project hasn't specified any non-existent components. If
+check_required_components fails, the <Package>_FOUND variable is set to
+FALSE, and the package is considered to be not found.
+
The set_and_check() macro should be used in configuration files instead
+of the normal set() command for setting directories and file locations.
+If a referenced file or directory does not exist, the macro will fail.
+
If any macros should be provided by the MathFunctions package, they should
+be in a separate file which is installed to the same location as the
+MathFunctionsConfig.cmake file, and included from there.
+
All required dependencies of a package must also be found in the package
+configuration file. Let's imagine that we require the Stats library in
+our project. In the CMakeLists file, we would add:
As the Stats::Types target is a PUBLIC dependency of MathFunctions,
+downstreams must also find the Stats package and link to the
+Stats::Types library. The Stats package should be found in the
+configuration file to ensure this.
The find_dependency macro from the CMakeFindDependencyMacro
+module helps by propagating whether the package is REQUIRED, or
+QUIET, etc. The find_dependency macro also sets
+MathFunctions_FOUND to False if the dependency is not found, along
+with a diagnostic that the MathFunctions package cannot be used without
+the Stats package.
+
Exercise: Add a required library to the MathFunctions project.
The CMakePackageConfigHelpers module provides the
+write_basic_package_version_file() command for creating a simple
+package version file. This file is read by CMake when find_package()
+is called to determine the compatibility with the requested version, and to set
+some version-specific variables such as <PackageName>_VERSION,
+<PackageName>_VERSION_MAJOR, <PackageName>_VERSION_MINOR, etc. See
+cmake-packages documentation for more details.
+
set(version3.4.1)
+
+set_property(TARGETMathFunctionsPROPERTYVERSION${version})
+set_property(TARGETMathFunctionsPROPERTYSOVERSION3)
+set_property(TARGETMathFunctionsPROPERTY
+INTERFACE_MathFunctions_MAJOR_VERSION3)
+set_property(TARGETMathFunctionsAPPENDPROPERTY
+COMPATIBLE_INTERFACE_STRINGMathFunctions_MAJOR_VERSION
+)
+
+# generate the version file for the config file
+write_basic_package_version_file(
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
+VERSION"${version}"
+COMPATIBILITYAnyNewerVersion
+)
+
+
+
In our example, MathFunctions_MAJOR_VERSION is defined as a
+COMPATIBLE_INTERFACE_STRING which means that it must be
+compatible among the dependencies of any depender. By setting this
+custom defined user property in this version and in the next version of
+MathFunctions, cmake will issue a diagnostic if
+there is an attempt to use version 3 together with version 4. Packages can
+choose to employ such a pattern if different major versions of the package
+are designed to be incompatible.
Typically, projects are built and installed before being used by an outside
+project. However, in some cases, it is desirable to export targets directly
+from a build tree. The targets may then be used by an outside project that
+references the build tree with no installation involved. The export()
+command is used to generate a file exporting targets from a project build tree.
+
If we want our example project to also be used from a build directory we only
+have to add the following to CMakeLists.txt:
Here we use the export() command to generate the export targets for
+the build tree. In this case, we'll create a file called
+MathFunctionsTargets.cmake in the cmake subdirectory of the build
+directory. The generated file contains the required code to import the target
+and may be loaded by an outside project that is aware of the project build
+tree. This file is specific to the build-tree, and is not relocatable.
+
It is possible to create a suitable package configuration file and package
+version file to define a package for the build tree which may be used without
+installation. Consumers of the build tree can simply ensure that the
+CMAKE_PREFIX_PATH contains the build directory, or set the
+MathFunctions_DIR to <build_dir>/MathFunctions in the cache.
+
An example application of this feature is for building an executable on a host
+platform when cross-compiling. The project containing the executable may be
+built on the host platform and then the project that is being cross-compiled
+for another platform may load it.
At this point, we have generated a relocatable CMake configuration for our
+project that can be used after the project has been installed. Let's try to
+build the MathFunctions project:
Packages created by install(EXPORT) are designed to be relocatable,
+using paths relative to the location of the package itself. They must not
+reference absolute paths of files on the machine where the package is built
+that will not exist on the machines where the package may be installed.
+
When defining the interface of a target for EXPORT, keep in mind that the
+include directories should be specified as relative paths to the
+CMAKE_INSTALL_PREFIX but should not explicitly include the
+CMAKE_INSTALL_PREFIX:
The $<INSTALL_PREFIX> generator expression may be used as
+a placeholder for the install prefix without resulting in a non-relocatable
+package. This is necessary if complex generator expressions are used:
This also applies to paths referencing external dependencies.
+It is not advisable to populate any properties which may contain
+paths, such as INTERFACE_INCLUDE_DIRECTORIES or
+INTERFACE_LINK_LIBRARIES, with paths relevant to dependencies.
+For example, this code may not work well for a relocatable package:
The referenced variables may contain the absolute paths to libraries
+and include directories as found on the machine the package was made on.
+This would create a package with hard-coded paths to dependencies not
+suitable for relocation.
With this approach the package references its external dependencies
+only through the names of IMPORTED targets.
+When a consumer uses the installed package, the consumer will run the
+appropriate find_package() commands (via the find_dependency
+macro described above) to find the dependencies and populate the
+imported targets with appropriate paths on their own machine.
Now we're ready to create a project to use the installed MathFunctions
+library. In this section we will be using source code from
+Help\guide\importing-exporting\Downstream. In this directory, there is a
+source file called main.cc that uses the MathFunctions library to
+calculate the square root of a given number and then prints the results:
+
// A simple program that outputs the square root of a number
+#include<iostream>
+#include<string>
+
+#include"MathFunctions.h"
+
+intmain(intargc,char*argv[])
+{
+if(argc<2){
+std::cout<<"Usage: "<<argv[0]<<" number"<<std::endl;
+return1;
+}
+
+// convert input to double
+constdoubleinputValue=std::stod(argv[1]);
+
+// calculate square root
+constdoublesqrt=MathFunctions::sqrt(inputValue);
+std::cout<<"The square root of "<<inputValue<<" is "<<sqrt
+<<std::endl;
+
+return0;
+}
+
+
+
As before, we'll start with the cmake_minimum_required() and
+project() commands in the CMakeLists.txt file. For this project,
+we'll also specify the C++ standard.
+
cmake_minimum_required(VERSION3.15)
+project(Downstream)
+
+# specify the C++ standard
+set(CMAKE_CXX_STANDARD11)
+set(CMAKE_CXX_STANDARD_REQUIREDTrue)
+
A warning may have appeared during CMake configuration:
+
CMake Warning at CMakeLists.txt:4 (find_package):
+ By not providing "FindMathFunctions.cmake" in CMAKE_MODULE_PATH this
+ project has asked CMake to find a package configuration file provided by
+ "MathFunctions", but CMake did not find one.
+
+ Could not find a package configuration file provided by "MathFunctions"
+ with any of the following names:
+
+ MathFunctionsConfig.cmake
+ mathfunctions-config.cmake
+
+ Add the installation prefix of "MathFunctions" to CMAKE_PREFIX_PATH or set
+ "MathFunctions_DIR" to a directory containing one of the above files. If
+ "MathFunctions" provides a separate development package or SDK, be sure it
+ has been installed.
+
+
+
Set the CMAKE_PREFIX_PATH to where MathFunctions was installed previously
+and try again. Ensure that the newly created executable runs as expected.
Let's edit the MathFunctions project to use components. The source code for
+this section can be found in
+Help\guide\importing-exporting\MathFunctionsComponents. The CMakeLists file
+for this project adds two subdirectories: Addition and SquareRoot.
+
cmake_minimum_required(VERSION3.15)
+project(MathFunctionsComponents)
+
+# make cache variables for install destinations
+include(GNUInstallDirs)
+
+# specify the C++ standard
+set(CMAKE_CXX_STANDARD11)
+set(CMAKE_CXX_STANDARD_REQUIREDTrue)
+
+add_subdirectory(Addition)
+add_subdirectory(SquareRoot)
+
+
+
Generate and install the package configuration and package version files:
+
include(CMakePackageConfigHelpers)
+
+# set version
+set(version3.4.1)
+
+# generate the version file for the config file
+write_basic_package_version_file(
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
+VERSION"${version}"
+COMPATIBILITYAnyNewerVersion
+)
+
+# create config file
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
+INSTALL_DESTINATION${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions
+NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+# install config files
+install(FILES
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
+DESTINATION${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions
+)
+
+
+
If COMPONENTS are specified when the downstream uses
+find_package(), they are listed in the
+<PackageName>_FIND_COMPONENTS variable. We can use this variable to verify
+that all necessary component targets are included in Config.cmake.in. At
+the same time, this function will act as a custom check_required_components
+macro to ensure that the downstream only attempts to use supported components.
Here, the MathFunctions_NOT_FOUND_MESSAGE is set to a diagnosis that the
+package could not be found because an invalid component was specified. This
+message variable can be set for any case where the _FOUND variable is set
+to False, and will be displayed to the user.
+
The Addition and SquareRoot directories are similar. Let's look at one
+of the CMakeLists files:
Now we can build the project as described in earlier sections. To test using
+this package, we can use the project in
+Help\guide\importing-exporting\DownstreamComponents. There's two
+differences from the previous Downstream project. First, we need to find
+the package components. Change the find_package line from:
Where do I start with CMake? This step will provide an introduction to some of
+CMake's basic syntax, commands, and variables. As these concepts are
+introduced, we will work through three exercises and create a simple CMake
+project.
+
Each exercise in this step will start with some background information. Then, a
+goal and list of helpful resources are provided. Each file in the
+FilestoEdit section is in the Step1 directory and contains one or
+more TODO comments. Each TODO represents a line or two of code to
+change or add. The TODO s are intended to be completed in numerical order,
+first complete TODO1 then TODO2, etc. The GettingStarted
+section will give some helpful hints and guide you through the exercise. Then
+the BuildandRun section will walk step-by-step through how to build and
+test the exercise. Finally, at the end of each exercise the intended solution
+is discussed.
+
Also note that each step in the tutorial builds on the next. So, for example,
+the starting code for Step2 is the complete solution to Step1.
The most basic CMake project is an executable built from a single source code
+file. For simple projects like this, a CMakeLists.txt file with three
+commands is all that is required.
+
Note: Although upper, lower and mixed case commands are supported by CMake,
+lower case commands are preferred and will be used throughout the tutorial.
+
Any project's top most CMakeLists.txt must start by specifying a minimum CMake
+version using the cmake_minimum_required() command. This establishes
+policy settings and ensures that the following CMake functions are run with a
+compatible version of CMake.
+
To start a project, we use the project() command to set the project
+name. This call is required with every project and should be called soon after
+cmake_minimum_required(). As we will see later, this command can
+also be used to specify other project level information such as the language
+or version number.
+
Finally, the add_executable() command tells CMake to create an
+executable using the specified source code files.
The source code for tutorial.cxx is provided in the
+Help/guide/tutorial/Step1 directory and can be used to compute the square
+root of a number. This file does not need to be edited in this step.
+
In the same directory is a CMakeLists.txt file which you will complete.
+Start with TODO1 and work through TODO3.
Once TODO1 through TODO3 have been completed, we are ready to build
+and run our project! First, run the cmake executable or the
+cmake-gui to configure the project and then build it
+with your chosen build tool.
+
For example, from the command line we could navigate to the
+Help/guide/tutorial directory of the CMake source code tree and create a
+build directory:
+
mkdir Step1_build
+
+
+
Next, navigate to that build directory and run
+cmake to configure the project and generate a native build
+system:
+
cd Step1_build
+cmake ../Step1
+
+
+
Then call that build system to actually compile/link the project:
+
cmake --build .
+
+
+
Finally, try to use the newly built Tutorial with these commands:
As mentioned above, a three line CMakeLists.txt is all that we need to get
+up and running. The first line is to use cmake_minimum_required() to
+set the CMake version as follows:
CMake has some special variables that are either created behind the scenes or
+have meaning to CMake when set by project code. Many of these variables start
+with CMAKE_. Avoid this naming convention when creating variables for your
+projects. Two of these special user settable variables are
+CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED.
+These may be used together to specify the C++ standard needed to build the
+project.
To complete TODO5, simply remove #include<cstdlib>.
+
We will need to explicitly state in the CMake code that it should use the
+correct flags. One way to enable support for a specific C++ standard in CMake
+is by using the CMAKE_CXX_STANDARD variable. For this tutorial, set
+the CMAKE_CXX_STANDARD variable in the CMakeLists.txt file to
+11 and CMAKE_CXX_STANDARD_REQUIRED to True. Make sure to
+add the CMAKE_CXX_STANDARD declarations above the call to
+add_executable().
Exercise 3 - Adding a Version Number and Configured Header File¶
+
Sometimes it may be useful to have a variable that is defined in your
+CMakelists.txt file also be available in your source code. In this case, we
+would like to print the project version.
+
One way to accomplish this is by using a configured header file. We create an
+input file with one or more variables to replace. These variables have special
+syntax which looks like @VAR@.
+Then, we use the configure_file() command to copy the input file to a
+given output file and replace these variables with the current value of VAR
+in the CMakelists.txt file.
+
While we could edit the version directly in the source code, using this
+feature is preferred since it creates a single source of truth and avoids
+duplication.
Continue to edit files from Step1. Start on TODO7 and complete through
+TODO12. In this exercise, we start by adding a project version number in
+CMakeLists.txt. In that same file, use configure_file() to copy a
+given input file to an output file and substitute some variable values in the
+input file content.
+
Next, create an input header file TutorialConfig.h.in defining version
+numbers which will accept variables passed from configure_file().
+
Finally, update tutorial.cxx to print out its version number.
In this exercise, we improve our executable by printing a version number.
+While we could do this exclusively in the source code, using CMakeLists.txt
+lets us maintain a single source of data for the version number.
+
First, we modify the CMakeLists.txt file to use the
+project() command to set both the project name and version number.
+When the project() command is called, CMake defines
+Tutorial_VERSION_MAJOR and Tutorial_VERSION_MINOR behind the scenes.
Since the configured file will be written into the project binary
+directory, we must add that directory to the list of paths to search for
+include files.
+
Note: Throughout this tutorial, we will refer to the project build and
+the project binary directory interchangeably. These are the same and are not
+meant to refer to a bin/ directory.
TutorialConfig.h.in is the input header file to be configured.
+When configure_file() is called from our CMakeLists.txt, the
+values for @Tutorial_VERSION_MAJOR@ and @Tutorial_VERSION_MINOR@ will
+be replaced with the corresponding version numbers from the project in
+TutorialConfig.h.
// the configured options and settings for Tutorial
+#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
+#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
+
+
+
+
Next, we need to modify tutorial.cxx to include the configured header file,
+TutorialConfig.h.
During InstallingandTesting of the tutorial we added the
+ability for CMake to install the library and headers of the project. During
+PackaginganInstaller we added the ability to package up
+this information so it could be distributed to other people.
+
The next step is to add the necessary information so that other CMake projects
+can use our project, be it from a build directory, a local install or when
+packaged.
+
The first step is to update our install(TARGETS) commands to not
+only specify a DESTINATION but also an EXPORT. The EXPORT keyword
+generates a CMake file containing code to import all targets listed in the
+install command from the installation tree. So let's go ahead and explicitly
+EXPORT the MathFunctions library by updating the install command
+in MathFunctions/CMakeLists.txt to look like:
Now that we have MathFunctions being exported, we also need to explicitly
+install the generated MathFunctionsTargets.cmake file. This is done by
+adding the following to the bottom of the top-level CMakeLists.txt:
At this point you should try and run CMake. If everything is setup properly
+you will see that CMake will generate an error that looks like:
+
Target "MathFunctions" INTERFACE_INCLUDE_DIRECTORIES property contains
+path:
+
+ "/Users/robert/Documents/CMakeClass/Tutorial/Step11/MathFunctions"
+
+which is prefixed in the source directory.
+
+
+
What CMake is trying to say is that during generating the export information
+it will export a path that is intrinsically tied to the current machine and
+will not be valid on other machines. The solution to this is to update the
+MathFunctionstarget_include_directories() to understand that it
+needs different INTERFACE locations when being used from within the build
+directory and from an install / package. This means converting the
+target_include_directories() call for MathFunctions to look like:
Once this has been updated, we can re-run CMake and verify that it doesn't
+warn anymore.
+
At this point, we have CMake properly packaging the target information that is
+required but we will still need to generate a MathFunctionsConfig.cmake so
+that the CMake find_package() command can find our project. So let's go
+ahead and add a new file to the top-level of the project called
+Config.cmake.in with the following contents:
Next, we execute the configure_package_config_file(). This command
+will configure a provided file but with a few specific differences from the
+standard configure_file() way.
+To properly utilize this function, the input file should have a single line
+with the text @PACKAGE_INIT@ in addition to the content that is desired.
+That variable will be replaced with a block of code which turns set values into
+relative paths. These values which are new can be referenced by the same name
+but prepended with a PACKAGE_ prefix.
install(EXPORTMathFunctionsTargets
+FILEMathFunctionsTargets.cmake
+DESTINATIONlib/cmake/MathFunctions
+)
+
+include(CMakePackageConfigHelpers)
+# generate the config file that includes the exports
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
+INSTALL_DESTINATION"lib/cmake/example"
+NO_SET_AND_CHECK_MACRO
+NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+
+
+
The write_basic_package_version_file() is next. This command writes
+a file which is used by find_package(), documenting the version and
+compatibility of the desired package. Here, we use the Tutorial_VERSION_*
+variables and say that it is compatible with AnyNewerVersion, which
+denotes that this version or any higher one are compatible with the requested
+version.
At this point, we have generated a relocatable CMake Configuration for our
+project that can be used after the project has been installed or packaged. If
+we want our project to also be used from a build directory we only have to add
+the following to the bottom of the top level CMakeLists.txt:
With this export call we now generate a MathFunctionsTargets.cmake, allowing the
+configured MathFunctionsConfig.cmake in the build directory to be used by
+other projects, without needing it to be installed.
Generatorexpressions may be used
+to enable conditional linking, conditional definitions used when compiling,
+conditional include directories and more. The conditions may be based on the
+build configuration, target properties, platform information or any other
+queryable information.
+
There are different types of
+generatorexpressions including
+Logical, Informational, and Output expressions.
+
Logical expressions are used to create conditional output. The basic
+expressions are the 0 and 1 expressions. A $<0:...> results in the
+empty string, and <1:...> results in the content of .... They can also
+be nested.
+
+
Exercise 1 - Adding Compiler Warning Flags with Generator Expressions¶
+
A common usage of
+generatorexpressions is to
+conditionally add compiler flags, such as those for language levels or
+warnings. A nice pattern is to associate this information to an INTERFACE
+target allowing this information to propagate.
Open the file Step4/CMakeLists.txt and complete TODO1 through
+TODO4.
+
First, in the top level CMakeLists.txt file, we need to set the
+cmake_minimum_required() to 3.15. In this exercise we are going
+to use a generator expression which was introduced in CMake 3.15.
+
Next we add the desired compiler warning flags that we want for our project.
+As warning flags vary based on the compiler, we use the
+COMPILE_LANG_AND_ID generator expression to control which flags to apply
+given a language and a set of compiler ids.
Make a new directory called Step4_build, run the cmake
+executable or the cmake-gui to configure the project
+and then build it with your chosen build tool or by using cmake--build.
+from the build directory.
Next we determine which compiler our system is currently using to build
+since warning flags vary based on the compiler we use. This is done with
+the COMPILE_LANG_AND_ID generator expression. We set the result in the
+variables gcc_like_cxx and msvc_cxx as follows:
Next we add the desired compiler warning flags that we want for our project.
+Using our variables gcc_like_cxx and msvc_cxx, we can use another
+generator expression to apply the respective flags only when the variables are
+true. We use target_compile_options() to apply these flags to our
+interface library.
Lastly, we only want these warning flags to be used during builds. Consumers
+of our installed project should not inherit our warning flags. To specify
+this, we wrap our flags in a generator expression using the BUILD_INTERFACE
+condition. The resulting full code looks like the following:
+
+
+
+
\ No newline at end of file
diff --git a/toolchain/cmake-3.27.9-linux-x86_64/doc/cmake/html/guide/tutorial/Adding Support for a Testing Dashboard.html b/toolchain/cmake-3.27.9-linux-x86_64/doc/cmake/html/guide/tutorial/Adding Support for a Testing Dashboard.html
new file mode 100644
index 0000000000000000000000000000000000000000..d82d372872257e36e8e3300d5d7ad2b2cb7d73bf
--- /dev/null
+++ b/toolchain/cmake-3.27.9-linux-x86_64/doc/cmake/html/guide/tutorial/Adding Support for a Testing Dashboard.html
@@ -0,0 +1,250 @@
+
+
+
+
+
+
+
+
+ Step 6: Adding Support for a Testing Dashboard — CMake 3.27.9 Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Adding support for submitting our test results to a dashboard is simple. We
+already defined a number of tests for our project in
+Testing Support. Now we just have to run
+those tests and submit them to CDash.
For this exercise, complete TODO1 in the top-level CMakeLists.txt by
+including the CTest module. This will enable testing with CTest as
+well as dashboard submissions to CDash, so we can safely remove the call to
+enable_testing().
+
We will also need to acquire a CTestConfig.cmake file to be placed in the
+top-level directory. When run, the ctest executable will
+read this file to gather information about the testing dashboard. It contains:
+
+
The project name
+
The project "Nightly" start time
+
+
The time when a 24 hour "day" starts for this project.
+
+
+
The URL of the CDash instance where the submission's generated documents
+will be sent
+
+
For this tutorial, a public dashboard server is used and its corresponding
+CTestConfig.cmake file is provided for you in this step's root directory.
+In practice, this file would be downloaded from a project's Settings page
+on the CDash instance intended to host the test results. Once downloaded from
+CDash, the file should not be modified locally.
Note that as part of the CDash submission some information about your
+development system (e.g. site name or full pathnames) may displayed publicly.
+
To create a simple test dashboard, run the cmake
+executable or the cmake-gui to configure the project
+but do not build it yet. Instead, navigate to the build directory and run:
+
ctest [-VV] -D Experimental
+
+
+
Remember, for multi-config generators (e.g. Visual Studio), the configuration
+type must be specified:
The only CMake code changed needed in this step was to enable dashboard
+submissions to CDash by including the CTest module in our top-level
+CMakeLists.txt:
Let us consider adding some code to our project that depends on features the
+target platform may not have. For this example, we will add some code that
+depends on whether or not the target platform has the log and exp
+functions. Of course almost every platform has these functions but for this
+tutorial assume that they are not common.
The starting source code is provided in the Step7 directory. In this
+exercise, complete TODO1 through TODO5.
+
Start by editing MathFunctions/CMakeLists.txt. Include the
+CheckCXXSourceCompiles module. Then, use
+check_cxx_source_compiles to determine whether log and exp are
+available from cmath. If they are available, use
+target_compile_definitions() to specify HAVE_LOG and HAVE_EXP
+as compile definitions.
+
In the MathFunctions/mysqrt.cxx, include cmath. Then, if the system has
+log and exp, use them to compute the square root.
Make a new directory called Step7_build. Run the
+cmake executable or the
+cmake-gui to configure the project and then build it
+with your chosen build tool and run the Tutorial executable.
Then test for the availability of
+log and exp using check_cxx_compiles_source. This function
+lets us try compiling simple code with the required dependency prior to
+the true source code compilation. The resulting variables HAVE_LOG
+and HAVE_EXP represent whether those dependencies are available.
Next, we need to pass these CMake variables to our source code. This way,
+our source code can tell what resources are available. If both log and
+exp are available, use target_compile_definitions() to specify
+HAVE_LOG and HAVE_EXP as PRIVATE compile definitions.
If log and exp are available on the system, then use them to
+compute the square root in the mysqrt function. The mysqrt function in
+MathFunctions/mysqrt.cxx will look as follows:
#if defined(HAVE_LOG) && defined(HAVE_EXP)
+doubleresult=std::exp(std::log(x)*0.5);
+std::cout<<"Computing sqrt of "<<x<<" to be "<<result
+<<" using log and exp"<<std::endl;
+#else
+doubleresult=x;
+
+// do ten iterations
+for(inti=0;i<10;++i){
+if(result<=0){
+result=0.1;
+}
+doubledelta=x-(result*result);
+result=result+0.5*delta/result;
+std::cout<<"Computing sqrt of "<<x<<" to be "<<result<<std::endl;
+}
+#endif
+
Exercise 1 - Adding Usage Requirements for a Library¶
+
Usage requirements of a target parameters
+allow for far better control over a library or executable's link and include
+line while also giving more control over the transitive property of targets
+inside CMake. The primary commands that
+leverage usage requirements are:
In this exercise, we will refactor our code from
+AddingaLibrary to use the modern CMake approach. We will
+let our library define its own usage requirements so they are passed
+transitively to other targets as necessary. In this case, MathFunctions
+will specify any needed include directories itself. Then, the consuming target
+Tutorial simply needs to link to MathFunctions and not worry about
+any additional include directories.
+
The starting source code is provided in the Step3 directory. In this
+exercise, complete TODO1 through TODO3.
Make a new directory called Step3_build, run the cmake executable or the cmake-gui to
+configure the project and then build it with your chosen build tool or by
+using cmake--build. from the build directory.
+Here's a refresher of what that looks like from the command line:
Let's update the code from the previous step to use the modern CMake
+approach of usage requirements.
+
We want to state that anybody linking to MathFunctions needs to include
+the current source directory, while MathFunctions itself doesn't. This
+can be expressed with an INTERFACE usage requirement. Remember
+INTERFACE means things that consumers require but the producer doesn't.
+
At the end of MathFunctions/CMakeLists.txt, use
+target_include_directories() with the INTERFACE keyword, as
+follows:
Now that we've specified usage requirements for MathFunctions we can
+safely remove our uses of the EXTRA_INCLUDES variable from the top-level
+CMakeLists.txt.
# add the executable
+add_executable(Tutorialtutorial.cxx)
+
+target_link_libraries(TutorialPUBLICMathFunctionstutorial_compiler_flags)
+
+# add the binary tree to the search path for include files
+# so that we will find TutorialConfig.h
+target_include_directories(TutorialPUBLIC
+"${PROJECT_BINARY_DIR}"
+)
+
+
+
+
Notice that with this technique, the only thing our executable target does to
+use our library is call target_link_libraries() with the name
+of the library target. In larger projects, the classic method of specifying
+library dependencies manually becomes very complicated very quickly.
+
+
+
+
Exercise 2 - Setting the C++ Standard with Interface Libraries¶
+
Now that we have switched our code to a more modern approach, let's demonstrate
+a modern technique to set properties to multiple targets.
+
Let's refactor our existing code to use an INTERFACE library. We will
+use that library in the next step to demonstrate a common use for
+generatorexpressions.
In this exercise, we will refactor our code to use an INTERFACE library to
+specify the C++ standard.
+
Start this exercise from what we left at the end of Step3 exercise 1. You will
+have to complete TODO4 through TODO7.
+
Start by editing the top level CMakeLists.txt file. Construct an
+INTERFACE library target called tutorial_compiler_flags and
+specify cxx_std_11 as a target compiler feature.
+
Modify CMakeLists.txt and MathFunctions/CMakeLists.txt so that all
+targets have a target_link_libraries() call to
+tutorial_compiler_flags.
Next, we need to create an interface library, tutorial_compiler_flags. And
+then use target_compile_features() to add the compiler feature
+cxx_std_11.
Finally, with our interface library set up, we need to link our
+executable Target, our MathFunctions library, and our SqrtLibrary
+library to our new
+tutorial_compiler_flags library. Respectively, the code will look like
+this:
With this, all of our code still requires C++ 11 to build. Notice
+though that with this method, it gives us the ability to be specific about
+which targets get specific requirements. In addition, we create a single
+source of truth in our interface library.
Step 8: Adding a Custom Command and Generated File¶
+
Suppose, for the purpose of this tutorial, we decide that we never want to use
+the platform log and exp functions and instead would like to
+generate a table of precomputed values to use in the mysqrt function.
+In this section, we will create the table as part of the build process,
+and then compile that table into our application.
+
First, let's remove the check for the log and exp functions in
+MathFunctions/CMakeLists.txt. Then remove the check for HAVE_LOG and
+HAVE_EXP from mysqrt.cxx. At the same time, we can remove
+#include<cmath>.
+
In the MathFunctions subdirectory, a new source file named
+MakeTable.cxx has been provided to generate the table.
+
After reviewing the file, we can see that the table is produced as valid C++
+code and that the output filename is passed in as an argument.
+
The next step is to create MathFunctions/MakeTable.cmake. Then, add the
+appropriate commands to the file to build the MakeTable executable and
+then run it as part of the build process. A few commands are needed to
+accomplish this.
Next we have to let CMake know that mysqrt.cxx depends on the generated
+file Table.h. This is done by adding the generated Table.h to the list
+of sources for the library SqrtLibrary.
doublemysqrt(doublex)
+{
+if(x<=0){
+return0;
+}
+
+// use the table to help find an initial value
+doubleresult=x;
+if(x>=1&&x<10){
+std::cout<<"Use the table to help find an initial value "<<std::endl;
+result=sqrtTable[static_cast<int>(x)];
+}
+
+// do ten iterations
+for(inti=0;i<10;++i){
+if(result<=0){
+result=0.1;
+}
+doubledelta=x-(result*result);
+result=result+0.5*delta/result;
+std::cout<<"Computing sqrt of "<<x<<" to be "<<result<<std::endl;
+}
+
+returnresult;
+}
+}
+}
+
+
+
+
Run the cmake executable or the
+cmake-gui to configure the project and then build it
+with your chosen build tool.
+
When this project is built it will first build the MakeTable executable.
+It will then run MakeTable to produce Table.h. Finally, it will
+compile mysqrt.cxx which includes Table.h to produce the
+MathFunctions library.
+
Run the Tutorial executable and verify that it is using the table.
At this point, we have seen how to create a basic project using CMake. In this
+step, we will learn how to create and use a library in our project. We will
+also see how to make the use of our library optional.
To add a library in CMake, use the add_library() command and specify
+which source files should make up the library.
+
Rather than placing all of the source files in one directory, we can organize
+our project with one or more subdirectories. In this case, we will create a
+subdirectory specifically for our library. Here, we can add a new
+CMakeLists.txt file and one or more source files. In the top level
+CMakeLists.txt file, we will use the add_subdirectory() command
+to add the subdirectory to the build.
In this exercise, we will add a library to our project that contains our own
+implementation for computing the square root of a number. The executable can
+then use this library instead of the standard square root function provided by
+the compiler.
+
For this tutorial we will put the library into a subdirectory called
+MathFunctions. This directory already contains the header files
+MathFunctions.h and mysqrt.h. Their respective source files
+MathFunctions.cxx and mysqrt.cxx are also provided. We will not need
+to modify any of these files. mysqrt.cxx has one function called
+mysqrt that provides similar functionality to the compiler's sqrt
+function. MathFunctions.cxx contains one function sqrt which serves
+to hide the implementation details of sqrt.
+
From the Help/guide/tutorial/Step2 directory, start with TODO1 and
+complete through TODO6.
+
First, fill in the one line CMakeLists.txt in the MathFunctions
+subdirectory.
+
Next, edit the top level CMakeLists.txt.
+
Finally, use the newly created MathFunctions library in tutorial.cxx
In the CMakeLists.txt file in the MathFunctions directory, we create
+a library target called MathFunctions with add_library(). The
+source files for the library are passed as an argument to
+add_library(). This looks like the following line:
Finally we need to specify the library's header file location. Modify
+target_include_directories() to add the MathFunctions subdirectory
+as an include directory so that the MathFunctions.h header file can be
+found.
Now let us add an option in the MathFunctions library to allow developers to
+select either the custom square root implementation or the built in standard
+implementation. While for the tutorial
+there really isn't any need to do so, for larger projects this is a common
+occurrence.
+
CMake can do this using the option() command. This gives users a
+variable which they can change when configuring their cmake build. This
+setting will be stored in the cache so that the user does not need to set
+the value each time they run CMake on a build directory.
Start with the resulting files from Exercise 1. Complete TODO7 through
+TODO14.
+
First create a variable USE_MYMATH using the option() command
+in MathFunctions/CMakeLists.txt. In that same file, use that option
+to pass a compile definition to the MathFunctions library.
+
Then, update MathFunctions.cxx to redirect compilation based on
+USE_MYMATH.
+
Lastly, prevent mysqrt.cxx from being compiled when USE_MYMATH is on
+by making it its own library inside of the USE_MYMATH block of
+MathFunctions/CMakeLists.txt.
Since we have our build directory already configured from Exercise 1, we can
+rebuild by simply calling the following:
+
cd ../Step2_build
+cmake --build .
+
+
+
Next, run the Tutorial executable on a few numbers to verify that it's
+still correct.
+
Now let's update the value of USE_MYMATH to OFF. The easiest way is to
+use the cmake-gui or ccmake
+if you're in the terminal. Or, alternatively, if you want to change the
+option from the command-line, try:
+
cmake ../Step2 -DUSE_MYMATH=OFF
+
+
+
Now, rebuild the code with the following:
+
cmake --build .
+
+
+
Then, run the executable again to ensure that it still works with
+USE_MYMATH set to OFF. Which function gives better results, sqrt
+or mysqrt?
The first step is to add an option to MathFunctions/CMakeLists.txt.
+This option will be displayed in the cmake-gui and
+ccmake with a default value of ON that can be
+changed by the user.
option(USE_MYMATH"Use tutorial provided math implementation"ON)
+
+
+
+
Next, make building and linking our library with mysqrt function
+conditional using this new option.
+
Create an if() statement which checks the value of
+USE_MYMATH. Inside the if() block, put the
+target_compile_definitions() command with the compile
+definition USE_MYMATH.
When USE_MYMATH is ON, the compile definition USE_MYMATH will
+be set. We can then use this compile definition to enable or disable
+sections of our source code.
+
The corresponding changes to the source code are fairly straightforward.
+In MathFunctions.cxx, we make USE_MYMATH control which square root
+function is used:
At this point, if USE_MYMATH is OFF, mysqrt.cxx would not be used
+but it will still be compiled because the MathFunctions target has
+mysqrt.cxx listed under sources.
+
There are a few ways to fix this. The first option is to use
+target_sources() to add mysqrt.cxx from within the USE_MYMATH
+block. Another option is to create an additional library within the
+USE_MYMATH block which is responsible for compiling mysqrt.cxx. For
+the sake of this tutorial, we are going to create an additional library.
+
First, from within USE_MYMATH create a library called SqrtLibrary
+that has sources mysqrt.cxx.
With these changes, the mysqrt function is now completely optional to
+whoever is building and using the MathFunctions library. Users can toggle
+USE_MYMATH to manipulate what library is used in the build.
Often, it is not enough to only build an executable, it should also be
+installable. With CMake, we can specify install rules using the
+install() command. Supporting local installations for your builds in
+CMake is often as simple as specifying an install location and the targets and
+files to be installed.
The starting code is provided in the Step5 directory. In this
+exercise, complete TODO1 through TODO4.
+
First, update MathFunctions/CMakeLists.txt to install the
+MathFunctions and tutorial_compiler_flags libraries to the lib
+directory. In that same file, specify the install rules needed to install
+MathFunctions.h to the include directory.
+
Then, update the top level CMakeLists.txt to install
+the Tutorial executable to the bin directory. Lastly, any header files
+should be installed to the include directory. Remember that
+TutorialConfig.h is in the PROJECT_BINARY_DIR.
Make a new directory called Step5_build. Run the
+cmake executable or the
+cmake-gui to configure the project and then build it
+with your chosen build tool.
+
Then, run the install step by using the --install
+option of the cmake command (introduced in 3.15, older
+versions of CMake must use makeinstall) from the command line. This step
+will install the appropriate header files, libraries, and executables.
+For example:
+
cmake --install .
+
+
+
For multi-configuration tools, don't forget to use the
+--config argument to specify the configuration.
+
cmake --install . --config Release
+
+
+
If using an IDE, simply build the INSTALL target. You can build the same
+install target from the command line like the following:
+
cmake --build . --target install --config Debug
+
+
+
The CMake variable CMAKE_INSTALL_PREFIX is used to determine the
+root of where the files will be installed. If using the cmake--install
+command, the installation prefix can be overridden via the
+--prefix argument. For example:
CTest offers a way to easily manage tests for your project. Tests can be
+added through the add_test() command. Although it is not
+explicitly covered in this tutorial, there is a lot of compatibility
+between CTest and other testing frameworks such as GoogleTest.
The starting source code is provided in the Step5 directory. In this
+exercise, complete TODO5 through TODO9.
+
First, we need to enable testing. Next, begin adding tests to our project
+using add_test(). We will work through adding 3 simple tests and
+then you can add additional testing as you see fit.
Navigate to the build directory and rebuild the application. Then, run the
+ctest executable: ctest-N and ctest-VV. For
+multi-config generators (e.g. Visual Studio), the configuration type must be
+specified with the -C<mode> flag. For example, to run tests in Debug
+mode use ctest-CDebug-VV from the build directory
+(not the Debug subdirectory!). Release mode would be executed from the same
+location but with a -CRelease. Alternatively, build the RUN_TESTS
+target from the IDE.
With testing enabled, we will add a number of basic tests to verify
+that the application is working correctly. First, we create a test using
+add_test() which runs the Tutorial executable with the
+parameter 25 passed in. For this test, we are not going to check the
+executable's computed answer. This test will verify that
+application runs, does not segfault or otherwise crash, and has a zero
+return value. This is the basic form of a CTest test.
Next, let's use the PASS_REGULAR_EXPRESSION test property to
+verify that the output of the test contains certain strings. In this case,
+verifying that the usage message is printed when an incorrect number of
+arguments are provided.
add_test(NAMEStandardUseCOMMANDTutorial4)
+set_tests_properties(StandardUse
+PROPERTIESPASS_REGULAR_EXPRESSION"4 is 2"
+)
+
+
+
+
This one test is not enough to give us confidence that it will
+work for all values passed in. We should add more tests to verify this.
+To easily add more tests, we make a function called do_test that runs the
+application and verifies that the computed square root is correct for
+given input. For each invocation of do_test, another test is added to
+the project with a name, input, and expected results based on the passed
+arguments.
function(do_testtargetargresult)
+add_test(NAMEComp${arg}COMMAND${target}${arg})
+set_tests_properties(Comp${arg}
+PROPERTIESPASS_REGULAR_EXPRESSION${result}
+)
+endfunction()
+
+# do a bunch of result based tests
+do_test(Tutorial4"4 is 2")
+do_test(Tutorial9"9 is 3")
+do_test(Tutorial5"5 is 2.236")
+do_test(Tutorial7"7 is 2.645")
+do_test(Tutorial25"25 is 5")
+do_test(Tutorial-25"-25 is (-nan|nan|0)")
+do_test(Tutorial0.0001"0.0001 is 0.01")
+
Note: This example is valid for single-configuration generators and will
+not work for multi-configuration generators (e.g. Visual Studio).
+
By default, CMake's model is that a build directory only contains a single
+configuration, be it Debug, Release, MinSizeRel, or RelWithDebInfo. It is
+possible, however, to setup CPack to bundle multiple build directories and
+construct a package that contains multiple configurations of the same project.
+
First, we want to ensure that the debug and release builds use different names
+for the libraries that will be installed. Let's use d as the
+postfix for the debug libraries.
+
Set CMAKE_DEBUG_POSTFIX near the beginning of the top-level
+CMakeLists.txt file:
Now that both the debug and release builds are complete, we can use a custom
+configuration file to package both builds into a single release. In the
+Step12 directory, create a file called MultiCPackConfig.cmake. In this
+file, first include the default configuration file that was created by the
+cmake executable.
+
Next, use the CPACK_INSTALL_CMAKE_PROJECTS variable to specify which
+projects to install. In this case, we want to install both debug and release.
Next suppose that we want to distribute our project to other people so that
+they can use it. We want to provide both binary and source distributions on a
+variety of platforms. This is a little different from the install we did
+previously in InstallingandTesting, where we were
+installing the binaries that we had built from the source code. In this
+example we will be building installation packages that support binary
+installations and package management features. To accomplish this we will use
+CPack to create platform specific installers. Specifically we need to add a
+few lines to the bottom of our top-level CMakeLists.txt file.
That is all there is to it. We start by including
+InstallRequiredSystemLibraries. This module will include any runtime
+libraries that are needed by the project for the current platform. Next we set
+some CPack variables to where we have stored the license and version
+information for this project. The version information was set earlier in this
+tutorial and the License.txt has been included in the top-level source
+directory for this step. The CPACK_SOURCE_GENERATOR variable
+selects a file format for the source package.
+
Finally we include the CPackmodule which will use these
+variables and some other properties of the current system to setup an
+installer.
+
The next step is to build the project in the usual manner and then run the
+cpack executable. To build a binary distribution, from the
+binary directory run:
+
cpack
+
+
+
To specify the generator, use the -G option. For multi-config builds,
+use -C to specify the configuration. For example:
In this section we will show how the BUILD_SHARED_LIBS variable can
+be used to control the default behavior of add_library(),
+and allow control over how libraries without an explicit type (STATIC,
+SHARED, MODULE or OBJECT) are built.
+
To accomplish this we need to add BUILD_SHARED_LIBS to the
+top-level CMakeLists.txt. We use the option() command as it allows
+users to optionally select if the value should be ON or OFF.
#if defined(_WIN32)
+# if defined(EXPORTING_MYMATH)
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC __declspec(dllimport)
+# endif
+#else // non windows
+# define DECLSPEC
+#endif
+
+namespacemathfunctions{
+doubleDECLSPECsqrt(doublex);
+}
+
+
+
+
At this point, if you build everything, you may notice that linking fails
+as we are combining a static library without position independent code with a
+library that has position independent code. The solution to this is to
+explicitly set the POSITION_INDEPENDENT_CODE target property of
+SqrtLibrary to be True when building shared libraries.
target_link_libraries(MathFunctionsPUBLICtutorial_compiler_flags)
+
+# define the symbol stating we are using the declspec(dllexport) when
+# building on windows
+target_compile_definitions(MathFunctionsPRIVATE"EXPORTING_MYMATH")
+
+
+
+
Exercise: We modified MathFunctions.h to use dll export defines.
+Using CMake documentation can you find a helper module to simplify this?
The CMake tutorial provides a step-by-step guide that covers common build
+system issues that CMake helps address. Seeing how various topics all
+work together in an example project can be very helpful.
The tutorial documentation and source code examples can be found in
+the Help/guide/tutorial directory of the CMake source code tree.
+Each step has its own subdirectory containing code that may be used as a
+starting point. The tutorial examples are progressive so that each step
+provides the complete solution for the previous step.
Where a software package supplies a CMake-based buildsystem
+with the source of their software, the consumer of the
+software is required to run a CMake user interaction tool
+in order to build it.
+
Well-behaved CMake-based buildsystems do not create any
+output in the source directory, so typically, the user
+performs an out-of-source build and performs the build
+there. First, CMake must be instructed to generate a
+suitable buildsystem, then the user invokes a build tool
+to process that generated buildsystem. The generated
+buildsystem is specific to the machine used to generate
+it and is not redistributable. Each consumer of a provided
+source software package is required to use CMake to
+generate a buildsystem specific to their system.
+
Generated buildsystems should generally be treated as
+read-only. The CMake files as a primary artifact should
+completely specify the buildsystem and there should be no
+reason to populate properties manually in an IDE for
+example after generating the buildsystem. CMake will
+periodically rewrite the generated buildsystem, so
+modifications by users will be overwritten.
+
The features and user interfaces described in this manual
+are available for all CMake-based build systems by virtue
+of providing CMake files.
+
The CMake tooling may report errors to the user when
+processing provided CMake files, such as reporting that
+the compiler is not supported, or the compiler does not
+support a required compile option, or a dependency can
+not be found. These errors must be resolved by the user
+by choosing a different compiler,
+installingdependencies,
+or instructing CMake where to find them, etc.
It is recommended to build in a separate directory to the
+source because that keeps the source directory pristine,
+allows for building a single source with multiple
+toolchains, and allows easy clearing of build artifacts by
+simply deleting the build directory.
+
The CMake tooling may report warnings which are intended
+for the provider of the software, not intended for the
+consumer of the software. Such warnings end with "This
+warning is for project developers". Users may disable
+such warnings by passing the -Wno-dev
+flag to cmake(1).
There are several user interface tools which may be used
+to generate a buildsystem from CMake files. The
+ccmake(1) and cmake-gui(1) tools guide
+the user through setting the various necessary options.
+The cmake(1) tool can be invoked to specify
+options on the command line. This manual describes options
+which may be set using any of the user interface tools,
+though the mode of setting an option is different for each
+tool.
When invoking cmake(1) with a command line
+buildsystem such as Makefiles or Ninja, it is
+necessary to use the correct build environment to
+ensure that build tools are available. CMake must be
+able to find the appropriate
+buildtool,
+compiler, linker and other tools as needed.
+
On Linux systems, the appropriate tools are often
+provided in system-wide locations and may be readily
+installed through the system package manager. Other
+toolchains provided by the user or installed in
+non-default locations can also be used.
+
When cross-compiling, some platforms may require
+environment variables to be set or may provide
+scripts to set the environment.
+
Visual Studio ships multiple command prompts and
+vcvarsall.bat scripts for setting up the
+correct environments for command line buildsystems. While
+not strictly necessary to use a corresponding
+command line environment when using a Visual Studio
+generator, doing so has no disadvantages.
+
When using Xcode, there can be more than one Xcode
+version installed. Which one to use can be selected
+in a number of different ways, but the most common
+methods are:
+
+
Setting the default version in the preferences
+of the Xcode IDE.
+
Setting the default version via the xcode-select
+command line tool.
+
Overriding the default version by setting the
+DEVELOPER_DIR environment variable when running
+CMake and the build tool.
+
+
For convenience, cmake-gui(1) provides an
+environment variable editor.
CMake chooses a generator by default based on the
+platform. Usually, the default generator is sufficient
+to allow the user to proceed to build the software.
+
The user may override the default generator with
+the -G option:
+
$ cmake..-GNinja
+
+
+
The output of cmake--help includes a list of
+generators available
+for the user to choose from. Note that generator
+names are case sensitive.
+
On Unix-like systems (including Mac OS X), the
+UnixMakefiles generator is used by
+default. A variant of that generator can also be used
+on Windows in various environments, such as the
+NMakeMakefiles and
+MinGWMakefiles generator. These generators
+generate a Makefile variant which can be executed
+with make, gmake, nmake or similar tools.
+See the individual generator documentation for more
+information on targeted environments and tools.
+
The Ninja generator is available on all
+major platforms. ninja is a build tool similar
+in use-cases to make, but with a focus on
+performance and efficiency.
+
On Windows, cmake(1) can be used to generate
+solutions for the Visual Studio IDE. Visual Studio
+versions may be specified by the product name of the
+IDE, which includes a four-digit year. Aliases are
+provided for other means by which Visual Studio
+versions are sometimes referred to, such as two
+digits which correspond to the product version of the
+VisualC++ compiler, or a combination of the two:
+
$ cmake..-G"Visual Studio 2019"
+$ cmake..-G"Visual Studio 16"
+$ cmake..-G"Visual Studio 16 2019"
+
+
+
Visual Studio generators can target different architectures.
+One can specify the target architecture using the
+-A option:
+
cmake .. -G "Visual Studio 2019" -A x64
+cmake .. -G "Visual Studio 16" -A ARM
+cmake .. -G "Visual Studio 16 2019" -A ARM64
+
+
+
On Apple, the Xcode generator may be used to
+generate project files for the Xcode IDE.
+
Some IDEs such as KDevelop4, QtCreator and CLion have
+native support for CMake-based buildsystems. Those IDEs
+provide user interface for selecting an underlying
+generator to use, typically a choice between a Makefile
+or a Ninja based generator.
+
Note that it is not possible to change the generator
+with -G after the first invocation of CMake.
+To change the generator, the build directory must be
+deleted and the build must be started from scratch.
+
When generating Visual Studio project and solutions
+files several other options are available to use when
+initially running cmake(1).
+
The Visual Studio toolset can be specified with the
+cmake-T option:
+
$ # Build with the clang-cl toolset
+$ cmake.exe..-G"Visual Studio 16 2019"-Ax64-TClangCL
+$ # Build targeting Windows XP
+$ cmake.exe..-G"Visual Studio 16 2019"-Ax64-Tv120_xp
+
+
+
Whereas the -A option specifies the _target_
+architecture, the -T option can be used to specify
+details of the toolchain used. For example, -Thost=x64
+can be given to select the 64-bit version of the host
+tools. The following demonstrates how to use 64-bit
+tools and also build for a 64-bit target architecture:
+
$ cmake..-G"Visual Studio 16 2019"-Ax64-Thost=x64
+
Software projects often require variables to be
+set on the command line when invoking CMake. Some of
+the most commonly used CMake variables are listed in
+the table below:
Build configuration, such as
+Debug or Release, determining
+debug/optimization flags. This is only
+relevant for single-configuration buildsystems such
+as Makefile and Ninja. Multi-configuration
+buildsystems such as those for Visual Studio and Xcode
+ignore this setting.
Generate a compile_commands.json
+file for use with clang-based tools
+
+
+
+
Other project-specific variables may be available
+to control builds, such as enabling or disabling
+components of the project.
+
There is no convention provided by CMake for how
+such variables are named between different
+provided buildsystems, except that variables with
+the prefix CMAKE_ usually refer to options
+provided by CMake itself and should not be used
+in third-party options, which should use
+their own prefix instead. The
+cmake-gui(1) tool can display options
+in groups defined by their prefix, so it makes
+sense for third parties to ensure that they use a
+self-consistent prefix.
The -U flag may be used to unset variables
+on the cmake(1) command line:
+
$ cdbuild
+$ cmake.-UMyPackage_DIR
+
+
+
A CMake buildsystem which was initially created
+on the command line can be modified using the
+cmake-gui(1) and vice-versa.
+
The cmake(1) tool allows specifying a
+file to use to populate the initial cache using
+the -C option. This can be useful to simplify
+commands and scripts which repeatedly require the
+same cache entries.
When CMake is executed, it needs to find the locations of
+compilers, tools and dependencies. It also needs to be
+able to consistently re-generate a buildsystem to use the
+same compile/link flags and paths to dependencies. Such
+parameters are also required to be configurable by the
+user because they are paths and options specific to the
+users system.
+
When it is first executed, CMake generates a
+CMakeCache.txt file in the build directory containing
+key-value pairs for such artifacts. The cache file can be
+viewed or edited by the user by running the
+cmake-gui(1) or ccmake(1) tool. The
+tools provide an interactive interface for re-configuring
+the provided software and re-generating the buildsystem,
+as is needed after editing cached values. Each cache
+entry may have an associated short help text which is
+displayed in the user interface tools.
+
The cache entries may also have a type to signify how it
+should be presented in the user interface. For example,
+a cache entry of type BOOL can be edited by a
+checkbox in a user interface, a STRING can be edited
+in a text field, and a FILEPATH while similar to a
+STRING should also provide a way to locate filesystem
+paths using a file dialog. An entry of type STRING
+may provide a restricted list of allowed values which are
+then provided in a drop-down menu in the
+cmake-gui(1) user interface (see the
+STRINGS cache property).
+
The CMake files shipped with a software package may also
+define boolean toggle options using the option()
+command. The command creates a cache entry which has a
+help text and a default value. Such cache entries are
+typically specific to the provided software and affect
+the configuration of the build, such as whether tests
+and examples are built, whether to build with exceptions
+enabled etc.
CMake understands a file, CMakePresets.json, and its
+user-specific counterpart, CMakeUserPresets.json, for
+saving presets for commonly-used configure settings. These
+presets can set the build directory, generator, cache
+variables, environment variables, and other command-line
+options. All of these options can be overridden by the
+user. The full details of the CMakePresets.json format
+are listed in the cmake-presets(7) manual.
When using the cmake(1) command line tool, a
+preset can be invoked by using the --preset
+option. If --preset is specified,
+the generator and build directory are not required, but can be
+specified to override them. For example, if you have the following
+CMakePresets.json file:
This will generate a build directory in
+/path/to/source/build/ninja-release with the
+Ninja generator, and with
+CMAKE_BUILD_TYPE set to Release.
+
If you want to see the list of available presets, you can
+run:
+
cmake -S /path/to/source --list-presets
+
+
+
This will list the presets available in
+/path/to/source/CMakePresets.json and
+/path/to/source/CMakeUsersPresets.json without
+generating a build tree.
If a project has presets available, either through
+CMakePresets.json or CMakeUserPresets.json, the
+list of presets will appear in a drop-down menu in
+cmake-gui(1) between the source directory and
+the binary directory. Choosing a preset sets the binary
+directory, generator, environment variables, and cache
+variables, but all of these options can be overridden after
+a preset is selected.
After generating the buildsystem, the software can be
+built by invoking the particular build tool. In the
+case of the IDE generators, this can involve loading
+the generated project file into the IDE to invoke the
+build.
+
CMake is aware of the specific build tool needed to invoke
+a build so in general, to build a buildsystem or project
+from the command line after generating, the following
+command may be invoked in the build directory:
+
$ cmake--build.
+
+
+
The --build flag enables a
+particular mode of operation for the cmake(1)
+tool. It invokes the CMAKE_MAKE_PROGRAM
+command associated with the
+generator, or
+the build tool configured by the user.
+
The --build mode also accepts
+the parameter --target to
+specify a particular target to build, for example a
+particular library, executable or custom target, or a
+particular special target like install:
+
$ cmake--build.--targetmyexe
+
+
+
The --build mode also accepts a
+--config parameter
+in the case of multi-config generators to specify which
+particular configuration to build:
+
$ cmake--build.--targetmyexe--configRelease
+
+
+
The --config option has no
+effect if the generator generates a buildsystem specific
+to a configuration which is chosen when invoking cmake
+with the CMAKE_BUILD_TYPE variable.
+
Some buildsystems omit details of command lines invoked
+during the build. The --verbose
+flag can be used to cause those command lines to be shown:
+
$ cmake--build.--targetmyexe--verbose
+
+
+
The --build mode can also pass
+particular command line options to the underlying build
+tool by listing them after --. This can be useful
+to specify options to the build tool, such as to continue the
+build after a failed job, where CMake does not
+provide a high-level user interface.
+
For all generators, it is possible to run the underlying
+build tool after invoking CMake. For example, make
+may be executed after generating with the
+UnixMakefiles generator to invoke the build,
+or ninja after generating with the Ninja
+generator etc. The IDE buildsystems usually provide
+command line tooling for building a project which can
+also be invoked.
Each executable and library described in the CMake files
+is a build target, and the buildsystem may describe
+custom targets, either for internal use, or for user
+consumption, for example to create documentation.
+
CMake provides some built-in targets for all buildsystems
+providing CMake files.
+
+
all
The default target used by Makefile and Ninja
+generators. Builds all targets in the buildsystem,
+except those which are excluded by their
+EXCLUDE_FROM_ALL target property or
+EXCLUDE_FROM_ALL directory property. The
+name ALL_BUILD is used for this purpose for the
+Xcode and Visual Studio generators.
+
+
help
Lists the targets available for build. This target is
+available when using the UnixMakefiles or
+Ninja generator, and the exact output is
+tool-specific.
+
+
clean
Delete built object files and other output files. The
+Makefile based generators create a clean target
+per directory, so that an individual directory can be
+cleaned. The Ninja tool provides its own granular
+-tclean system.
+
+
test
Runs tests. This target is only automatically available
+if the CMake files provide CTest-based tests. See also
+Running Tests.
+
+
install
Installs the software. This target is only automatically
+available if the software defines install rules with the
+install() command. See also
+Software Installation.
+
+
package
Creates a binary package. This target is only
+automatically available if the CMake files provide
+CPack-based packages.
+
+
package_source
Creates a source package. This target is only
+automatically available if the CMake files provide
+CPack-based packages.
+
+
+
For Makefile based systems, /fast variants of binary
+build targets are provided. The /fast variants are used
+to build the specified target without regard for its
+dependencies. The dependencies are not checked and
+are not rebuilt if out of date. The Ninja
+generator is sufficiently fast at dependency checking that
+such targets are not provided for that generator.
+
Makefile based systems also provide build-targets to
+preprocess, assemble and compile individual files in a
+particular directory.
The file extension is built into the name of the target
+because another file with the same name but a different
+extension may exist. However, build-targets without the
+file extension are also provided.
+
$ makefoo.i
+$ makefoo.s
+$ makefoo.o
+
+
+
In buildsystems which contain foo.c and foo.cpp,
+building the foo.i target will preprocess both files.
The program invoked by the --build
+mode is determined by the CMAKE_MAKE_PROGRAM variable.
+For most generators, the particular program does not need to be
+configured.
+
+
+
Generator
+
Default make program
+
Alternatives
+
+
+
+
XCode
+
xcodebuild
+
+
+
Unix Makefiles
+
make
+
+
+
NMake Makefiles
+
nmake
+
jom
+
+
NMake Makefiles JOM
+
jom
+
nmake
+
+
MinGW Makefiles
+
mingw32-make
+
+
+
MSYS Makefiles
+
make
+
+
+
Ninja
+
ninja
+
+
+
Visual Studio
+
msbuild
+
+
+
Watcom WMake
+
wmake
+
+
+
+
+
The jom tool is capable of reading makefiles of the
+NMake flavor and building in parallel, while the
+nmake tool always builds serially. After generating
+with the NMakeMakefiles generator a user
+can run jom instead of nmake. The
+--build
+mode would also use jom if the
+CMAKE_MAKE_PROGRAM was set to jom while
+using the NMakeMakefiles generator, and
+as a convenience, the NMakeMakefilesJOM
+generator is provided to find jom in the normal way
+and use it as the CMAKE_MAKE_PROGRAM. For
+completeness, nmake is an alternative tool which
+can process the output of the
+NMakeMakefilesJOM generator, but doing
+so would be a pessimization.
The CMAKE_INSTALL_PREFIX variable can be
+set in the CMake cache to specify where to install the
+provided software. If the provided software has install
+rules, specified using the install() command,
+they will install artifacts into that prefix. On Windows,
+the default installation location corresponds to the
+ProgramFiles system directory which may be
+architecture specific. On Unix hosts, /usr/local is
+the default installation location.
+
The CMAKE_INSTALL_PREFIX variable always
+refers to the installation prefix on the target
+filesystem.
+
In cross-compiling or packaging scenarios where the
+sysroot is read-only or where the sysroot should otherwise
+remain pristine, the CMAKE_STAGING_PREFIX
+variable can be set to a location to actually install
+the files.
result in files being installed to paths such
+as /tmp/package/lib/libfoo.so on the host machine.
+The /usr/local location on the host machine is
+not affected.
+
Some provided software may specify uninstall rules,
+but CMake does not generate such rules by default itself.
The ctest(1) tool is shipped with the CMake
+distribution to execute provided tests and report
+results. The test build-target is provided to run
+all available tests, but the ctest(1) tool
+allows granular control over which tests to run, how to
+run them, and how to report results. Executing
+ctest(1) in the build directory is equivalent
+to running the test target:
+
$ ctest
+
+
+
A regular expression can be passed to run only tests
+which match the expression. To run only tests with
+Qt in their name:
+
$ ctest-RQt
+
+
+
Tests can be excluded by regular expression too. To
+run only tests without Qt in their name:
+
$ ctest-EQt
+
+
+
Tests can be run in parallel by passing -j
+arguments to ctest(1):
+
$ ctest-RQt-j8
+
+
+
The environment variable CTEST_PARALLEL_LEVEL
+can alternatively be set to avoid the need to pass
+-j.
+
By default ctest(1) does not print the output
+from the tests. The command line argument -V
+(or --verbose) enables verbose mode to print the
+output from all tests.
+The --output-on-failure
+option prints the test output for failing tests only.
+The environment variable CTEST_OUTPUT_ON_FAILURE
+can be set to 1 as an alternative to passing the
+--output-on-failure
+option to ctest(1).
Projects will frequently depend on other projects, assets, and artifacts.
+CMake provides a number of ways to incorporate such things into the build.
+Projects and users have the flexibility to choose between methods that
+best suit their needs.
+
The primary methods of bringing dependencies into the build are the
+find_package() command and the FetchContent module.
+The FindPkgConfig module is also sometimes used, although it
+lacks some of the integration of the other two and is not discussed any
+further in this guide.
+
Dependencies can also be made available by a custom
+dependency provider.
+This might be a third party package manager, or it might be custom code
+implemented by the developer. Dependency providers co-operate with the
+primary methods mentioned above to extend their flexibility.
A package needed by the project may already be built and available at some
+location on the user's system. That package might have also been built by
+CMake, or it could have used a different build system entirely. It might
+even just be a collection of files that didn't need to be built at all.
+CMake provides the find_package() command for these scenarios.
+It searches well-known locations, along with additional hints and paths
+provided by the project or user. It also supports package components and
+packages being optional. Result variables are provided to allow the project
+to customize its own behavior according to whether the package or specific
+components were found.
+
In most cases, projects should generally use the Basic Signature.
+Most of the time, this will involve just the package name, maybe a version
+constraint, and the REQUIRED keyword if the dependency is not optional.
+A set of package components may also be specified.
The find_package() command supports two main methods for carrying
+out the search:
+
+
Config mode
With this method, the command looks for files that are typically provided
+by the package itself. This is the more reliable method of the two, since
+the package details should always be in sync with the package.
+
+
Module mode
Not all packages are CMake-aware. Many don't provide the files needed to
+support config mode. For such cases, a Find module file can be provided
+separately, either by the project or by CMake. A Find module is typically
+a heuristic implementation which knows what the package normally provides
+and how to present that package to the project. Since Find modules are
+usually distributed separately from the package, they are not as reliable.
+They are typically maintained separately, and they are likely to follow
+different release schedules, so they can easily become out-of-date.
+
+
+
Depending on the arguments used, find_package() may use one or both
+of the above methods. By restricting the options to just the basic signature,
+both config mode and module mode can be used to satisfy the dependency.
+The presence of other options may restrict the call to using only one of the
+two methods, potentially reducing the command's ability to find the dependency.
+See the find_package() documentation for full details about this
+complex topic.
+
For both search methods, the user can also set cache variables on the
+cmake(1) command line or in the ccmake(1) or
+cmake-gui(1) UI tools to influence and override where to find
+packages. See the User Interaction Guide
+for more on how to set cache variables.
The preferred way for a third party to provide executables, libraries,
+headers, and other files for use with CMake is to provide
+config files. These are text files shipped
+with the package, which define CMake targets, variables, commands, and so on.
+The config file is an ordinary CMake script, which is read in by the
+find_package() command.
+
The config files can usually be found in a directory whose name matches the
+pattern lib/cmake/<PackageName>, although they may be in other locations
+instead (see Config Mode Search Procedure). The <PackageName> is usually the
+first argument to the find_package() command, and it may even be the
+only argument. Alternative names can also be specified with the NAMES
+option:
+
+
Providing alternative names when finding a package¶
+
find_package(SomeThing
+NAMES
+SameThingOtherName# Another name for the package
+SomeThing# Also still look for its canonical name
+)
+
+
+
+
The config file must be named either <PackageName>Config.cmake or
+<LowercasePackageName>-config.cmake (the former is used for the remainder
+of this guide, but both are supported). This file is the entry point
+to the package for CMake. A separate optional file named
+<PackageName>ConfigVersion.cmake or
+<LowercasePackageName>-config-version.cmake may also exist in the same
+directory. This file is used by CMake to determine whether the version of
+the package satisfies any version constraint included in the call to
+find_package(). It is optional to specify a version when calling
+find_package(), even if a <PackageName>ConfigVersion.cmake
+file is present.
+
If the <PackageName>Config.cmake file is found and any version constraint
+is satisfied, the find_package() command considers the package to be
+found, and the entire package is assumed to be complete as designed.
+
There may be additional files providing CMake commands or
+Imported Targets for you to use. CMake does not enforce any naming
+convention for these files. They are related to the primary
+<PackageName>Config.cmake file by use of the CMake include()
+command. The <PackageName>Config.cmake file would typically include
+these for you, so they won't usually require any additional step other than
+the call to find_package().
+
If the location of the package is in a
+directory known to CMake, the
+find_package() call should succeed. The directories known to CMake
+are platform-specific. For example, packages installed on Linux with a
+standard system package manager will be found in the /usr prefix
+automatically. Packages installed in ProgramFiles on Windows will
+similarly be found automatically.
+
Packages will not be found automatically without help if they are in
+locations not known to CMake, such as /opt/mylib or $HOME/dev/prefix.
+This is a normal situation, and CMake provides several ways for users to
+specify where to find such libraries.
+
The CMAKE_PREFIX_PATH variable may be
+set when invoking CMake.
+It is treated as a list of base paths in which to search for
+config files. A package installed in
+/opt/somepackage will typically install config files such as
+/opt/somepackage/lib/cmake/somePackage/SomePackageConfig.cmake.
+In that case, /opt/somepackage should be added to
+CMAKE_PREFIX_PATH.
+
The environment variable CMAKE_PREFIX_PATH may also be populated with
+prefixes to search for packages. Like the PATH environment variable,
+this is a list, but it needs to use the platform-specific environment variable
+list item separator (: on Unix and ; on Windows).
+
The CMAKE_PREFIX_PATH variable provides convenience in cases
+where multiple prefixes need to be specified, or when multiple packages
+are available under the same prefix. Paths to packages may also be
+specified by setting variables matching <PackageName>_DIR, such as
+SomePackage_DIR. Note that this is not a prefix, but should be a full
+path to a directory containing a config-style package file, such as
+/opt/somepackage/lib/cmake/SomePackage in the above example.
+See the find_package() documentation for other CMake variables and
+environment variables that can affect the search.
Packages which do not provide config files can still be found with the
+find_package() command, if a FindSomePackage.cmake file is
+available. These Find module files are different to config files in that:
+
+
Find module files should not be provided by the package itself.
+
The availability of a Find<PackageName>.cmake file does not indicate
+the availability of the package, or any particular part of the package.
+
CMake does not search the locations specified in the
+CMAKE_PREFIX_PATH variable for Find<PackageName>.cmake
+files. Instead, CMake searches for such files in the locations given
+by the CMAKE_MODULE_PATH variable. It is common for users to
+set the CMAKE_MODULE_PATH when running CMake, and it is common
+for CMake projects to append to CMAKE_MODULE_PATH to allow use
+of local Find module files.
+
CMake ships Find<PackageName>.cmake files for some
+thirdpartypackages. These files are a
+maintenance burden for CMake, and it is not unusual for these to fall
+behind the latest releases of the packages they are associated with.
+In general, new Find modules are not added to CMake any more. Projects
+should encourage the upstream packages to provide a config file where
+possible. If that is unsuccessful, the project should provide its own
+Find module for the package.
+
+
See Find Modules for a detailed discussion of how to write a
+Find module file.
Both config files and Find module files can define Imported Targets.
+These will typically have names of the form SomePrefix::ThingName.
+Where these are available, the project should prefer to use them instead of
+any CMake variables that may also be provided. Such targets typically carry
+usage requirements and apply things like header search paths, compiler
+definitions, etc. automatically to other targets that link to them (e.g. using
+target_link_libraries()). This is both more robust and more
+convenient than trying to apply the same things manually using variables.
+Check the documentation for the package or Find module to see what imported
+targets it defines, if any.
+
Imported targets should also encapsulate any configuration-specific paths.
+This includes the location of binaries (libraries, executables), compiler
+flags, and any other configuration-dependent quantities. Find modules may
+be less reliable in providing these details than config files.
+
A complete example which finds a third party package and uses a library
+from it might look like the following:
+
cmake_minimum_required(VERSION3.10)
+project(MyExeProjectVERSION1.0.0)
+
+# Make project-provided Find modules available
+list(APPENDCMAKE_MODULE_PATH"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+find_package(SomePackageREQUIRED)
+add_executable(MyExemain.cpp)
+target_link_libraries(MyExePRIVATESomePrefix::LibName)
+
+
+
Note that the above call to find_package() could be resolved by
+a config file or a Find module. It uses only the basic arguments supported
+by the Basic Signature. A FindSomePackage.cmake file in the
+${CMAKE_CURRENT_SOURCE_DIR}/cmake directory would allow the
+find_package() command to succeed using module mode, for example.
+If no such module file is present, the system would be searched for a config
+file.
Dependencies do not necessarily have to be pre-built in order to use them
+with CMake. They can be built from sources as part of the main project.
+The FetchContent module provides functionality to download
+content (typically sources, but can be anything) and add it to the main
+project if the dependency also uses CMake. The dependency's sources will
+be built along with the rest of the project, just as though the sources were
+part of the project's own sources.
+
The general pattern is that the project should first declare all the
+dependencies it wants to use, then ask for them to be made available.
+The following demonstrates the principle (see Examples
+for more):
Various download methods are supported, including downloading and extracting
+archives from a URL (a range of archive formats are supported), and a number
+of repository formats including Git, Subversion, and Mercurial.
+Custom download, update, and patch commands can also be used to support
+arbitrary use cases.
+
When a dependency is added to the project with FetchContent, the
+project links to the dependency's targets just like any other target from the
+project. If the dependency provides namespaced targets of the form
+SomePrefix::ThingName, the project should link to those rather than to
+any non-namespaced targets. See the next section for why this is recommended.
+
Not all dependencies can be brought into the project this way. Some
+dependencies define targets whose names clash with other targets from the
+project or other dependencies. Concrete executable and library targets
+created by add_executable() and add_library() are global,
+so each one must be unique across the whole build. If a dependency would
+add a clashing target name, it cannot be brought directly into the build
+with this method.
Some dependencies support being added by either find_package() or
+FetchContent. Such dependencies must ensure they define the same
+namespaced targets in both installed and built-from-source scenarios.
+A consuming project then links to those namespaced targets and can handle
+both scenarios transparently, as long as the project does not use anything
+else that isn't provided by both methods.
+
The project can indicate it is happy to accept a dependency by either method
+using the FIND_PACKAGE_ARGS option to FetchContent_Declare().
+This allows FetchContent_MakeAvailable() to try satisfying the
+dependency with a call to find_package() first, using the arguments
+after the FIND_PACKAGE_ARGS keyword, if any. If that doesn't find the
+dependency, it is built from source as described previously instead.
The above example calls
+find_package(googletestNAMESGTest) first.
+CMake provides a FindGTest module, so if that finds a GTest package
+installed somewhere, it will make it available, and the dependency will not be
+built from source. If no GTest package is found, it will be built from
+source. In either case, the GTest::gtest_main target is expected to be
+defined, so we link our unit test executable to that target.
+
High-level control is also available through the
+FETCHCONTENT_TRY_FIND_PACKAGE_MODE variable. This can be set to
+NEVER to disable all redirection to find_package(). It can be
+set to ALWAYS to try find_package() even if FIND_PACKAGE_ARGS
+was not specified (this should be used with caution).
+
The project might also decide that a particular dependency must be built from
+source. This might be needed if a patched or unreleased version of the
+dependency is required, or to satisfy some policy that requires all
+dependencies to be built from source. The project can enforce this by adding
+the OVERRIDE_FIND_PACKAGE keyword to FetchContent_Declare().
+A call to find_package() for that dependency will then be redirected
+to FetchContent_MakeAvailable() instead.
+
include(FetchContent)
+FetchContent_Declare(
+Catch2
+URLhttps://intranet.mycomp.com/vendored/Catch2_2.13.4_patched.tgz
+URL_HASHMD5=abc123...
+OVERRIDE_FIND_PACKAGE
+)
+
+# The following is automatically redirected to FetchContent_MakeAvailable(Catch2)
+find_package(Catch2)
+
The preceding section discussed techniques that projects can use to specify
+their dependencies. Ideally, the project shouldn't really care where a
+dependency comes from, as long as it provides the things it expects (often
+just some imported targets). The project says what it needs and may also
+specify where to get it from, in the absence of any other details, so that it
+can still be built out-of-the-box.
+
The developer, on the other hand, may be much more interested in controlling
+how a dependency is provided to the project. You might want to use a
+particular version of a package that you built yourself. You might want
+to use a third party package manager. You might want to redirect some
+requests to a different URL on a system you control for security or
+performance reasons. CMake supports these sort of scenarios through
+Dependency Providers.
+
A dependency provider can be set to intercept find_package() and
+FetchContent_MakeAvailable() calls. The provider is given an
+opportunity to satisfy such requests before falling back to the built-in
+implementation if the provider doesn't fulfill it.
+
Only one dependency provider can be set, and it can only be set at a very
+specific point early in the CMake run.
+The CMAKE_PROJECT_TOP_LEVEL_INCLUDES variable lists CMake files
+that will be read while processing the first project() call (and
+only that call). This is the only time a dependency provider may be set.
+At most, one single provider is expected to be used throughout the whole
+project.
+
For some scenarios, the user wouldn't need to know the details of how the
+dependency provider is set. A third party may provide a file that can be
+added to CMAKE_PROJECT_TOP_LEVEL_INCLUDES, which will set up
+the dependency provider on the user's behalf. This is the recommended
+approach for package managers. The developer can use such a file like so:
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.
At build time a test named "example_setup_test" will be created. Run this test
+on the command line with ctest(1) to load the data onto the Android
+device.
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
Add a fortran-only subdirectory, find a fortran compiler, and build.
+
The cmake_add_fortran_subdirectory function adds a subdirectory
+to a project that contains a fortran-only subproject. 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 Microsoft .lib files are created. Usage is as follows:
+
cmake_add_fortran_subdirectory(
+ <subdir> # name of subdirectory
+ PROJECT <project_name> # project name in subdir top CMakeLists.txt
+ ARCHIVE_DIR <dir> # dir where project places .lib files
+ RUNTIME_DIR <dir> # dir where project places .dll files
+ LIBRARIES <lib>... # names of library targets to import
+ LINK_LIBRARIES # link interface libraries for LIBRARIES
+ [LINK_LIBS <lib> <dep>...]...
+ CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
+ NO_EXTERNAL_INSTALL # skip installation of external project
+ )
+
+
+
Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with
+respect to the build directory corresponding to the source directory
+in which the function is invoked.
+
Limitations:
+
NO_EXTERNAL_INSTALL is required for forward compatibility with a
+future version that supports installation of the external project
+binaries during makeinstall.
Makes <option> available to the user if the
+semicolon-separated list of conditions in
+<depends> are all true. Otherwise, a local variable named <option>
+is set to <force>.
+
When <option> is available, the given <help_text> and initial
+<value> are used. Otherwise, any value set by the user is preserved for
+when <depends> is satisfied in the future.
+
Note that the <option> variable only has a value which satisfies the
+<depends> condition within the scope of the caller because it is a local
+variable.
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 and
+hides the option from the user. 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.
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.
If find_dependency is called with arguments identical to a previous
+call in the same directory, perhaps due to diamond-shaped package
+dependencies, the underlying call to find_package() is optimized
+out. This optimization is important to support large package dependency
+graphs while avoiding a combinatorial explosion of repeated searches.
+However, the heuristic cannot account for ambient variables that
+affect package behavior, such as <PackageName>_USE_STATIC_LIBS,
+offered by some packages. Therefore package configuration files should
+avoid setting such variables before their calls to find_dependency.
+
+
Changed in version 3.15: Previously, the underlying call to find_package() was always
+optimized out if the package had already been found. CMake 3.15
+removed the optimization to support cases in which find_dependency
+call arguments request different components.
+
+
+
Changed in version 3.26: The pre-3.15 optimization was restored, but with the above-described
+heuristic to account for varying find_dependency call arguments.
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.
The CPack module generates the configuration files CPackConfig.cmake
+and CPackSourceConfig.cmake. They are intended for use in a subsequent
+run of the cpack program where they steer the generation
+of installers or/and source packages.
+
Depending on the CMake generator, the CPack module may also add two new build
+targets, package and package_source. See the packaging targets
+section below for details.
+
The generated binary installers will contain all files that have been installed
+via CMake's install() command (and the deprecated commands
+install_files(), install_programs(), and
+install_targets()). Note that the DESTINATION option of the
+install() command must be a relative path; otherwise installed files
+are ignored by CPack.
+
Certain kinds of binary installers can be configured such that users can select
+individual application components to install. See the CPackComponent
+module for further details.
+
Source packages (configured through CPackSourceConfig.cmake and generated
+by the CPackArchiveGenerator) will contain all source files in
+the project directory except those specified in
+CPACK_SOURCE_IGNORE_FILES.
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.
+If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
+on a per-generator basis. It only need contain overrides.
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.
If CMake is run with the Makefile, Ninja, or Xcode generator, then
+include(CPack) generates a target package. This makes it possible
+to build a binary installer from CMake, Make, or Ninja: Instead of cpack,
+one may call cmake--build.--targetpackage or makepackage or
+ninjapackage. The VS generator creates an uppercase target PACKAGE.
+
If CMake is run with the Makefile or Ninja generator, then include(CPack)
+also generates a target package_source. To build a source package,
+instead of cpack-GTGZ--configCPackSourceConfig.cmake one may call
+cmake--build.--targetpackage_source, makepackage_source,
+or ninjapackage_source.
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:
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.
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.
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.
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.
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.
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.
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.
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().
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-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.
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 use UTF-8 characters, the file needs to be encoded
+in UTF-8 BOM. 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.
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.
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.
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.
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.
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.
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, Inno Setup and WIX do).
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).
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.
Number of threads to use when performing parallelized operations, such
+as compressing the installer package.
+
Some compression methods used by CPack generators such as Debian or Archive
+may take advantage of multiple CPU cores to speed up compression.
+CPACK_THREADS can be set to specify how many threads will be
+used for compression.
+
A positive integer can be used to specify an exact desired thread count.
+
When given a negative integer CPack will use the absolute value
+as the upper limit but may choose a lower value based on
+the available hardware concurrency.
+
Given 0 CPack will try to use all available CPU cores.
+
By default CPACK_THREADS is set to 1.
+
The following compression methods may take advantage of multiple cores:
+
+
xz
Supported if CMake is built with a liblzma that supports
+parallel compression.
+
+
New in version 3.21: Official CMake binaries available on cmake.org now ship
+with a liblzma that supports parallel compression.
+Older versions did not.
+
+
+
zstd
+
New in version 3.24.
+
+
Supported if CMake is built with libarchive 3.6 or higher.
+Official CMake binaries available on cmake.org support it.
+
+
+
Other compression methods ignore this value and use only one thread.
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).
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.
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.
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.*
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.
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.
Extra CMake scripts executed by CPack during its local staging
+installation. They are executed before installing the files to be packaged.
+The scripts are not called by a standalone install (e.g.: makeinstall).
+For every script, the following variables will be set:
+CMAKE_CURRENT_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR
+and CMAKE_INSTALL_PREFIX (which is set to the staging install
+directory). The singular form CMAKE_INSTALL_SCRIPT is supported as
+an alternative variable for historical reasons, but its value is ignored if
+CMAKE_INSTALL_SCRIPTS is set and a warning will be issued.
List of CMake scripts to execute after CPack has installed the files to
+be packaged into a staging directory and before producing the package(s)
+from those files. See also CPACK_INSTALL_SCRIPTS and
+CPACK_POST_BUILD_SCRIPTS.
List of package files created in the staging directory, with each file
+provided as a full absolute path. This variable is populated by CPack
+just before invoking the post-build scripts listed in
+CPACK_POST_BUILD_SCRIPTS. It is the preferred way for the
+post-build scripts to know the set of package files to operate on.
+Projects should not try to set this variable themselves.
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 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.
Specify the readelf executable path used by CPack.
+The default value will be CMAKE_READELF when set. Otherwise,
+the default value will be empty and CPack will use find_program()
+to determine the readelf path when needed.
Specify the objcopy executable path used by CPack.
+The default value will be CMAKE_OBJCOPY when set. Otherwise,
+the default value will be empty and CPack will use find_program()
+to determine the objcopy path when needed.
Specify the objdump executable path used by CPack.
+The default value will be CMAKE_OBJDUMP when set. Otherwise,
+the default value will be empty and CPack will use find_program()
+to determine the objdump path when needed.
Certain binary installers (especially the graphical installers) generated
+by CPack allow users to select individual application components to install.
+This module allows developers to configure the packaging of such components.
+
Contents is assigned to components by the COMPONENT
+argument of CMake's install() command. Components can be
+annotated with user-friendly names and descriptions, inter-component
+dependencies, etc., and grouped in various ways to customize the
+resulting installer, using the commands described below.
+
To specify different groupings for different CPack generators use
+a CPACK_PROJECT_CONFIG_FILE.
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:
Enable/Disable component install for CPack generator <GENNAME>.
+
Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy
+default behavior. e.g. RPM builds monolithic whereas NSIS builds
+component. One can change the default behavior by setting this variable to
+0/1 or OFF/ON.
Specify how components are grouped for multi-package component-aware CPack
+generators.
+
Some generators like RPM or ARCHIVE (TGZ, ZIP, ...) may generate
+several packages files when there are components, depending
+on the value of this variable:
+
+
ONE_PER_GROUP (default): create one package per component group
+
IGNORE : create one package per component (ignore the groups)
+
ALL_COMPONENTS_IN_ONE : create a single package with all requested
+components
compname is the name of an installation component, as defined by the
+COMPONENT argument of one or more CMake install() commands.
+With the cpack_add_component command one can set a name, a description,
+and other attributes of an installation component.
+One can also assign a component to a component group.
+
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 grayed 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.
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.
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/v3.25/ 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.
is a relative or absolute path to operations script
+for this component.
+
+
SORTING_PRIORITY
+
New in version 3.8.
+
+
is priority of the component in the tree.
+
+
PRIORITY
+
Deprecated since version 3.8: Old name for SORTING_PRIORITY.
+
+
+
DEPENDS, DEPENDENCIES
+
New in version 3.8.
+
+
list of dependency component or component group identifiers in
+QtIFW style.
+
+
New in version 3.21.
+
+
Component or group names listed as dependencies may contain hyphens.
+This requires QtIFW 3.1 or later.
+
+
AUTO_DEPEND_ON
+
New in version 3.8.
+
+
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
+
New in version 3.8.
+
+
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
+
New in version 3.7.
+
+
is a list of <file_path> ('.ui' files) representing pages to load.
+
+
TRANSLATIONS
+
New in version 3.8.
+
+
is a list of <file_path> ('.qm' files) representing translations to load.
+
+
REPLACES
+
New in version 3.10.
+
+
list of identifiers of component or component group to replace.
+
+
CHECKABLE
+
New in version 3.10.
+
+
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.
is a relative or absolute path to operations script
+for this component group.
+
+
SORTING_PRIORITY
is priority of the component group in the tree.
+
+
PRIORITY
+
Deprecated since version 3.8: Old name for SORTING_PRIORITY.
+
+
+
DEPENDS, DEPENDENCIES
+
New in version 3.8.
+
+
list of dependency component or component group identifiers in
+QtIFW style.
+
+
New in version 3.21.
+
+
Component or group names listed as dependencies may contain hyphens.
+This requires QtIFW 3.1 or later.
+
+
AUTO_DEPEND_ON
+
New in version 3.8.
+
+
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
+
New in version 3.8.
+
+
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
+
New in version 3.7.
+
+
is a list of <file_path> ('.ui' files) representing pages to load.
+
+
TRANSLATIONS
+
New in version 3.8.
+
+
is a list of <file_path> ('.qm' files) representing translations to load.
+
+
REPLACES
+
New in version 3.10.
+
+
list of identifiers of component or component group to replace.
+
+
CHECKABLE
+
New in version 3.10.
+
+
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.
Copy a file to another location and modify its contents.
+
cpack_ifw_configure_file(<input> <output>)
+
+
+
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.
Include this module in the top CMakeLists.txt file of a project to
+enable testing with CTest and dashboard submissions to CDash:
+
project(MyProject)
+...
+include(CTest)
+
+
+
The module automatically creates a BUILD_TESTING option that selects
+whether to enable testing support (ON by default). After including
+the module, use code like:
(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:
This module provides the ctest_coverage_collect_gcov function.
+
This function runs gcov on all .gcda files found in the binary tree
+and packages the resulting .gcov files into a tar file.
+This tarball also contains the following:
+
+
data.json defines the source and build directories for use by CDash.
+
Labels.json indicates any LABELS that have been set on the
+source files.
Run gcov and package a tar file for CDash. The options are:
+
+
TARBALL<tarfile>
Specify the location of the .tar file to be created for later
+upload to CDash. Relative paths will be interpreted with respect
+to the top-level build directory.
+
+
TARBALL_COMPRESSION<option>
+
New in version 3.18.
+
+
Specify a compression algorithm for the
+TARBALL data file. Using this option reduces the size of the data file
+before it is submitted to CDash. <option> must be one of GZIP,
+BZIP2, XZ, ZSTD, FROM_EXT, or an expression that CMake
+evaluates as FALSE. The default value is BZIP2.
+
If FROM_EXT is specified, the resulting file will be compressed based on
+the file extension of the <tarfile> (i.e. .tar.gz will use GZIP
+compression). File extensions that will produce compressed output include
+.tar.gz, .tgz, .tar.bzip2, .tbz, .tar.xz, and .txz.
+
+
SOURCE<source_dir>
Specify the top-level source directory for the build.
+Default is the value of CTEST_SOURCE_DIRECTORY.
+
+
BUILD<build_dir>
Specify the top-level build directory for the build.
+Default is the value of CTEST_BINARY_DIRECTORY.
+
+
GCOV_COMMAND<gcov_command>
Specify the full path to the gcov command on the machine.
+Default is the value of CTEST_COVERAGE_COMMAND.
+
+
GCOV_OPTIONS<options>...
Specify options to be passed to gcov. The gcov command
+is run as gcov<options>...-o<gcov-dir><file>.gcda.
+If not specified, the default option is just -b-x.
+
+
GLOB
+
New in version 3.6.
+
+
Recursively search for .gcda files in build_dir rather than
+determining search locations by reading TargetDirectories.txt.
+
+
DELETE
+
New in version 3.6.
+
+
Delete coverage files after they've been packaged into the .tar.
+
+
QUIET
Suppress non-error messages that otherwise would have been
+printed out by this function.
Check that the <flag> is accepted by the compiler without
+a diagnostic. Stores the result in an internal cache entry
+named <var>.
+
+
+
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 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.
+
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
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
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 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.
+
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
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
Check that the <flag> is accepted by the compiler without
+a diagnostic. Stores the result in an internal cache entry
+named <resultVar>.
+
+
+
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.
+
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.
+
The compile and link commands can be influenced by setting any of the
+following variables prior to calling check_fortran_compiler_flag()
+
+
+
CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
variable to store the result; will be created as an internal cache variable.
+
+
+
+
+
+
Note
+
This command does not detect functions in Fortran modules. In general it is
+recommended to use CheckSourceCompiles instead to determine if a
+Fortran function or subroutine is available.
+
+
The following variables may be set before calling this macro to modify
+the way the check is run:
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14: A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
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).
Check that the source supplied in <code> can be compiled as a Fortran source
+file, linked as an executable and then run. The <code> must be a Fortran
+program.
This command can help avoid costly build processes when a compiler lacks support
+for a necessary feature, or a particular vendor library is not compatible with
+the Fortran compiler version being used. Some of these failures only occur at runtime
+instead of linktime, and a trivial runtime example can catch the issue before the
+main build process.
+
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).
+
By default, the test source file will be given a .F90 file extension. The
+SRC_EXT option can be used to override this with .<extension> instead.
+
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.
+
The compile and link commands can be influenced by setting any of the
+following variables prior to calling check_fortran_source_runs():
+
+
+
+
+
CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
Check whether the compiler supports an interprocedural optimization (IPO/LTO).
+Use this before enabling the INTERPROCEDURAL_OPTIMIZATION target
+property.
Set <result> variable to YES if IPO is supported by the
+compiler and NO otherwise. If this option is not given then
+the command will issue a fatal error if IPO is not supported.
+
+
OUTPUT<output>
Set <output> variable with details about any error.
+
+
LANGUAGES<lang>...
Specify languages whose compilers to check.
+Languages C, CXX, and Fortran are supported.
+
+
+
+
+
It makes no sense to use this module when CMP0069 is set to OLD so
+module will return error in this case. See policy CMP0069 for details.
+
+
New in version 3.13: Add support for Visual Studio generators.
check_ipo_supported()# fatal error if IPO is not supported
+set_property(TARGETfooPROPERTYINTERPROCEDURAL_OPTIMIZATIONTRUE)
+
+
+
# Optional IPO. Do not use IPO if it's not supported by compiler.
+check_ipo_supported(RESULTresultOUTPUToutput)
+if(result)
+set_property(TARGETfooPROPERTYINTERPROCEDURAL_OPTIMIZATIONTRUE)
+else()
+message(WARNING"IPO is not supported: ${output}")
+endif()
+
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 additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
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 additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
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. For CUDA which can have an explicit host compiler, the cache
+CMAKE_CUDA_HOST_COMPILER variable will be set if it was required
+for compilation (and cleared if it was not).
Check that the source supplied in <code> can be compiled as a Objective-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 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.
+
The compile and link commands can be influenced by setting any of the
+following variables prior to calling check_objcxx_source_runs()
+
+
+
+
+
CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
<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:
+
+
+
CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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--the contents
+of the INCLUDE_DIRECTORIES directory property will be ignored.
+
+
+
+
+
+
CMAKE_REQUIRED_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
VAR - the name of the variable
+VARIABLE - variable to store the result
+ Will be created as an internal cache variable.
+
+
+
This macro is only for C variables.
+
+
+
The following variables may be set before calling this macro to modify
+the way the check is run:
+
+
+
CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be
+space-delimited--a ;-list will not work.
+The contents of CMAKE_<LANG>_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_LINK_OPTIONS
+
New in version 3.14.
+
+
A ;-list of options to add to the link
+command (see try_compile() for further details).
+
+
+
+
+
+
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
+
New in version 3.1.
+
+
If this variable evaluates to a boolean true value, all status messages
+associated with the check will be suppressed.
Deprecated since version 3.27: This module is available only if policy CMP0145
+is not set to NEW. Do not use it in new code.
+Use the CTest module instead.
+
+
Configure a project for testing with CTest or old Dart Tcl Client
+
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:
ASPELL_FOUND - system has ASPELL
+ASPELL_EXECUTABLE - the ASPELL executable
+ASPELL_INCLUDE_DIR - the ASPELL include directory
+ASPELL_LIBRARIES - The libraries needed to use ASPELL
+ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
+
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)
+
+
+
This module accepts the following variables
+
+
+
BULLET_ROOT - Can be set to bullet install path or Windows build path
+
This module finds if CABLE is installed and determines where the
+include files and libraries are. This code sets the following
+variables:
+
CABLE the path to the cable executable
+CABLE_TCL_LIBRARY the path to the Tcl wrapper library
+CABLE_INCLUDE_DIR the path to the include directory
+
+
+
To build Tcl wrappers, you should add shared library and link it to
+${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
+include directory.
If CURL was built using the CMake buildsystem then it provides its own
+CURLConfig.cmake file for use with the find_package() command's
+config mode. This module looks for this file and, if found,
+returns its results with no further action.
+
Set CURL_NO_CURL_CMAKE to ON to disable this search.
Coin3D is an implementation of the Open Inventor API. It provides
+data structures and algorithms for 3D visualization.
+
This module defines the following variables
+
COIN3D_FOUND - system has Coin3D - Open Inventor
+COIN3D_INCLUDE_DIRS - where the Inventor include directory can be found
+COIN3D_LIBRARIES - Link to this to use Coin3D
+
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.
+
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
+
New in version 2.8.3.
+
+
Specify a list of options to pass to the CxxTest code
+generator. If not defined, --error-printer is passed.
Find DICOM ToolKit (DCMTK) libraries and applications
+
The module defines the following variables:
+
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
+
This module is able to find a version of DCMTK that does or does not export
+a DCMTKConfig.cmake file. It applies a two step process:
+
+
Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file.
+
Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_*
+variables details below.
+
+
Recent DCMTK
+provides a DCMTKConfig.cmakepackageconfigurationfile. To exclusively use the package configuration file
+(recommended when possible), pass the NO_MODULE option to
+find_package(). For example, find_package(DCMTK NO_MODULE).
+This requires official DCMTK snapshot 3.6.1_20140617 or newer.
+
Until all clients update to the more recent DCMTK, build systems will need
+to support different versions of DCMTK.
+
On any given system, the following combinations of DCMTK versions could be
+considered:
+
+
+
+
SYSTEM DCMTK
+
LOCAL DCMTK
+
Supported ?
+
+
Case A
+
NA
+
[ ] DCMTKConfig
+
YES
+
+
Case B
+
NA
+
[X] DCMTKConfig
+
YES
+
+
Case C
+
[ ] DCMTKConfig
+
NA
+
YES
+
+
Case D
+
[X] DCMTKConfig
+
NA
+
YES
+
+
Case E
+
[ ] DCMTKConfig
+
[ ] DCMTKConfig
+
YES (*)
+
+
Case F
+
[X] DCMTKConfig
+
[ ] DCMTKConfig
+
NO
+
+
Case G
+
[ ] DCMTKConfig
+
[X] DCMTKConfig
+
YES
+
+
Case H
+
[X] DCMTKConfig
+
[X] DCMTKConfig
+
YES
+
+
+
+
+
(*) See Troubleshooting section.
+
+
Legend:
+
+
NA ...............: Means that no System or Local DCMTK is available
+
[ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file.
+
[X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file.
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.
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 will set the following variables in your project:
+
GSL_FOUND - True if GSL found on the local system
+GSL_INCLUDE_DIRS - Location of GSL header files.
+GSL_LIBRARIES - The GSL libraries.
+GSL_VERSION - The version of the discovered GSL install.
+
Set GSL_ROOT_DIR to a directory that contains a GSL installation.
+
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 may set the following variables depending on platform and type
+of GSL installation discovered. These variables may optionally be set to
+help this module find the correct files:
+
GSL_CBLAS_LIBRARY - Location of the GSL CBLAS library.
+GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any).
+GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any).
+GSL_LIBRARY - Location of the GSL library.
+GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
+
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)
+
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 target.
+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 target.
+It creates a custom target "pofiles".
+
+
+
+
New in version 3.2: If you wish to use the Gettext library (libintl), use FindIntl.
GNUPLOT_FOUND - system has Gnuplot
+GNUPLOT_EXECUTABLE - the Gnuplot executable
+GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
+
+
+
GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
This module looks for Microsoft HTML Help Compiler
+
It defines:
+
HTML_HELP_COMPILER : full path to the Compiler (hhc.exe)
+HTML_HELP_INCLUDE_PATH : include path to the API (htmlhelp.h)
+HTML_HELP_LIBRARY : full path to the library (htmlhelp.lib)
+
Find the ZeroC Internet Communication Engine (ICE) programs,
+libraries and datafiles.
+
This module supports multiple components.
+Components can include any of: Freeze, Glacier2, Ice,
+IceBox, IceDB, IceDiscovery, IceGrid,
+IceLocatorDiscovery, IcePatch, IceSSL, IceStorm,
+IceUtil, IceXML, or Slice.
+
Ice 3.7 and later also include C++11-specific components:
+Glacier2++11, Ice++11, IceBox++11, IceDiscovery++11
+IceGrid, IceLocatorDiscovery++11, IceSSL++11,
+IceStorm++11
+
Note that the set of supported components is Ice version-specific.
+
+
New in version 3.4: Imported targets for components and most EXECUTABLE variables.
+
+
+
New in version 3.7: Debug and Release variants are found separately.
+
+
+
New in version 3.10: Ice 3.7 support, including new components, programs and the Nuget package.
+
+
This module reports information about the Ice installation in
+several variables. General variables:
+
Ice_VERSION - Ice release version
+Ice_FOUND - true if the main programs and libraries were found
+Ice_LIBRARIES - component libraries to be linked
+Ice_INCLUDE_DIRS - the directories containing the Ice headers
+Ice_SLICE_DIRS - the directories containing the Ice slice interface
+ definitions
+
+
+
Imported targets:
+
Ice::<C>
+
+
+
Where <C> is the name of an Ice component, for example
+Ice::Glacier2 or Ice++11.
+
Ice slice programs are reported in:
+
Ice_SLICE2CONFLUENCE_EXECUTABLE - path to slice2confluence executable
+Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
+Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
+Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
+Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
+Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
+Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
+Ice_SLICE2JS_EXECUTABLE - path to slice2js executable
+Ice_SLICE2MATLAB_EXECUTABLE - path to slice2matlab executable
+Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable
+Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
+Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
+Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
+
+
+
+
New in version 3.14: Variables for slice2confluence and slice2matlab.
+
+
Ice programs are reported in:
+
Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
+Ice_ICEBOX_EXECUTABLE - path to icebox executable
+Ice_ICEBOXXX11_EXECUTABLE - path to icebox++11 executable
+Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
+Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
+Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
+Ice_ICEBRIDGE_EXECUTABLE - path to icebridge executable
+Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable
+Ice_ICEGRIDDB_EXECUTABLE - path to icegriddb executable
+Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable
+Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable
+Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable
+Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable
+Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable
+Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable
+Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable
+Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable
+Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable
+Ice_ICESTORMDB_EXECUTABLE - path to icestormdb executable
+Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable
+
+
+
Ice db programs (Windows only; standard system versions on all other
+platforms) are reported in:
+
Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable
+Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable
+Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable
+Ice_DB_DUMP_EXECUTABLE - path to db_dump executable
+Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable
+Ice_DB_LOAD_EXECUTABLE - path to db_load executable
+Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable
+Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable
+Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable
+Ice_DB_STAT_EXECUTABLE - path to db_stat executable
+Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable
+Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable
+Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable
+Ice_DUMPDB_EXECUTABLE - path to dumpdb executable
+Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable
+
+
+
Ice component libraries are reported in:
+
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.
+
+
The following cache variables may also be set:
+
Ice_<P>_EXECUTABLE - the path to executable <P>
+Ice_INCLUDE_DIR - the directory containing the Ice headers
+Ice_SLICE_DIR - the directory containing the Ice slice interface
+ definitions
+Ice_<C>_LIBRARY - the library for component <C>
+
+
+
+
Note
+
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.
+
+
Other variables one may set to control this module are:
+
Ice_DEBUG - Set to ON to enable debug output from FindIce.
+
Find ImageMagick, software suite for displaying, converting and
+manipulating raster images.
+
+
New in version 3.9: Added support for ImageMagick 7.
+
+
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):
+
+
animate
+
compare
+
composite
+
conjure
+
convert
+
display
+
identify
+
import
+
mogrify
+
montage
+
stream
+
+
If no component is specified in the find_package() call, then it only
+searches for the ImageMagick executable directory.
+
There are also components for the following ImageMagick APIs:
+
+
Magick++: ImageMagick C++ API, if found.
+
MagickWand: ImageMagick MagickWand C API, if found.
+
MagickCore: ImageMagick MagickCore low-level C API, if found.
On some platforms, such as Linux with GNU libc, the gettext
+functions are present in the C standard library and libintl
+is not required. Intl_LIBRARIES will be empty in this
+case.
+
+
+
Note
+
Some libintl implementations don't embed the version number in their header files.
+In this case the variables Intl_VERSION* will be empty.
+
+
+
Note
+
If you wish to use the Gettext tools (msgmerge,
+msgfmt, etc.), use FindGettext.
Find libarchive library and headers.
+Libarchive is multi-format archive and compression library.
+
The module defines the following variables:
+
LibArchive_FOUND - true if libarchive was found
+LibArchive_INCLUDE_DIRS - include search path
+LibArchive_LIBRARIES - libraries to link
+LibArchive_VERSION - libarchive 3-component version number
+
+
+
The module defines the following IMPORTED targets:
+
LibArchive::LibArchive - target for linking against libarchive
+
+
+
+
New in version 3.6: Support for new libarchive 3.2 version string format.
LUA51_FOUND, if false, do not try to link to Lua
+LUA_LIBRARIES
+LUA_INCLUDE_DIR, where to find lua.h
+LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
+
+
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/
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
+
True, if the system has OpenGL and all components are found.
+
+
OPENGL_XMESA_FOUND
True, if the system has XMESA.
+
+
OPENGL_GLU_FOUND
True, if the system has GLU.
+
+
OpenGL_OpenGL_FOUND
True, if the system has an OpenGL library.
+
+
OpenGL_GLX_FOUND
True, if the system has GLX.
+
+
OpenGL_EGL_FOUND
True, if the system has EGL.
+
+
OpenGL::GLES2
Defined if the system has GLES2.
+
+
OpenGL::GLES3
Defined if the system has GLES3.
+
+
OPENGL_INCLUDE_DIR
Path to the OpenGL include directory.
+
+
OPENGL_EGL_INCLUDE_DIRS
Path to the EGL include directory.
+
+
OPENGL_LIBRARIES
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.
+
+
+
+
New in version 3.10: Variables for GLVND-specific libraries OpenGL, EGL and GLX.
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.
+
+
Changed in version 3.11: This is the default, unless policy CMP0072 is set to OLD
+and no components are requested (since components
+correspond to GLVND libraries).
+
+
+
LEGACY
Prefer to use the legacy libGL library, if available.
+
+
+
For EGL targets the client must rely on GLVND support on the user's system.
+Linking should use the OpenGL::OpenGLOpenGL::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.
On OSX FindOpenGL defaults to using the framework version of OpenGL. People
+will have to change the cache values of OPENGL_glu_LIBRARY and
+OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
find_package_message(<name>"message for user""find result details")
+
+
+
This function 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.
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
+
$PRODUCER_DIR is an environment variable that would correspond to the
+./configure --prefix=$PRODUCER_DIR used in building osg.
Find Python 2 interpreter, compiler and development environment (include
+directories and libraries).
+
+
New in version 3.19: When a version is requested, it can be specified as a simple value or as a
+range. For a detailed description of version range usage and capabilities,
+refer to the find_package() command.
+
+
The following components are supported:
+
+
Interpreter: search for Python 2 interpreter
+
Compiler: search for Python 2 compiler. Only offered by IronPython.
+
Development: search for development artifacts (include directories and
+libraries).
+
+
New in version 3.18: This component includes two sub-components which can be specified
+independently:
+
+
Development.Module: search for artifacts for Python 2 module
+developments.
+
Development.Embed: search for artifacts for Python 2 embedding
+developments.
+
+
+
+
NumPy: search for NumPy include directories.
+
+
+
New in version 3.14: Added the NumPy component.
+
+
If no COMPONENTS are specified, Interpreter is assumed.
+
If component Development is specified, it implies sub-components
+Development.Module and Development.Embed.
+
To ensure consistent versions between components Interpreter, Compiler,
+Development (or one of its sub-components) and NumPy, specify all
+components at the same time:
This module looks only for version 2 of Python. This module can be used
+concurrently with FindPython3 module to use both Python versions.
+
The FindPython module can be used if Python version does not matter
+for you.
+
+
Note
+
If components Interpreter and Development (or one of its
+sub-components) are both specified, this module search only for interpreter
+with same platform architecture as the one defined by CMake
+configuration. This constraint does not apply if only Interpreter
+component is specified.
Define the root directory of a Python 2 installation.
+
+
Python2_USE_STATIC_LIBS
+
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.
+
+
+
Note
+
This hint will be ignored on Windows because static libraries are not
+available on this platform.
+
+
+
Python2_FIND_STRATEGY
+
New in version 3.15.
+
+
This variable defines how lookup will be done.
+The Python2_FIND_STRATEGY variable can be set to one of the following:
+
+
VERSION: Try to find the most recent version in all specified
+locations.
+This is the default if policy CMP0094 is undefined or set to
+OLD.
+
LOCATION: Stops lookup as soon as a version satisfying version
+constraints is founded.
+This is the default if policy CMP0094 is set to NEW.
+
+
See also Python2_FIND_UNVERSIONED_NAMES.
+
+
Python2_FIND_REGISTRY
+
New in version 3.13.
+
+
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 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.
+
+
+
Python2_FIND_FRAMEWORK
+
New in version 3.15.
+
+
On macOS the Python2_FIND_FRAMEWORK variable determine the order of
+preference between Apple-style and unix-style package components.
+This variable can take same values as CMAKE_FIND_FRAMEWORK
+variable.
+
+
Note
+
Value ONLY is not supported so FIRST will be used instead.
+
+
If Python2_FIND_FRAMEWORK is not defined, CMAKE_FIND_FRAMEWORK
+variable will be used, if any.
+
+
Python2_FIND_VIRTUALENV
+
New in version 3.15.
+
+
This variable defines the handling of virtual environments managed by
+virtualenv or conda. It is meaningful only when a virtual environment
+is active (i.e. the activate script has been evaluated). In this case, it
+takes precedence over Python2_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK
+variables. The Python2_FIND_VIRTUALENV variable can be set to one of the
+following:
+
+
FIRST: The virtual environment is used before any other standard
+paths to look-up for the interpreter. This is the default.
+
ONLY: Only the virtual environment is used to look-up for the
+interpreter.
+
STANDARD: The virtual environment is not used to look-up for the
+interpreter but environment variable PATH is always considered.
+In this case, variable Python2_FIND_REGISTRY (Windows) or
+CMAKE_FIND_FRAMEWORK (macOS) can be set with value LAST or
+NEVER to select preferably the interpreter from the virtual
+environment.
+
+
+
New in version 3.17: Added support for conda environments.
+
+
+
Note
+
If the component Development is requested, it is strongly
+recommended to also include the component Interpreter to get expected
+result.
+
+
+
Python2_FIND_IMPLEMENTATIONS
+
New in version 3.18.
+
+
This variable defines, in an ordered list, the different implementations
+which will be searched. The Python2_FIND_IMPLEMENTATIONS variable can
+hold the following values:
+
+
CPython: this is the standard implementation. Various products, like
+Anaconda or ActivePython, rely on this implementation.
+
IronPython: This implementation use the CSharp language for
+.NETFramework on top of the Dynamic Language Runtime (DLR).
+See IronPython.
+
PyPy: This implementation use RPython language and
+RPythontranslationtoolchain to produce the python interpreter.
+See PyPy.
+
+
The default value is:
+
+
Windows platform: CPython, IronPython
+
Other platforms: CPython
+
+
+
Note
+
This hint has the lowest priority of all hints, so even if, for example,
+you specify IronPython first and CPython in second, a python
+product based on CPython can be selected because, for example with
+Python2_FIND_STRATEGY=LOCATION, each location will be search first for
+IronPython and second for CPython.
+
+
+
Note
+
When IronPython is specified, on platforms other than Windows, the
+.Net interpreter (i.e. mono command) is expected to be available
+through the PATH variable.
+
+
+
Python2_FIND_UNVERSIONED_NAMES
+
New in version 3.20.
+
+
This variable defines how the generic names will be searched. Currently, it
+only applies to the generic names of the interpreter, namely, python2 and
+python.
+The Python2_FIND_UNVERSIONED_NAMES variable can be set to one of the
+following values:
+
+
FIRST: The generic names are searched before the more specialized ones
+(such as python2.5 for example).
+
LAST: The generic names are searched after the more specialized ones.
+This is the default.
To solve special cases, it is possible to specify directly the artifacts by
+setting the following variables:
+
+
Python2_EXECUTABLE
The path to the interpreter.
+
+
Python2_COMPILER
The path to the compiler.
+
+
Python2_DOTNET_LAUNCHER
+
New in version 3.18.
+
+
The .Net interpreter. Only used by IronPython implementation.
+
+
Python2_LIBRARY
The path to the library. It will be used to compute the
+variables Python2_LIBRARIES, Python2_LIBRARY_DIRS and
+Python2_RUNTIME_LIBRARY_DIRS.
+
+
Python2_INCLUDE_DIR
The path to the directory of the Python headers. It will be used to
+compute the variable Python2_INCLUDE_DIRS.
+
+
Python2_NumPy_INCLUDE_DIR
The path to the directory of the NumPy headers. It will be used to
+compute the variable Python2_NumPy_INCLUDE_DIRS.
+
+
+
+
Note
+
All paths must be absolute. Any artifact specified with a relative path
+will be ignored.
+
+
+
Note
+
When an artifact is specified, all HINTS will be ignored and no search
+will be performed for this artifact.
+
If more than one artifact is specified, it is the user's responsibility to
+ensure the consistency of the various artifacts.
+
+
By default, this module supports multiple calls in different directories of a
+project with different version/component requirements while providing correct
+and consistent results for each call. To support this behavior, CMake cache
+is not used in the traditional way which can be problematic for interactive
+specification. So, to enable also interactive specification, module behavior
+can be controlled with the following variable:
+
+
Python2_ARTIFACTS_INTERACTIVE
+
New in version 3.18.
+
+
Selects the behavior of the module. This is a boolean variable:
+
+
If set to TRUE: Create CMake cache entries for the above artifact
+specification variables so that users can edit them interactively.
+This disables support for multiple version/component requirements.
+
If set to FALSE or undefined: Enable multiple version/component
+requirements.
This module defines the command Python2_add_library (when
+CMAKE_ROLE is PROJECT), which has the same semantics as
+add_library() and adds a dependency to target Python2::Python or,
+when library type is MODULE, to target Python2::Module and takes care
+of Python module naming rules:
Locate QuickTime This module defines QUICKTIME_LIBRARY
+QUICKTIME_FOUND, if false, do not try to link to gdal
+QUICKTIME_INCLUDE_DIR, where to find the headers
+
$QUICKTIME_DIR is an environment variable that would correspond to the
+./configure --prefix=$QUICKTIME_DIR
This module will set the following variables in your project:
+
+
Ruby_FOUND
set to true if ruby was found successfully
+
+
Ruby_EXECUTABLE
full path to the ruby binary
+
+
Ruby_INCLUDE_DIRS
include dirs to be used when using the ruby library
+
+
Ruby_LIBRARIES
+
New in version 3.18: libraries needed to use ruby from C.
+
+
+
Ruby_VERSION
the version of ruby which was found, e.g. "1.8.7"
+
+
Ruby_VERSION_MAJOR
Ruby major version.
+
+
Ruby_VERSION_MINOR
Ruby minor version.
+
+
Ruby_VERSION_PATCH
Ruby patch version.
+
+
+
+
Changed in version 3.18: Previous versions of CMake used the RUBY_ prefix for all variables.
+The following variables are provided for compatibility reasons,
+don't use them in new code:
This variable defines the handling of virtual environments managed by
+rvm. It is meaningful only when a virtual environment
+is active (i.e. the rvm script has been evaluated or at least the
+MY_RUBY_HOME environment variable is set).
+The Ruby_FIND_VIRTUALENV variable can be set to empty or
+one of the following:
+
+
FIRST: The virtual environment is used before any other standard
+paths to look-up for the interpreter. This is the default.
+
ONLY: Only the virtual environment is used to look-up for the
+interpreter.
+
STANDARD: The virtual environment is not used to look-up for the
+interpreter (assuming it isn't still in the PATH...)
SDL::SDL_gfx, the name of the target to use with target_*() commands
+SDL_GFX_LIBRARIES, the name of the library to link against
+SDL_GFX_INCLUDE_DIRS, where to find the headers
+SDL_GFX_FOUND, if false, do not try to link against
+SDL_GFX_VERSION_STRING - human-readable string containing the
+ version of SDL_gfx
+
+
+
$SDLDIR is an environment variable that would correspond to the
+./configure--prefix=$SDLDIR used in building SDL.
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
+
+
+
For backward compatibility the following variables are also set:
+
SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
+SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
+SDLTTF_FOUND (same value as SDL_TTF_FOUND)
+
+
+
$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL.
This module looks for some executable packers (i.e. software that
+compress executables or shared libs into on-the-fly self-extracting
+executables or shared libs. Examples:
TCL_STUB_LIBRARY = path to Tcl stub library
+TK_STUB_LIBRARY = path to Tk stub library
+TTK_STUB_LIBRARY = path to ttk stub library
+
+
+
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.
+
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:
+
TCLSH_FOUND = TRUE if tclsh has been found
+TCL_TCLSH = the path to the tclsh executable
+
This module defines IMPORTED targets if Vulkan has been found:
+
+
Vulkan::Vulkan
The main Vulkan library.
+
+
Vulkan::glslc
+
New in version 3.19.
+
+
The GLSLC SPIR-V compiler, if it has been found.
+
+
Vulkan::Headers
+
New in version 3.21.
+
+
Provides just Vulkan headers include paths, if found. No library is
+included in this target. This can be useful for applications that
+load Vulkan library dynamically.
+
+
Vulkan::glslangValidator
+
New in version 3.21.
+
+
The glslangValidator tool, if found. It is used to compile GLSL and
+HLSL shaders into SPIR-V.
+
+
Vulkan::glslang
+
New in version 3.24.
+
+
Defined if SDK has the Khronos-reference front-end shader parser and SPIR-V
+generator library (glslang).
+
+
Vulkan::shaderc_combined
+
New in version 3.24.
+
+
Defined if SDK has the Google static library for Vulkan shader compilation
+(shaderc_combined).
+
+
Vulkan::SPIRV-Tools
+
New in version 3.24.
+
+
Defined if SDK has the Khronos library to process SPIR-V modules
+(SPIRV-Tools).
+
+
Vulkan::MoltenVK
+
New in version 3.24.
+
+
Defined if SDK has the Khronos library which implement a subset of Vulkan API
+over Apple Metal graphics framework. (MoltenVK).
+
+
Vulkan::volk
+
New in version 3.25.
+
+
Defined if SDK has the Vulkan meta-loader (volk).
+
+
Vulkan::dxc_lib
+
New in version 3.25.
+
+
Defined if SDK has the DirectX shader compiler library.
+
+
Vulkan::dxc_exe
+
New in version 3.25.
+
+
Defined if SDK has the DirectX shader compiler CLI tool.
The VULKAN_SDK environment variable optionally specifies the
+location of the Vulkan SDK root directory for the given
+architecture. It is typically set by sourcing the toplevel
+setup-env.sh script of the Vulkan SDK directory into the shell
+environment.
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:
+
TK_WISH = the path to the wish executable
+
+
+
if UNIX is defined, then it will look for the cygwin version first
New in version 3.14: Renamed Xxf86misc, X11_Xxf86misc, X11_Xxf86vm, X11_xkbfile,
+X11_Xtst, and X11_Xss libraries to match their file names.
+Deprecated the X11_Xinput library. Old names are still available
+for compatibility.
+
+
+
New in version 3.14: Added the X11_Xext_INCLUDE_PATH variable.
+
+
+
New in version 3.18: Added the xcb, X11-xcb, xcb-icccm, xcb-xkb, xkbcommon,
+and xkbcommon-X11 libraries.
+
+
+
New in version 3.19: Added the Xaw, xcb_util, and xcb_xfixes libraries.
+
+
+
New in version 3.24: Added the xcb_randr, xcb_xtext, and xcb_keysyms libraries.
+
+
+
New in version 3.27: Added the xcb_composite, xcb_cursor, xcb_damage, xcb_dpms,
+xcb_dri2, xcb_dri3, xcb_errors, xcb_ewmh, xcb_glx,
+xcb_image, xcb_present, xcb_record, xcb_render,
+xcb_render_util, xcb_res, xcb_screensaver, xcb_shape,
+xcb_shm, xcb_sync, xcb_xf86dri, xcb_xinerama, xcb_xinput,
+xcb_xrm, xcb_xvmc, and xcb_xv libraries.
Functions to help creating and executing XCTest bundles.
+
An XCTest bundle is a CFBundle with a special product-type
+and bundle extension. The Mac Developer Library provides more
+information in the Testing with Xcode document.
The xctest_add_bundle function creates a XCTest bundle named
+<target> which will test the target <testee>. Supported target types
+for testee are Frameworks and App Bundles:
+
xctest_add_bundle(
+ <target> # Name of the XCTest bundle
+ <testee> # Target name of the testee
+ )
+
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 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 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
+
+
OSGDB_LIBRARY
The osgDB library
+
+
OSGDB_LIBRARY_DEBUG
The osgDB debug library
+
+
+
$OSGDIR is an environment variable that would correspond to:
+
./configure --prefix=$OSGDIR used in building osg.
+
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)
+
OSGPARTICLE_LIBRARY - The osgParticle library
+OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
+
$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
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)
+
OSGPRODUCER_LIBRARY - The osgProducer library
+OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
+
$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
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)
+
OSGQT_LIBRARY - The osgQt library OSGQT_LIBRARY_DEBUG - The osgQt
+debug library
+
$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
Created by Eric Wing. Modified to work with osgQt by Robert Osfield,
+January 2012.
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)
+
OSGSIM_LIBRARY - The osgSim library OSGSIM_LIBRARY_DEBUG - The osgSim
+debug library
+
$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
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 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)
Find a wxWidgets (a.k.a., wxWindows) installation.
+
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 ... OPTIONAL_COMPONENTS net ...)
+
+
New in version 3.4: Support for find_package() version argument; webview component.
+
+
+
New in version 3.14: OPTIONAL_COMPONENTS support.
+
+
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):
+
wxWidgets_ROOT_DIR - Base wxWidgets directory
+ (e.g., C:/wxWidgets-3.2.0).
+wxWidgets_LIB_DIR - Path to wxWidgets libraries
+ (e.g., C:/wxWidgets-3.2.0/lib/vc_x64_lib).
+wxWidgets_CONFIGURATION - Configuration to use
+ (e.g., msw, mswd, mswu, mswunivud, etc.)
+wxWidgets_EXCLUDE_COMMON_LIBRARIES
+ - Set to TRUE to exclude linking of
+ commonly required libs (e.g., png tiff
+ jpeg zlib regex expat).
+
+
+
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:
The following are set after the configuration is done for both windows
+and unix style:
+
wxWidgets_FOUND - Set to TRUE if wxWidgets was found.
+wxWidgets_INCLUDE_DIRS - Include directories for WIN32
+ i.e., where to find "wx/wx.h" and
+ "wx/setup.h"; possibly empty for unices.
+wxWidgets_LIBRARIES - Path to the wxWidgets libraries.
+wxWidgets_LIBRARY_DIRS - compile time link dirs, useful for
+ rpath on UNIX. Typically an empty string
+ in WIN32 environment.
+wxWidgets_DEFINITIONS - Contains defines required to compile/link
+ against WX, e.g. WXUSINGDLL
+wxWidgets_DEFINITIONS_DEBUG- Contains defines required to compile/link
+ against WX debug builds, e.g. __WXDEBUG__
+wxWidgets_CXX_FLAGS - Include dirs and compiler flags for
+ unices, empty on WIN32. Essentially
+ "`wx-config --cxxflags`".
+wxWidgets_USE_FILE - Convenience include file.
+
+
+
+
New in version 3.11: The following environment variables can be used as hints: WX_CONFIG,
+WXRC_CMD.
+
+
Sample usage:
+
# Note that for MinGW users the order of libs is important!
+find_package(wxWidgets COMPONENTS gl core base OPTIONAL_COMPONENTS net)
+if(wxWidgets_FOUND)
+ include(${wxWidgets_USE_FILE})
+ # and for each of your dependent executable/library targets:
+ target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+endif()
+
+
+
If wxWidgets is required (i.e., not an optional part):
+
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
+include(${wxWidgets_USE_FILE})
+# and for each of your dependent executable/library targets:
+target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+
Deprecated since version 3.0: Replaced by FindwxWidgets.
+
+
Find wxWindows (wxWidgets) installation
+
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. This code sets the following variables:
+
WXWINDOWS_FOUND = system has WxWindows
+WXWINDOWS_LIBRARIES = path to the wxWindows libraries
+ on Unix/Linux with additional
+ linker flags from
+ "wx-config --libs"
+CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
+ essentially "`wx-config --cxxflags`"
+ on Linux
+WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
+WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
+ Unix
+WXWINDOWS_DEFINITIONS = extra defines
+
+
+
OPTIONS If you need OpenGL support please
+
set(WXWINDOWS_USE_GL 1)
+
+
+
in your CMakeLists.txt before you include this file.
+
HAVE_ISYSTEM - true required to replace -I by -isystem on g++
+
+
+
For convenience include Use_wxWindows.cmake in your project's
+CMakeLists.txt using
+include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
Module subroutines and functions (declared by "MODULE PROCEDURE").
+
+
+
This module also provides the following variables to specify
+the detected mangling, though a typical use case does not need
+to reference them and can use the Module Functions below.
+
+
FortranCInterface_GLOBAL_PREFIX
Prefix for a global symbol without an underscore.
+
+
FortranCInterface_GLOBAL_SUFFIX
Suffix for a global symbol without an underscore.
+
+
FortranCInterface_GLOBAL_CASE
The case for a global symbol without an underscore,
+either UPPER or LOWER.
+
+
FortranCInterface_GLOBAL__PREFIX
Prefix for a global symbol with an underscore.
+
+
FortranCInterface_GLOBAL__SUFFIX
Suffix for a global symbol with an underscore.
+
+
FortranCInterface_GLOBAL__CASE
The case for a global symbol with an underscore,
+either UPPER or LOWER.
+
+
FortranCInterface_MODULE_PREFIX
Prefix for a module symbol without an underscore.
+
+
FortranCInterface_MODULE_MIDDLE
Middle of a module symbol without an underscore that appears
+between the name of the module and the name of the symbol.
+
+
FortranCInterface_MODULE_SUFFIX
Suffix for a module symbol without an underscore.
+
+
FortranCInterface_MODULE_CASE
The case for a module symbol without an underscore,
+either UPPER or LOWER.
+
+
FortranCInterface_MODULE__PREFIX
Prefix for a module symbol with an underscore.
+
+
FortranCInterface_MODULE__MIDDLE
Middle of a module symbol with an underscore that appears
+between the name of the module and the name of the symbol.
+
+
FortranCInterface_MODULE__SUFFIX
Suffix for a module symbol with an underscore.
+
+
FortranCInterface_MODULE__CASE
The case for a module symbol with an underscore,
+either UPPER or LOWER.
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.
This creates a "FCMangle.h" header that defines the same FC_*()
+mangling macros as the previous example plus preprocessor symbols
+FC_mysub and FC_mymod_my_sub.
FortranCInterface is aware of possible GLOBAL and MODULE manglings
+for many Fortran compilers, but it also provides an interface to specify
+new possible manglings. Set the variables:
tells FortranCInterface to try given GLOBAL and MODULE manglings.
+(The carets point at raw symbol names for clarity in this example but
+are not needed.)
Inclusion of this module defines the following variables:
+
CMAKE_INSTALL_<dir>
+
+
Destination for files of a given type. This value may be passed to
+the DESTINATION options of install() commands for the
+corresponding file type. It should typically be a path relative to
+the installation prefix so that it can be converted to an absolute
+path in a relocatable way (see CMAKE_INSTALL_FULL_<dir>).
+However, an absolute path is also allowed.
+
+
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
+
New in version 3.9: run-time variable data (LOCALSTATEDIR/run)
+
+
+
LIBDIR
object code libraries (lib or lib64)
+
On Debian, this may be lib/<multiarch-tuple> when
+CMAKE_INSTALL_PREFIX is /usr.
+
+
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.
+
This behavior does not apply to paths under /opt/homebrew/....
GNUInstallDirs_get_absolute_install_dir(absvar var dirname)
+
+
+
+
New in version 3.7.
+
+
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. dirname is
+the directory name to get, e.g. BINDIR.
+
+
Changed in version 3.20: Added the <dirname> parameter. Previous versions of CMake passed
+this value through the variable ${dir}.
Changed in version 3.16: The tool specified by CMAKE_OBJDUMP will be used, if set.
+
+
The following functions are provided by this module:
+
get_prerequisites
+list_prerequisites
+list_prerequisites_by_glob
+gp_append_unique
+is_file_executable
+gp_item_default_embedded_path
+ (projects can override with gp_item_default_embedded_path_override)
+gp_resolve_item
+ (projects can override with gp_resolve_item_override)
+gp_resolved_file_type
+ (projects can override with gp_resolved_file_type_override)
+gp_file_type
+
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 replacement 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...
+
+
New in version 3.14: The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
+output.
Print a message listing the prerequisites of <target>.
+
<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 information will be displayed.
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.
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
+
New in version 3.6.
+
+
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.
+
+
New in version 3.9: 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
+
New in version 3.3.
+
+
Specify the install(PROGRAMS) command COMPONENT
+option. If not specified, no such option will be used.
+
+
+
+
New in version 3.10: Support for installing Intel compiler runtimes.
Determine the number of processors/cores and save value in ${var}
+
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, Linux, macOS, QNX, Sun and
+Windows.
+
+
Changed in version 3.15: On Linux, returns the container CPU count instead of the host CPU count.
+
+
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.
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.
Changed in version 3.20: This module was previously documented by mistake and was never meant for
+direct inclusion by project code. See the UseJava module.
Changed in version 3.20: This module was previously documented by mistake and was never meant for
+direct inclusion by project code. See the UseJava module.
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
Deprecated since version 2.8.10: Use find_package(wxWidgets) and include(${wxWidgets_USE_FILE}) instead.
+
+
This convenience include finds if wxWindows is installed and set the
+appropriate libs, incdirs, flags etc. author Jan Woetzel <jw -at-
+mip.informatik.uni-kiel.de> (07/2003)
+
USAGE:
+
just include Use_wxWindows.cmake
+in your projects CMakeLists.txt
+
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.
+
+
+
AUTHOR
+
Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
+
A ;-list of files or directories that will be
+removed as a part of the global clean target. It is useful for
+specifying generated files or directories that are used by multiple targets
+or by CMake itself, or that are generated in ways which cannot be captured as
+outputs or byproducts of custom commands.
+
If an additional clean file is specific to a single target only, then the
+ADDITIONAL_CLEAN_FILES target property would usually be a better
+choice than this directory property.
+
Relative paths are allowed and are interpreted relative to the
+current binary directory.
Set to true to tell Makefile Generators not to remove the outputs of
+custom commands for this directory during the makeclean operation.
+This is ignored on other generators because it is not possible to implement.
Tell CMake about additional input files to the configuration process.
+If any named file is modified the build system will re-run CMake to
+re-configure the file and generate the build system again.
+
Specify files as a semicolon-separated list of paths. Relative paths
+are interpreted as relative to the current source directory.
The COMPILE_DEFINITIONS property may be set to a semicolon-separated
+list of preprocessor definitions using the syntax VAR or VAR=value.
+Function-style definitions are not supported. CMake will
+automatically escape the value correctly for the native build system
+(note that CMake language syntax may require escapes to specify some
+values).
+
This property will be initialized in each directory by its value in the
+directory's parent.
+
CMake will automatically drop some definitions that are not supported
+by the native build tool.
+
+
New in version 3.26: Any leading -D on an item will be removed.
+
+
Disclaimer: Most native build tools have poor support for escaping
+certain values. CMake has work-arounds for many cases but some values
+may just not be possible to pass correctly. If a value does not seem
+to be escaped correctly, do not attempt to work-around the problem by
+adding escape sequences to the value. Your work-around may break in a
+future version of CMake that has improved escape support. Instead
+consider defining the macro in a (configured) header file. Then
+report the limitation. Known limitations include:
+
# - broken almost everywhere
+; - broken in VS IDE 7.0 and Borland Makefiles
+, - broken in VS IDE
+% - broken in some cases in NMake
+& | - broken in some cases on MinGW
+^ < > \" - broken in most Make tools on Windows
+
+
+
CMake does not reject these values outright because they do work in
+some cases. Use with caution.
+
Contents of COMPILE_DEFINITIONS may use "generator expressions" with
+the syntax $<...>. See the cmake-generator-expressions(7)
+manual for available expressions. See the cmake-buildsystem(7)
+manual for more on defining buildsystem properties.
+
The corresponding COMPILE_DEFINITIONS_<CONFIG> property may
+be set to specify per-configuration definitions. Generator expressions
+should be preferred instead of setting the alternative property.
Per-configuration preprocessor definitions in a directory.
+
This is the configuration-specific version of COMPILE_DEFINITIONS
+where <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).
+
This property will be initialized in each directory by its value in
+the directory's parent.
+
Contents of COMPILE_DEFINITIONS_<CONFIG> may use "generator expressions"
+with the syntax $<...>. See the cmake-generator-expressions(7)
+manual for available expressions. See the cmake-buildsystem(7)
+manual for more on defining buildsystem properties.
+
Generator expressions should be preferred instead of setting this property.
This property is used to initialize the COMPILE_OPTIONS target
+property when a target is created, which is used by the generators to set
+the options for the compiler.
+
Contents of COMPILE_OPTIONS may use "generator expressions" with the
+syntax $<...>. See the cmake-generator-expressions(7) manual
+for available expressions. See the cmake-buildsystem(7) manual
+for more on defining buildsystem properties.
This read-only property specifies the list of flags given so far to
+the add_definitions() command. It is intended for debugging
+purposes. Use the COMPILE_DEFINITIONS directory property
+instead.
+
This built-in read-only property does not exist if policy
+CMP0059 is set to NEW.
Set this directory property to a true value on a subdirectory to exclude
+its targets from the "all" target of its ancestors. If excluded, running
+e.g. make in the parent directory will not build targets the
+subdirectory by default. This does not affect the "all" target of the
+subdirectory itself. Running e.g. make inside the subdirectory will
+still build its targets.
+
If the EXCLUDE_FROM_ALL target property is set on a target
+then its value determines whether the target is included in the "all"
+target of this directory and its ancestors.
Specify #include line transforms for dependencies in a directory.
+
This property specifies rules to transform macro-like #include lines
+during implicit dependency scanning of C and C++ source files. The
+list of rules must be semicolon-separated with each entry of the form
+A_MACRO(%)=value-with-% (the % must be literal). During dependency
+scanning occurrences of A_MACRO(...) on #include lines will be
+replaced by the value given with the macro argument substituted for
+%. For example, the entry
+
MYDIR(%)=<mydir/%>
+
+
+
will convert lines of the form
+
#include MYDIR(myheader.h)
+
+
+
to
+
#include <mydir/myheader.h>
+
+
+
allowing the dependency to be followed.
+
This property applies to sources in all targets within a directory.
+The property value is initialized in each directory by its value in
+the directory's parent.
List of preprocessor include file search directories.
+
This property specifies the list of directories given so far to the
+include_directories() command.
+
This property is used to populate the INCLUDE_DIRECTORIES
+target property, which is used by the generators to set the include
+directories for the compiler.
+
In addition to accepting values from that command, values may be set
+directly on any directory using the set_property() command, and can be
+set on the current directory using the set_directory_properties()
+command. A directory gets its initial value from its parent directory if it has
+one. The initial value of the INCLUDE_DIRECTORIES target property
+comes from the value of this property. Both directory and target property
+values are adjusted by calls to the include_directories() command.
+Calls to set_property() or set_directory_properties(),
+however, will update the directory property value without updating target
+property values. Therefore direct property updates must be made before
+calls to add_executable() or add_library() for targets
+they are meant to affect.
+
The target property values are used by the generators to set the
+include paths for the compiler.
+
Contents of INCLUDE_DIRECTORIES may use "generator expressions" with
+the syntax $<...>. See the cmake-generator-expressions(7)
+manual for available expressions. See the cmake-buildsystem(7)
+manual for more on defining buildsystem properties.
This property specifies the regular expression used during
+dependency scanning to match include files that should be followed.
+See the include_regular_expression() command for a high-level
+interface to set this property.
Specify a list of text labels associated with a directory and all of its
+subdirectories. This is equivalent to setting the LABELS target
+property and the LABELS test property on all targets and tests in
+the current directory and subdirectories. Note: Launchers must enabled to
+propagate labels to targets.
This property holds a semicolon-separated list of directories
+and is typically populated using the link_directories() command.
+It gets its initial value from its parent directory, if it has one.
+
The directory property is used to initialize the LINK_DIRECTORIES
+target property when a target is created. That target property is used
+by the generators to set the library search directories for the linker.
+
Contents of LINK_DIRECTORIES may use "generator expressions" with
+the syntax $<...>. See the cmake-generator-expressions(7)
+manual for available expressions. See the cmake-buildsystem(7)
+manual for more on defining buildsystem properties.
This property is used to initialize the LINK_OPTIONS target
+property when a target is created, which is used by the generators to set
+the options for the compiler.
+
Contents of LINK_OPTIONS may use "generator expressions" with the
+syntax $<...>. See the cmake-generator-expressions(7) manual
+for available expressions. See the cmake-buildsystem(7) manual
+for more on defining buildsystem properties.
This property is mainly useful when trying to debug errors in your
+CMake scripts. It returns a list of what list files are currently
+being processed, in order. So if one listfile does an
+include() command then that is effectively pushing the
+included listfile onto the stack.
This read-only property specifies the source directory that added the
+current source directory as a subdirectory of the build. In the
+top-level directory the value is the empty-string.
This read-only directory property contains a
+semicolon-separated list of subdirectories processed so far by
+the add_subdirectory() or subdirs() commands. Each entry is
+the absolute path to the source directory (containing the CMakeLists.txt
+file). This is suitable to pass to the get_property() command
+DIRECTORY option.
+
+
Note
+
The subdirs() command does not process its arguments until
+after the calling directory is fully processed. Therefore looking
+up this property in the current directory will not see them.
This directory property is used to initialize the SYSTEM
+target property for non-imported targets created in that directory.
+It is set to true by add_subdirectory() and
+FetchContent_Declare() when the SYSTEM option is given
+as an argument to those commands.
Specify a postSolution global section in Visual Studio.
+
Setting a property like this generates an entry of the following form
+in the solution file:
+
GlobalSection(<section>) = postSolution
+ <contents based on property value>
+EndGlobalSection
+
+
+
The property must be set to a semicolon-separated list of key=value
+pairs. Each such pair will be transformed into an entry in the
+solution global section. Whitespace around key and value is ignored.
+List elements which do not contain an equal sign are skipped.
+
This property only works for Visual Studio 9 and above; it is ignored
+on other generators. The property only applies when set on a
+directory whose CMakeLists.txt contains a project() command.
+
Note that CMake generates postSolution sections ExtensibilityGlobals
+and ExtensibilityAddIns by default. If you set the corresponding
+property, it will override the default section. For example, setting
+VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default
+contents of the ExtensibilityGlobals section, while keeping
+ExtensibilityAddIns on its default. However, CMake will always
+add a SolutionGuid to the ExtensibilityGlobals section
+if it is not specified explicitly.
Specify a preSolution global section in Visual Studio.
+
Setting a property like this generates an entry of the following form
+in the solution file:
+
GlobalSection(<section>) = preSolution
+ <contents based on property value>
+EndGlobalSection
+
+
+
The property must be set to a semicolon-separated list of key=value
+pairs. Each such pair will be transformed into an entry in the
+solution global section. Whitespace around key and value is ignored.
+List elements which do not contain an equal sign are skipped.
+
This property only works for Visual Studio 9 and above; it is ignored
+on other generators. The property only applies when set on a
+directory whose CMakeLists.txt contains a project() command.
Specify the default startup project in a Visual Studio solution.
+
The Visual Studio Generators create a .sln file for each directory
+whose CMakeLists.txt file calls the project() command. Set this
+property in the same directory as a project() command call (e.g. in
+the top-level CMakeLists.txt file) to specify the default startup project
+for the corresponding solution file.
+
The property must be set to the name of an existing target. This
+will cause that project to be listed first in the generated solution
+file causing Visual Studio to make it the startup project if the
+solution has never been opened before.
+
If this property is not specified, then the ALL_BUILD project
+will be the default.
This property describes the cost of a test. When parallel testing is
+enabled, tests in the test set will be run in descending order of cost.
+Projects can explicitly define the cost of a test by setting this property
+to a floating point value.
+
When the cost of a test is not defined by the project,
+ctest will initially use a default cost of 0.
+It computes a weighted average of the cost each time a test is run and
+uses that as an improved estimate of the cost for the next run. The more
+a test is re-run in the same build directory, the more representative the
+cost should become.
Specifies that this test should only be run after the specified list of tests.
+
Set this to a list of tests that must finish before this test is run. The
+results of those tests are not considered, the dependency relationship is
+purely for order of execution (i.e. it is really just a run after
+relationship). Consider using test fixtures with setup tests if a dependency
+with successful completion is required (see FIXTURES_REQUIRED).
add_test(NAMEbaseTest1...)
+add_test(NAMEbaseTest2...)
+add_test(NAMEdependsTest12...)
+
+set_tests_properties(dependsTest12PROPERTIESDEPENDS"baseTest1;baseTest2")
+# dependsTest12 runs after baseTest1 and baseTest2, even if they fail
+
If set to True, the test will be skipped and its status will be 'Not Run'. A
+DISABLED test will not be counted in the total number of tests and its
+completion status will be reported to CDash as Disabled.
+
A DISABLED test does not participate in test fixture dependency resolution.
+If a DISABLED test has fixture requirements defined in its
+FIXTURES_REQUIRED property, it will not cause setup or cleanup
+tests for those fixtures to be added to the test set.
+
If a test with the FIXTURES_SETUP property set is DISABLED,
+the fixture behavior will be as though that setup test was passing and any test
+case requiring that fixture will still run.
Specify environment variables that should be defined for running a test.
+
Set to a semicolon-separated list list
+of environment variables and values of the form MYVAR=value.
+Those environment variables will be defined while running the test.
+The environment changes from this property do not affect other tests.
Specify environment variables that should be modified for running a test. Note
+that the operations performed by this property are performed after the
+ENVIRONMENT property is already applied.
+
Set to a semicolon-separated list of
+environment variables and values of the form MYVAR=OP:VALUE,
+where MYVAR is the case-sensitive name of an environment variable
+to be modified. Entries are considered in the order specified in the
+property's value. The OP may be one of:
+
+
+
reset: Reset to the unmodified value, ignoring all modifications to
+MYVAR prior to this entry. Note that this will reset the variable to
+the value set by ENVIRONMENT, if it was set, and otherwise
+to its state from the rest of the CTest execution.
+
set: Replaces the current value of MYVAR with VALUE.
+
unset: Unsets the current value of MYVAR.
+
string_append: Appends singular VALUE to the current value of
+MYVAR.
+
string_prepend: Prepends singular VALUE to the current value of
+MYVAR.
+
path_list_append: Appends singular VALUE to the current value of
+MYVAR using the host platform's path list separator (; on Windows
+and : elsewhere).
+
path_list_prepend: Prepends singular VALUE to the current value of
+MYVAR using the host platform's path list separator (; on Windows
+and : elsewhere).
+
cmake_list_append: Appends singular VALUE to the current value of
+MYVAR using ; as the separator.
+
cmake_list_prepend: Prepends singular VALUE to the current value of
+MYVAR using ; as the separator.
+
+
+
Unrecognized OP values will result in the test failing before it is
+executed. This is so that future operations may be added without changing
+valid behavior of existing tests.
+
The environment changes from this property do not affect other tests.
Specifies a list of fixtures for which the test is to be treated as a cleanup
+test. These fixture names are distinct from test case names and are not
+required to have any similarity to the names of tests associated with them.
+
Fixture cleanup tests are ordinary tests with all of the usual test
+functionality. Setting the FIXTURES_CLEANUP property for a test has two
+primary effects:
+
+
CTest will ensure the test executes after all other tests which list any of
+the fixtures in its FIXTURES_REQUIRED property.
+
If CTest is asked to run only a subset of tests (e.g. using regular
+expressions or the --rerun-failed option) and the cleanup test is not in
+the set of tests to run, it will automatically be added if any tests in the
+set require any fixture listed in FIXTURES_CLEANUP.
+
+
A cleanup test can have multiple fixtures listed in its FIXTURES_CLEANUP
+property. It will execute only once for the whole CTest run, not once for each
+fixture. A fixture can also have more than one cleanup test defined. If there
+are multiple cleanup tests for a fixture, projects can control their order with
+the usual DEPENDS test property if necessary.
+
A cleanup test is allowed to require other fixtures, but not any fixture listed
+in its FIXTURES_CLEANUP property. For example:
+
# Ok: Dependent fixture is different to cleanup
+set_tests_properties(cleanupFooPROPERTIES
+FIXTURES_CLEANUPFoo
+FIXTURES_REQUIREDBar
+)
+
+# Error: cannot require same fixture as cleanup
+set_tests_properties(cleanupFooPROPERTIES
+FIXTURES_CLEANUPFoo
+FIXTURES_REQUIREDFoo
+)
+
+
+
Cleanup tests will execute even if setup or regular tests for that fixture fail
+or are skipped.
+
See FIXTURES_REQUIRED for a more complete discussion of how to use
+test fixtures.
Specifies a list of fixtures the test requires. Fixture names are case
+sensitive and they are not required to have any similarity to test names.
+
Fixtures are a way to attach setup and cleanup tasks to a set of tests. If a
+test requires a given fixture, then all tests marked as setup tasks for that
+fixture will be executed first (once for the whole set of tests, not once per
+test requiring the fixture). After all tests requiring a particular fixture
+have completed, CTest will ensure all tests marked as cleanup tasks for that
+fixture are then executed. Tests are marked as setup tasks with the
+FIXTURES_SETUP property and as cleanup tasks with the
+FIXTURES_CLEANUP property. If any of a fixture's setup tests fail,
+all tests listing that fixture in their FIXTURES_REQUIRED property will not
+be executed. The cleanup tests for the fixture will always be executed, even if
+some setup tests fail.
+
When CTest is asked to execute only a subset of tests (e.g. by the use of
+regular expressions or when run with the --rerun-failed
+command line option), it will automatically add any setup or cleanup tests for
+fixtures required by any of the tests that are in the execution set. This
+behavior can be overridden with the -FS,
+-FC and -FA command line options to
+ctest(1) if desired.
+
Since setup and cleanup tasks are also tests, they can have an ordering
+specified by the DEPENDS test property just like any other tests.
+This can be exploited to implement setup or cleanup using multiple tests for a
+single fixture to modularise setup or cleanup logic.
+
The concept of a fixture is different to that of a resource specified by
+RESOURCE_LOCK, but they may be used together. A fixture defines a
+set of tests which share setup and cleanup requirements, whereas a resource
+lock has the effect of ensuring a particular set of tests do not run in
+parallel. Some situations may need both, such as setting up a database,
+serializing test access to that database and deleting the database again at the
+end. For such cases, tests would populate both FIXTURES_REQUIRED and
+RESOURCE_LOCK to combine the two behaviors. Names used for
+RESOURCE_LOCK have no relationship with names of fixtures, so note
+that a resource lock does not imply a fixture and vice versa.
+
Consider the following example which represents a database test scenario
+similar to that mentioned above:
Two fixtures are defined: DB and Foo. Tests can require a single
+fixture as fooOnly and dbOnly do, or they can depend on multiple
+fixtures like dbWithFoo does.
+
A DEPENDS relationship is set up to ensure setupUsers happens after
+createDB, both of which are setup tests for the DB fixture and will
+therefore be executed before the dbOnly and dbWithFoo tests
+automatically.
+
No explicit DEPENDS relationships were needed to make the setup tests run
+before or the cleanup tests run after the regular tests.
+
The Foo fixture has no setup tests defined, only a single cleanup test.
+
testsDone is a cleanup test for both the DB and Foo fixtures.
+Therefore, it will only execute once regular tests for both fixtures have
+finished (i.e. after fooOnly, dbOnly and dbWithFoo). No
+DEPENDS relationship was specified for testsDone, so it is free to
+run before, after or concurrently with other cleanup tests for either
+fixture.
+
The setup and cleanup tests never list the fixtures they are for in their own
+FIXTURES_REQUIRED property, as that would result in a dependency on
+themselves and be considered an error.
Specifies a list of fixtures for which the test is to be treated as a setup
+test. These fixture names are distinct from test case names and are not
+required to have any similarity to the names of tests associated with them.
+
Fixture setup tests are ordinary tests with all of the usual test
+functionality. Setting the FIXTURES_SETUP property for a test has two
+primary effects:
+
+
CTest will ensure the test executes before any other test which lists the
+fixture name(s) in its FIXTURES_REQUIRED property.
+
If CTest is asked to run only a subset of tests (e.g. using regular
+expressions or the --rerun-failed option) and the setup test is not in
+the set of tests to run, it will automatically be added if any tests in the
+set require any fixture listed in FIXTURES_SETUP.
+
+
A setup test can have multiple fixtures listed in its FIXTURES_SETUP
+property. It will execute only once for the whole CTest run, not once for each
+fixture. A fixture can also have more than one setup test defined. If there are
+multiple setup tests for a fixture, projects can control their order with the
+usual DEPENDS test property if necessary.
+
A setup test is allowed to require other fixtures, but not any fixture listed
+in its FIXTURES_SETUP property. For example:
+
# Ok: dependent fixture is different to setup
+set_tests_properties(setupFooPROPERTIES
+FIXTURES_SETUPFoo
+FIXTURES_REQUIREDBar
+)
+
+# Error: cannot require same fixture as setup
+set_tests_properties(setupFooPROPERTIES
+FIXTURES_SETUPFoo
+FIXTURES_REQUIREDFoo
+)
+
+
+
If any of a fixture's setup tests fail, none of the tests listing that fixture
+in its FIXTURES_REQUIRED property will be run. Cleanup tests will,
+however, still be executed.
+
See FIXTURES_REQUIRED for a more complete discussion of how to use
+test fixtures.
Specify a list of text labels associated with a test. The labels are
+reported in both the ctest output summary and in dashboard submissions.
+They can also be used to filter the set of tests to be executed (see the
+ctest-L and ctest-LE options).
+
See Additional Labels for adding labels to a test dynamically during
+test execution.
Specify a CDASH measurement and value to be reported for a test.
+
If set to a name then that name will be reported to CDASH as a named
+measurement with a value of 1. You may also specify a value by
+setting MEASUREMENT to measurement=value.
The output must match this regular expression for the test to pass.
+The process exit code is ignored.
+
If set, the test output will be checked against the specified regular
+expressions and at least one of the regular expressions has to match,
+otherwise the test will fail. Example:
Set to specify how many process slots this test requires.
+If not set, the default is 1 processor.
+
Denotes the number of processors that this test will require. This is
+typically used for MPI tests, and should be used in conjunction with
+the ctest_test()PARALLEL_LEVEL option.
+
This will also be used to display a weighted test timing result in label and
+subproject summaries in the command line output of ctest(1). The wall
+clock time for the test run will be multiplied by this property to give a
+better idea of how much cpu resource CTest allocated for the test.
Set to a true value to ask CTest to launch the test process with CPU affinity
+for a fixed set of processors. If enabled and supported for the current
+platform, CTest will choose a set of processors to place in the CPU affinity
+mask when launching the test process. The number of processors in the set is
+determined by the PROCESSORS test property or the number of
+processors available to CTest, whichever is smaller. The set of processors
+chosen will be disjoint from the processors assigned to other concurrently
+running tests that also have the PROCESSOR_AFFINITY property enabled.
Suppose that test.txt is created by test baseTest and none.txt
+does not exist:
+
add_test(NAMEbaseTest...)# Assumed to create test.txt
+add_test(NAMEfileTest...)
+
+# The following ensures that if baseTest is successful, test.txt will
+# have been created before fileTest is run
+set_tests_properties(fileTestPROPERTIES
+DEPENDSbaseTest
+REQUIRED_FILEStest.txt
+)
+
+add_test(NAMEnotRunTest...)
+
+# The following makes notRunTest depend on two files. Nothing creates
+# the none.txt file, so notRunTest will fail with status "Not Run".
+set_tests_properties(notRunTestPROPERTIES
+REQUIRED_FILES"test.txt;none.txt"
+)
+
+
+
The above example demonstrates how REQUIRED_FILES works, but it is not the
+most robust way to implement test ordering with failure detection. For that,
+test fixtures are a better alternative (see FIXTURES_REQUIRED).
Specify resources required by a test, grouped in a way that is meaningful to
+the test. See resource allocation
+for more information on how this property integrates into the CTest resource
+allocation feature.
+
The RESOURCE_GROUPS property is a semicolon-separated list of group descriptions. Each entry consists of an optional
+number of groups using the description followed by a series of resource
+requirements for those groups. These requirements (and the number of groups)
+are separated by commas. The resource requirements consist of the name of a
+resource type, followed by a colon, followed by an unsigned integer
+specifying the number of slots required on one resource of the given type.
+
The RESOURCE_GROUPS property tells CTest what resources a test expects
+to use grouped in a way meaningful to the test. The test itself must read
+the environment variables to
+determine which resources have been allocated to each group. For example,
+each group may correspond to a process the test will spawn when executed.
In this example, there are two group descriptions (implicitly separated by a
+semicolon.) The content of the first description is 2,gpus:2. This
+description specifies 2 groups, each of which requires 2 slots from a single
+GPU. The content of the second description is gpus:4,crypto_chips:2. This
+description does not specify a group count, so a default of 1 is assumed.
+This single group requires 4 slots from a single GPU and 2 slots from a
+single cryptography chip. In total, 3 resource groups are specified for this
+test, each with its own unique requirements.
+
Note that the number of slots following the resource type specifies slots from
+a single instance of the resource. If the resource group can tolerate
+receiving slots from different instances of the same resource, it can indicate
+this by splitting the specification into multiple requirements of one slot. For
+example:
In this case, the single resource group indicates that it needs four GPU slots,
+all of which may come from separate GPUs (though they don't have to; CTest may
+still assign slots from the same GPU.)
+
When CTest sets the environment variables for a test, it assigns a group number
+based on the group description, starting at 0 on the left and the number of
+groups minus 1 on the right. For example, in the example above, the two
+groups in the first description would have IDs of 0 and 1, and the single
+group in the second description would have an ID of 2.
+
Both the RESOURCE_GROUPS and RESOURCE_LOCK properties serve
+similar purposes, but they are distinct and orthogonal. Resources specified by
+RESOURCE_GROUPS do not affect RESOURCE_LOCK, and vice versa.
+Whereas RESOURCE_LOCK is a simpler property that is used for
+locking one global resource, RESOURCE_GROUPS is a more advanced property
+that allows multiple tests to simultaneously use multiple resources of the
+same type, specifying their requirements in a fine-grained manner.
Specify a list of resources that are locked by this test.
+
If multiple tests specify the same resource lock, they are guaranteed
+not to run concurrently.
+
See also FIXTURES_REQUIRED if the resource requires any setup or
+cleanup steps.
+
Both the RESOURCE_GROUPS and RESOURCE_LOCK properties serve
+similar purposes, but they are distinct and orthogonal. Resources specified by
+RESOURCE_GROUPS do not affect RESOURCE_LOCK, and vice versa.
+Whereas RESOURCE_LOCK is a simpler property that is used for locking one
+global resource, RESOURCE_GROUPS is a more advanced property
+that allows multiple tests to simultaneously use multiple resources of the
+same type, specifying their requirements in a fine-grained manner.
Do not run this test in parallel with any other test.
+
Use this option in conjunction with the ctest_test PARALLEL_LEVEL
+option to specify that this test should not be run in parallel with
+any other tests.
Sometimes only a test itself can determine if all requirements for the
+test are met. If such a situation should not be considered a hard failure
+a return code of the process can be specified that will mark the test as
+NotRun if it is encountered. Valid values are in the range of
+0 to 255, inclusive.
This property if set will limit a test to not take more than the
+specified number of seconds to run. If it exceeds that the test
+process will be killed and ctest will move to the next test. This
+setting takes precedence over CTEST_TEST_TIMEOUT.
+
An explicit 0 value means the test has no timeout, except as
+necessary to honor ctest--stop-time.
Allow a test seconds to complete after regex is encountered in
+its output.
+
When the test outputs a line that matches regex its start time is
+reset to the current time and its timeout duration is changed to
+seconds. Prior to this, the timeout duration is determined by the
+TIMEOUT property or the CTEST_TEST_TIMEOUT
+variable if either of these are set. Because the test's start time is
+reset, its execution time will not include any time that was spent
+waiting for the matching output.
+
TIMEOUT_AFTER_MATCH is useful for avoiding spurious
+timeouts when your test must wait for some system resource to become
+available before it can execute. Set TIMEOUT to a longer
+duration that accounts for resource acquisition and use
+TIMEOUT_AFTER_MATCH to control how long the actual test
+is allowed to run.
+
If the required resource can be controlled by CTest you should use
+RESOURCE_LOCK instead of TIMEOUT_AFTER_MATCH.
+This property should be used when only the test itself can determine
+when its required resources are available.
If the TIMEOUT_SIGNAL_NAME test property is set, this property
+specifies the number of seconds to wait for a test process to terminate after
+sending the custom signal. Otherwise, this property has no meaning.
+
The grace period may be any real value greater than 0.0, but not greater
+than 60.0. If this property is not set, the default is 1.0 second.
+
This is available only on platforms supporting POSIX signals.
+It is not available on Windows.
Specify a custom signal to send to a test process when its timeout is reached.
+This is available only on platforms supporting POSIX signals.
+It is not available on Windows.
+
The name must be one of the following:
+
+
+
SIGINT
Interrupt.
+
+
SIGQUIT
Quit.
+
+
SIGTERM
Terminate.
+
+
SIGUSR1
User defined signal 1.
+
+
SIGUSR2
User defined signal 2.
+
+
+
+
The custom signal is sent to the test process to give it a chance
+to exit gracefully during a grace period:
+
+
If the test process created any children, it is responsible for
+terminating them too.
If the test process does not terminate before the grace period ends,
+ctest(1) will force termination of its entire process tree
+via SIGSTOP and SIGKILL.
If set to true, this will invert the pass/fail flag of the test.
+
This property can be used for tests that are expected to fail and return a
+non-zero return code. Note that system-level test failures such as segmentation
+faults or heap errors will still fail the test even if WILL_FALL is true.
The directory from which the test executable will be called.
+
If this is not set, the test will be run with the working directory set to the
+binary directory associated with where the test was created (i.e. the
+CMAKE_CURRENT_BINARY_DIR for where add_test() was
+called).
Number of parallel moc or uic processes to start when using
+AUTOMOC and AUTOUIC.
+
The custom <origin>_autogen target starts a number of threads of which
+each one parses a source file and on demand starts a moc or uic
+process. AUTOGEN_PARALLEL controls how many parallel threads
+(and therefore moc or uic processes) are started.
+
+
An empty (or unset) value or the string AUTO sets the number of
+threads/processes to the number of physical CPUs on the host system.
+
A positive non zero integer value sets the exact thread/process count.
Should the target be processed with auto-moc (for Qt projects).
+
AUTOMOC is a boolean specifying whether CMake will handle the Qt
+moc preprocessor automatically, i.e. without having to use commands like
+QT4_WRAP_CPP(), QT5_WRAP_CPP(), etc.
+Currently, Qt versions 4 to 6 are supported.
+
This property is initialized by the value of the CMAKE_AUTOMOC
+variable if it is set when a target is created.
+
When this property is set ON, CMake will scan the header and
+source files at build time and invoke moc accordingly.
If a Qt macro is found, then the header will be compiled by the moc to the
+output file moc_<base_name>.cpp. The complete output file path is
+described in the section Output file location.
+
The header will be moc compiled again if a file from the additional file
+dependencies changes.
+
Header moc output files moc_<base_name>.cpp can be included in source
+files. In the section Including header moc files in sources there is more
+information on that topic.
If a Qt macro is found, then the C++ source file
+<base>.<source_extension> is expected to as well contain an include
+statement
+
#include<<base>.moc> // or
+#include"<base>.moc"
+
+
+
The source file then will be compiled by the moc to the output file
+<base>.moc. A description of the complete output file path is in section
+Output file location.
+
The source will be moc compiled again if a file from the additional file
+dependencies changes.
A source file can include the moc output file of a header
+<header_base>.<header_extension> by using an include statement of
+the form
+
#include<moc_<header_base>.cpp> // or
+#include"moc_<header_base>.cpp"
+
+
+
If the moc output file of a header is included by a source, it will
+be generated in a different location than if it was not included. This is
+described in the section Output file location.
Where <SOURCE_DIR_CHECKSUM> is a checksum computed from the relative
+parent directory path of the moc input file. This scheme allows to have
+moc input files with the same name in different directories.
+
All not included moc output files will be included automatically by the
+CMake generated file
AUTOMOC enabled targets need to know the Qt major and minor
+version they're working with. The major version usually is provided by the
+INTERFACE_QT_MAJOR_VERSION property of the Qt[456]Core library,
+that the target links to. To find the minor version, CMake builds a list of
+available Qt versions from
+
+
Qt6Core_VERSION_MAJOR and Qt6Core_VERSION_MINOR variables
+(usually set by find_package(Qt6...))
+
Qt6Core_VERSION_MAJOR and Qt6Core_VERSION_MINOR directory properties
+
Qt5Core_VERSION_MAJOR and Qt5Core_VERSION_MINOR variables
+(usually set by find_package(Qt5...))
+
Qt5Core_VERSION_MAJOR and Qt5Core_VERSION_MINOR directory properties
+
QT_VERSION_MAJOR and QT_VERSION_MINOR variables
+(usually set by find_package(Qt4...))
+
QT_VERSION_MAJOR and QT_VERSION_MINOR directory properties
Assumed INTERFACE_QT_MAJOR_VERSION is a valid number, the first
+entry in the list with a matching major version is taken. If no matching major
+version was found, an error is generated.
+If INTERFACE_QT_MAJOR_VERSION is not a valid number, the first
+entry in the list is taken.
+
A find_package(Qt[456]...) call sets the QT/Qt[56]Core_VERSION_MAJOR/MINOR
+variables. If the call is in a different context than the
+add_executable() or add_library() call, e.g. in a function,
+then the version variables might not be available to the AUTOMOC
+enabled target.
+In that case the version variables can be forwarded from the
+find_package(Qt[456]...) calling context to the add_executable()
+or add_library() calling context as directory properties.
+The following Qt5 example demonstrates the procedure.
AUTOMOC_EXECUTABLE:
+The moc executable will be detected automatically, but can be forced to
+a certain binary using this target property.
+
AUTOMOC_MOC_OPTIONS:
+Additional command line options for moc can be set in this target property.
+
AUTOMOC_MACRO_NAMES:
+This list of Qt macro names can be extended to search for additional macros in
+headers and sources.
+
AUTOMOC_DEPEND_FILTERS:
+moc dependency file names can be extracted from headers or sources by
+defining file name filters in this target property.
+
AUTOMOC_COMPILER_PREDEFINES:
+Compiler pre definitions for moc are written to the moc_predefs.h file.
+The generation of this file can be enabled or disabled in this target property.
+
SKIP_AUTOMOC:
+Sources and headers can be excluded from AUTOMOC processing by
+setting this source file property.
+
SKIP_AUTOGEN:
+Source files can be excluded from AUTOMOC,
+AUTOUIC and AUTORCC processing by
+setting this source file property.
+
AUTOGEN_SOURCE_GROUP:
+This global property can be used to group files generated by
+AUTOMOC or AUTORCC together in an IDE, e.g. in MSVS.
CMAKE_GLOBAL_AUTOGEN_TARGET:
+A global autogen target, that depends on all AUTOMOC or
+AUTOUIC generated <ORIGIN>_autogen targets in the project,
+will be generated when this variable is ON.
+
AUTOGEN_PARALLEL:
+This target property controls the number of moc or uic processes to
+start in parallel during builds.
+
See the cmake-qt(7) manual for more information on using CMake
+with Qt.
In this case the Q_OBJECT macro is hidden inside another macro
+called CUSTOM_MACRO. To let CMake know that source files that contain
+CUSTOM_MACRO need to be moc processed, we call:
This property holds additional command line options which will be used when
+uic is executed during the build via AUTOUIC, i.e. it is
+equivalent to the optional OPTIONS argument of the
+qt4_wrap_ui() macro.
+
This property is initialized by the value of the
+CMAKE_AUTOUIC_OPTIONS variable if it is set when a target is
+created, or an empty string otherwise.
+
The options set on the target may be overridden by AUTOUIC_OPTIONS
+set on the .ui source file.
+
This property may use "generator expressions" with the syntax $<...>.
+See the cmake-generator-expressions(7) manual for available
+expressions.
+
See the cmake-qt(7) manual for more information on using CMake
+with Qt.
Per-configuration preprocessor definitions on a target.
+
This is the configuration-specific version of COMPILE_DEFINITIONS
+where <CONFIG> is an upper-case name (ex. COMPILE_DEFINITIONS_DEBUG).
+
Contents of COMPILE_DEFINITIONS_<CONFIG> may use "generator expressions"
+with the syntax $<...>. See the cmake-generator-expressions(7)
+manual for available expressions. See the cmake-buildsystem(7)
+manual for more on defining buildsystem properties.
+
Generator expressions should be preferred instead of setting this property.
Additional flags to use when compiling this target's sources.
+
The COMPILE_FLAGS property sets additional compiler flags used to
+build sources within the target. Use COMPILE_DEFINITIONS
+to pass additional preprocessor definitions.
The CUDA/C++ standard whose features are requested to build this target.
+
This property specifies the CUDA/C++ standard whose features are requested
+to build this target. For some compilers, this results in adding a
+flag such as -std=gnu++11 to the compile line.
+
Supported values are:
+
+
98
CUDA C++98. Note that this maps to the same as 03 internally.
+
+
03
CUDA C++03
+
+
11
CUDA C++11
+
+
14
CUDA C++14. While CMake 3.8 and later recognize14 as a valid value,
+CMake 3.9 was the first version to include support for any compiler.
+
+
17
CUDA C++17. While CMake 3.8 and later recognize17 as a valid value,
+CMake 3.18 was the first version to include support for any compiler.
+
+
20
+
New in version 3.12.
+
+
CUDA C++20. While CMake 3.12 and later recognize20 as a valid value,
+CMake 3.18 was the first version to include support for any compiler.
+
+
23
+
New in version 3.20.
+
+
CUDA C++23
+
+
26
+
New in version 3.25.
+
+
CUDA C++26. CMake 3.25 and later recognize26 as a valid value,
+no version has support for any compiler.
+
+
+
If the value requested does not result in a compile flag being added for
+the compiler in use, a previous standard flag will be added instead. This
+means that using:
+
set_property(TARGETtgtPROPERTYCUDA_STANDARD11)
+
+
+
with a compiler which does not support -std=gnu++11 or an equivalent
+flag will not result in an error or warning, but will instead add the
+-std=gnu++03 flag if supported. This "decay" behavior may be controlled
+with the CUDA_STANDARD_REQUIRED target property.
+Additionally, the CUDA_EXTENSIONS target property may be used to
+control whether compiler-specific extensions are enabled on a per-target basis.
+
See the cmake-compile-features(7) manual for information on
+compile features and a list of supported compilers.
+
This property is initialized by the value of
+the CMAKE_CUDA_STANDARD variable if it is set when a target
+is created.
Boolean specifying whether compiler specific extensions are requested.
+
This property specifies whether compiler specific extensions should be
+used. For some compilers, this results in adding a flag such
+as -std=gnu11 instead of -std=c11 to the compile line. This
+property is ON by default. The basic C standard level is
+controlled by the C_STANDARD target property.
+
See the cmake-compile-features(7) manual for information on
+compile features and a list of supported compilers.
Control whether the Fortran source file should be unconditionally
+preprocessed.
+
If unset or empty, rely on the compiler to determine whether the file
+should be preprocessed. If explicitly set to OFF then the file does not
+need to be preprocessed. If explicitly set to ON, then the file does
+need to be preprocessed as part of the compilation step.
+
When using the Ninja generator, all source files are
+first preprocessed in order to generate module dependency
+information. Setting this property to OFF will make Ninja
+skip this step.
+
Use the source-specific Fortran_PREPROCESS property if a single
+file needs to be preprocessed. If the variable
+CMAKE_Fortran_PREPROCESS is set when a target is created its
+value is used to initialize this property.
+
+
Note
+
For some compilers, NAG, PGI and SolarisStudio,
+setting this to OFF will have no effect.
The HIP/C++ standard requested to build this target.
+
Supported values are:
+
+
98
HIP C++98
+
+
11
HIP C++11
+
+
14
HIP C++14
+
+
17
HIP C++17
+
+
20
HIP C++20
+
+
23
HIP C++23
+
+
26
+
New in version 3.25.
+
+
HIP C++26. CMake 3.25 and later recognize26 as a valid value,
+no version has support for any compiler.
+
+
+
If the value requested does not result in a compile flag being added for
+the compiler in use, a previous standard flag will be added instead. This
+means that using:
+
set_property(TARGETtgtPROPERTYHIP_STANDARD11)
+
+
+
with a compiler which does not support -std=gnu++11 or an equivalent
+flag will not result in an error or warning, but will instead add the
+-std=gnu++98 flag if supported. This "decay" behavior may be controlled
+with the HIP_STANDARD_REQUIRED target property.
+Additionally, the HIP_EXTENSIONS target property may be used to
+control whether compiler-specific extensions are enabled on a per-target basis.
+
See the cmake-compile-features(7) manual for information on
+compile features and a list of supported compilers.
+
This property is initialized by the value of
+the CMAKE_HIP_STANDARD variable if it is set when a target
+is created.
Directory name for installed targets on Apple platforms.
+
INSTALL_NAME_DIR is a string specifying the directory portion of the
+"install_name" field of shared libraries on Apple platforms for
+installed targets. When not set, the default directory used is determined
+by MACOSX_RPATH. If the BUILD_WITH_INSTALL_NAME_DIR
+property is set, this will be used already in the build tree.
+Policies CMP0068 and CMP0042 are also relevant.
+
This property is initialized by the value of the variable
+CMAKE_INSTALL_NAME_DIR if it is set when a target is
+created.
+
This property supports generatorexpressions.
+In particular, the $<INSTALL_PREFIX> generator expression can be
+used to set the directory relative to the install-time prefix.
+
On platforms that support runtime paths (RPATH), refer to the
+INSTALL_RPATH target property.
+Under Windows, the TARGET_RUNTIME_DLLS generator expression is related.
This property is implemented only when <LANG> is C, CXX,
+OBJC, or OBJCXX
+
Specify a semicolon-separated list containing a
+command line for a linker launching tool. The Makefile Generators and the
+Ninja generator will run this tool and pass the linker and its
+arguments to the tool. This is useful for tools such as static analyzers.
+
This property is initialized by the value of the
+CMAKE_<LANG>_LINKER_LAUNCHER variable if it is set when a target is
+created.
Additional flags to use when linking this target if it is a shared library,
+module library, or an executable. Static libraries need to use
+STATIC_LIBRARY_OPTIONS or STATIC_LIBRARY_FLAGS
+properties.
+
The LINK_FLAGS property, managed as a string, can be used to add extra
+flags to the link step of a target. LINK_FLAGS_<CONFIG> will add
+to the configuration <CONFIG>, for example, DEBUG, RELEASE,
+MINSIZEREL, RELWITHDEBINFO, ...
+
+
Note
+
This property has been superseded by LINK_OPTIONS property.
Enforce that link items that can be target names are actually existing targets.
+
Set this property to a true value to enable additional checks on the contents
+of the LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES
+target properties, typically populated by target_link_libraries().
+Checks are also applied to libraries added to a target through the
+INTERFACE_LINK_LIBRARIES_DIRECT properties of its dependencies.
+CMake will verify that link items that might be target names actually name
+existing targets. An item is considered a possible target name if:
+
+
it does not contain a / or \, and
+
it does not start in -, and
+
(for historical reasons) it does not start in $ or `.
+
+
This property is initialized by the value of the
+CMAKE_LINK_LIBRARIES_ONLY_TARGETS variable when a non-imported
+target is created. The property may be explicitly enabled on an imported
+target to check its link interface.
+
In the following example, CMake will halt with an error at configure time
+because miLib is not a target:
+
set(CMAKE_LINK_LIBRARIES_ONLY_TARGETSON)
+add_library(myLibSTATICmyLib.c)
+add_executable(myExemyExe.c)
+target_link_libraries(myExePRIVATEmiLib)# typo for myLib
+
+
+
In order to link toolchain-provided libraries by name while still
+enforcing LINK_LIBRARIES_ONLY_TARGETS, use an
+imported
+Interface Library with the
+IMPORTED_LIBNAME target property:
If INTERFACE_LINK_LIBRARIES contains generator expressions,
+its actual list of link items may depend on the type and properties of
+the consuming target. In such cases CMake may not always detect names
+of missing targets that only appear for specific consumers.
+A future version of CMake with improved heuristics may start triggering
+errors on projects accepted by previous versions of CMake.
Override the library feature associated with <LIBRARY> from
+LINK_LIBRARY generator expressions. This can be used to resolve
+incompatible library features that result from specifying different features
+for <LIBRARY> in different LINK_LIBRARY generator expressions.
+
When set on a target, this property holds a single library feature name, which
+will be applied to <LIBRARY> when linking that target.
+
add_library(lib1...)
+add_library(lib2...)
+add_library(lib3...)
+
+target_link_libraries(lib1PUBLIC"$<LINK_LIBRARY:feature1,external>")
+target_link_libraries(lib2PUBLIC"$<LINK_LIBRARY:feature2,lib1>")
+target_link_libraries(lib3PRIVATElib1lib2)
+
+# lib1 is associated with both feature2 and no feature. Without any override,
+# this would result in a fatal error at generation time for lib3.
+# Define an override to resolve the incompatible feature associations.
+set_property(TARGETlib3PROPERTYLINK_LIBRARY_OVERRIDE_lib1feature2)
+
+# lib1 will now be associated with feature2 instead when linking lib3
+
+
+
It is also possible to override any feature with the pre-defined DEFAULT
+library feature. This effectively discards any feature for that link item,
+for that target only (lib3 in this example):
+
# When linking lib3, discard any library feature for lib1
+set_property(TARGETlib3PROPERTYLINK_LIBRARY_OVERRIDE_lib1DEFAULT)
+
+
+
See the LINK_LIBRARY_OVERRIDE target property for an alternative
+way of overriding library features for multiple libraries at once. If both
+properties are defined and specify an override for the same link item,
+LINK_LIBRARY_OVERRIDE_<LIBRARY> takes precedence over
+LINK_LIBRARY_OVERRIDE.
End a link line such that static system libraries are used.
+
Some linkers support switches such as -Bstatic and -Bdynamic to
+determine whether to use static or shared libraries for -lXXX options.
+CMake uses these options to set the link type for libraries whose full
+paths are not known or (in some cases) are in implicit link
+directories for the platform. By default CMake adds an option at the
+end of the library list (if necessary) to set the linker search type
+back to its starting type. This property switches the final linker
+search type to -Bstatic regardless of how it started.
+
This property is initialized by the value of the variable
+CMAKE_LINK_SEARCH_END_STATIC if it is set
+when a target is created.
Read-only property providing a target location on disk.
+
A read-only property that indicates where a target's main file is
+located on disk for the configuration <CONFIG>. The property is
+defined only for library and executable targets. An imported target
+may provide a set of configurations different from that of the
+importing project. By default CMake looks for an exact-match but
+otherwise uses an arbitrary available configuration. Use the
+MAP_IMPORTED_CONFIG_<CONFIG> property to map imported
+configurations explicitly.
+
Do not set properties that affect the location of a target after
+reading this property. These include properties whose names match
+(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?,
+(IMPLIB_)?(PREFIX|SUFFIX), or LINKER_LANGUAGE.
+Failure to follow this rule is not diagnosed and leaves
+the location of the target undefined.
Select the MSVC runtime library for use by compilers targeting the MSVC ABI.
+
The allowed values are:
+
+
MultiThreaded
Compile with -MT or equivalent flag(s) to use a multi-threaded
+statically-linked runtime library.
+
+
MultiThreadedDLL
Compile with -MD or equivalent flag(s) to use a multi-threaded
+dynamically-linked runtime library.
+
+
MultiThreadedDebug
Compile with -MTd or equivalent flag(s) to use a multi-threaded
+statically-linked runtime library.
+
+
MultiThreadedDebugDLL
Compile with -MDd or equivalent flag(s) to use a multi-threaded
+dynamically-linked runtime library.
+
+
+
The value is ignored on compilers not targeting the MSVC ABI, but an
+unsupported value will be rejected as an error when using a compiler
+targeting the MSVC ABI.
+
The value may also be the empty string ("") in which case no runtime
+library selection flag will be added explicitly by CMake. Note that with
+Visual Studio Generators the native build system may choose to
+add its own default runtime library selection flag.
+
Use generatorexpressions to
+support per-configuration specification. For example, the code:
selects for the target foo a multi-threaded statically-linked runtime
+library with or without debug information depending on the configuration.
+
The property is initialized from the value of the
+CMAKE_MSVC_RUNTIME_LIBRARY variable, if it is set.
+If the property is not set, then CMake uses the default value
+MultiThreaded$<$<CONFIG:Debug>:Debug>DLL to select a MSVC runtime library.
+
+
Note
+
This property has effect only when policy CMP0091 is set to NEW
+prior to the first project() or enable_language() command
+that enables a language using a compiler targeting the MSVC ABI.
Boolean specifying whether compiler specific extensions are requested.
+
This property specifies whether compiler specific extensions should be
+used. For some compilers, this results in adding a flag such
+as -std=gnu11 instead of -std=c11 to the compile line. This
+property is ON by default. The basic OBJC standard level is
+controlled by the OBJC_STANDARD target property.
+
If the property is not set, and the project has set the C_EXTENSIONS,
+the value of C_EXTENSIONS is set for OBJC_EXTENSIONS.
+
See the cmake-compile-features(7) manual for information on
+compile features and a list of supported compilers.
Archiver (or MSVC librarian) flags for a static library target.
+Targets that are shared libraries, modules, or executables need to use
+the LINK_OPTIONS or LINK_FLAGS target properties.
+
The STATIC_LIBRARY_FLAGS property, managed as a string, can be used to add
+extra flags to the link step of a static library target.
+STATIC_LIBRARY_FLAGS_<CONFIG> will add to the configuration
+<CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL,
+RELWITHDEBINFO, ...
Code snippet which is included verbatim by the UNITY_BUILD
+feature just after every #include statement in the generated unity
+source files. For example:
Code snippet which is included verbatim by the UNITY_BUILD
+feature just before every #include statement in the generated unity
+source files. For example:
CMake provides different algorithms for selecting which sources are grouped
+together into a bucket. Selection is decided by this property,
+which has the following acceptable values:
+
+
BATCH
When in this mode CMake determines which files are grouped together.
+The UNITY_BUILD_BATCH_SIZE property controls the upper limit on
+how many sources can be combined per unity source file.
When in this mode each target explicitly specifies how to group
+source files. Each source file that has the same
+UNITY_GROUP value will be grouped together. Any sources
+that don't have this property will be compiled individually. The
+UNITY_BUILD_BATCH_SIZE property is ignored when using
+this mode.
Used to verify that all headers in a target's PUBLIC and INTERFACE
+header sets can be included on their own.
+
When this property is set to true, and the target is an object library, static
+library, shared library, interface library, or executable with exports enabled,
+and the target has one or more PUBLIC or INTERFACE header sets, an
+object library target named <target_name>_verify_interface_header_sets is
+created. This verification target has one source file per header in the
+PUBLIC and INTERFACE header sets. Each source file only includes its
+associated header file. The verification target links against the original
+target to get all of its usage requirements. The verification target has its
+EXCLUDE_FROM_ALL and DISABLE_PRECOMPILE_HEADERS
+properties set to true, and its AUTOMOC, AUTORCC,
+AUTOUIC, and UNITY_BUILD properties set to false.
+
If the header's LANGUAGE property is set, the value of that property
+is used to determine the language with which to compile the header file.
+Otherwise, if the target has any C++ sources, the header is compiled as C++.
+Otherwise, if the target has any C sources, the header is compiled as C.
+Otherwise, if C++ is enabled globally, the header is compiled as C++.
+Otherwise, if C is enabled globally, the header is compiled as C. Otherwise,
+the header file is not compiled.
+
If the header's SKIP_LINTING property is set to true, the file is
+not compiled.
+
If any verification targets are created, a top-level target called
+all_verify_interface_header_sets is created which depends on all
+verification targets.
Sets the local debugger working directory for Visual Studio C++ targets.
+The property value may use
+generatorexpressions.
+This is defined in <LocalDebuggerWorkingDirectory> in the Visual Studio
+project file. This property is initialized by the value of the variable
+CMAKE_VS_DEBUGGER_WORKING_DIRECTORY if it is set when a target is
+created.
+
This property only works for Visual Studio 11 2012 and above;
+it is ignored on other generators.
Set the Xcode explicitFileType attribute on its reference to a
+target. CMake computes a default based on target type but
+can be told explicitly with this property.
If enabled, the Xcode generator will generate schema files. These
+are useful to invoke analyze, archive, build-for-testing and test
+actions from the command line.
+
This property is initialized by the value of the variable
+CMAKE_XCODE_GENERATE_SCHEME if it is set when a target
+is created.
+
The following target properties overwrite the default of the
+corresponding settings on the "Diagnostic" tab for each schema file.
+Each of those is initialized by the respective CMAKE_ variable
+at target creation time.