.\" Man page generated from reStructuredText. . .TH "CMAKE-MODULES" "7" "January 04, 2019" "3.13.2" "CMake" .SH NAME cmake-modules \- CMake Modules Reference . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH ALL MODULES .SS AddFileDependencies .sp ADD_FILE_DEPENDENCIES(source_file depend_files...) .sp Adds the given files as dependencies to source_file .SS AndroidTestUtilities .sp Create a test that automatically loads specified data onto an Android device. .SS Introduction .sp 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. .sp For example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C include(AndroidTestUtilities) android_add_test_data( example_setup_test FILES ... LIBS ... DEVICE_TEST_DIR "/data/local/tests/example" DEVICE_OBJECT_STORE "/sdcard/.ExternalData/SHA" ) .ft P .fi .UNINDENT .UNINDENT .sp At build time a test named "example_setup_test" will be created. Run this test on the command line with \fBctest(1)\fP to load the data onto the Android device. .SS Module Functions .INDENT 0.0 .TP .B android_add_test_data .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C android_add_test_data( [FILES ...] [FILES_DEST ] [LIBS ...] [LIBS_DEST ] [DEVICE_OBJECT_STORE ] [DEVICE_TEST_DIR ] [NO_LINK_REGEX ...] ) .ft P .fi .UNINDENT .UNINDENT .sp The \fBandroid_add_test_data\fP 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. .sp This function accepts the following named parameters: .INDENT 7.0 .TP .B \fBFILES ...\fP zero or more files needed for testing .TP .B \fBLIBS ...\fP zero or more libraries needed for testing .TP .B \fBFILES_DEST \fP absolute path where the data files are expected to be .TP .B \fBLIBS_DEST \fP absolute path where the libraries are expected to be .TP .B \fBDEVICE_OBJECT_STORE \fP absolute path to the location where the data is stored on\-device .TP .B \fBDEVICE_TEST_DIR \fP absolute path to the root directory of the on\-device test location .TP .B \fBNO_LINK_REGEX ...\fP list of regex strings matching the names of files that should be copied from the object store to the testing directory .UNINDENT .UNINDENT .SS BundleUtilities .sp Functions to help assemble a standalone bundle application. .sp A collection of CMake utility functions useful for dealing with .app bundles on the Mac and bundle\-like directories on any OS. .sp The following functions are provided by this module: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fixup_bundle copy_and_fixup_bundle verify_app get_bundle_main_executable get_dotapp_dir get_bundle_and_executable get_bundle_all_executables get_item_key get_item_rpaths clear_bundle_keys set_bundle_key_values get_bundle_keys copy_resolved_item_into_bundle copy_resolved_framework_into_bundle fixup_bundle_item verify_bundle_prerequisites verify_bundle_symlinks .ft P .fi .UNINDENT .UNINDENT .sp Requires CMake 2.6 or greater because it uses function, break and PARENT_SCOPE. Also depends on GetPrerequisites.cmake. .sp DO NOT USE THESE FUNCTIONS AT CONFIGURE TIME (from \fBCMakeLists.txt\fP)! Instead, invoke them from an \fBinstall(CODE)\fP or \fBinstall(SCRIPT)\fP rule. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C FIXUP_BUNDLE( ) .ft P .fi .UNINDENT .UNINDENT .sp Fix up a bundle in\-place and make it standalone, such that it can be drag\-n\-drop copied to another machine and run on that machine as long as all of the system libraries are compatible. .sp If you pass plugins to fixup_bundle as the libs parameter, you should install them or copy them into the bundle before calling fixup_bundle. The "libs" parameter is a list of libraries that must be fixed up, but that cannot be determined by otool output analysis. (i.e., plugins) .sp Gather all the keys for all the executables and libraries in a bundle, and then, for each key, copy each prerequisite into the bundle. Then fix each one up according to its own list of prerequisites. .sp Then clear all the keys and call verify_app on the final bundle to ensure that it is truly standalone. .sp As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C COPY_AND_FIXUP_BUNDLE( ) .ft P .fi .UNINDENT .UNINDENT .sp Makes a copy of the bundle at location and then fixes up the new copied bundle in\-place at ... .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VERIFY_APP() .ft P .fi .UNINDENT .UNINDENT .sp Verifies that an application appears valid based on running analysis tools on it. Calls "message(FATAL_ERROR" if the application is not verified. .sp As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_BUNDLE_MAIN_EXECUTABLE( ) .ft P .fi .UNINDENT .UNINDENT .sp The result will be the full path name of the bundle\(aqs main executable file or an "error:" prefixed string if it could not be determined. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_DOTAPP_DIR( ) .ft P .fi .UNINDENT .UNINDENT .sp Returns the nearest parent dir whose name ends with ".app" given the full path to an executable. If there is no such parent dir, then simply return the dir containing the executable. .sp The returned directory may or may not exist. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_BUNDLE_AND_EXECUTABLE( ) .ft P .fi .UNINDENT .UNINDENT .sp Takes either a ".app" directory name or the name of an executable nested inside a ".app" directory and returns the path to the ".app" directory in and the path to its main executable in .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_BUNDLE_ALL_EXECUTABLES( ) .ft P .fi .UNINDENT .UNINDENT .sp Scans the given bundle recursively for all executable files and accumulates them into a variable. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_ITEM_KEY( ) .ft P .fi .UNINDENT .UNINDENT .sp Given a file (item) name, generate a key that should be unique considering the set of libraries that need copying or fixing up to make a bundle standalone. This is essentially the file name including extension with "." replaced by "_" .sp This key is used as a prefix for CMake variables so that we can associate a set of variables with a given item based on its key. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CLEAR_BUNDLE_KEYS() .ft P .fi .UNINDENT .UNINDENT .sp Loop over the list of keys, clearing all the variables associated with each key. After the loop, clear the list of keys itself. .sp Caller of get_bundle_keys should call clear_bundle_keys when done with list of keys. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C SET_BUNDLE_KEY_VALUES( []) .ft P .fi .UNINDENT .UNINDENT .sp Add a key to the list (if necessary) for the given item. If added, also set all the variables associated with that key. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C GET_BUNDLE_KEYS( ) .ft P .fi .UNINDENT .UNINDENT .sp Loop over all the executable and library files within the bundle (and given as extra ) and accumulate a list of keys representing them. Set values associated with each key such that we can loop over all of them and copy prerequisite libs into the bundle and then do appropriate install_name_tool fixups. .sp As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C COPY_RESOLVED_ITEM_INTO_BUNDLE( ) .ft P .fi .UNINDENT .UNINDENT .sp Copy a resolved item into the bundle if necessary. Copy is not necessary if the resolved_item is "the same as" the resolved_embedded_item. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE( ) .ft P .fi .UNINDENT .UNINDENT .sp Copy a resolved framework into the bundle if necessary. Copy is not necessary if the resolved_item is "the same as" the resolved_embedded_item. .sp By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework dylib itself plus the framework Resources directory. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C FIXUP_BUNDLE_ITEM( ) .ft P .fi .UNINDENT .UNINDENT .sp Get the direct/non\-system prerequisites of the resolved embedded item. For each prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to an "@executable_path" style reference.) .sp This function requires that the resolved_embedded_item be "inside" the bundle already. In other words, if you pass plugins to fixup_bundle as the libs parameter, you should install them or copy them into the bundle before calling fixup_bundle. The "libs" parameter is a list of libraries that must be fixed up, but that cannot be determined by otool output analysis. (i.e., plugins) .sp Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value. .sp Accumulate changes in a local variable and make \fIone\fP call to install_name_tool at the end of the function with all the changes at once. .sp If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be marked writable before install_name_tool tries to change them. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VERIFY_BUNDLE_PREREQUISITES( ) .ft P .fi .UNINDENT .UNINDENT .sp Verifies that the sum of all prerequisites of all files inside the bundle are contained within the bundle or are "system" libraries, presumed to exist everywhere. .sp As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VERIFY_BUNDLE_SYMLINKS( ) .ft P .fi .UNINDENT .UNINDENT .sp Verifies that any symlinks found in the bundle point to other files that are already also in the bundle... Anything that points to an external file causes this function to fail the verification. .SS CheckCCompilerFlag .sp Check whether the C compiler supports a given flag. .INDENT 0.0 .TP .B check_c_compiler_flag .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_c_compiler_flag( ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the \fB\fP is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named \fB\fP\&. .UNINDENT .sp This command temporarily sets the \fBCMAKE_REQUIRED_DEFINITIONS\fP variable and calls the \fBcheck_c_source_compiles\fP macro from the \fBCheckCSourceCompiles\fP module. See documentation of that module for a listing of variables that can otherwise modify the build. .sp 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. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Since the \fBtry_compile()\fP command forwards flags from variables like \fBCMAKE_C_FLAGS\fP, unknown flags in such variables may cause a false negative for this check. .UNINDENT .UNINDENT .SS CheckCSourceCompiles .sp Check if given C source compiles and links into an executable. .INDENT 0.0 .TP .B check_c_source_compiles .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_c_source_compiles(code resultVar [FAIL_REGEX regex1 [regex2...]]) .ft P .fi .UNINDENT .UNINDENT .sp Check that the source supplied in \fBcode\fP can be compiled as a C source file and linked as an executable (so it must contain at least a \fBmain()\fP function). The result will be stored in the internal cache variable specified by \fBresultVar\fP, with a boolean true value for success and boolean false for failure. If \fBFAIL_REGEX\fP is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions. .sp The underlying check is performed by the \fBtry_compile()\fP command. The compile and link commands can be influenced by setting any of the following variables prior to calling \fBcheck_c_source_compiles()\fP: .INDENT 7.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP Additional flags to pass to the compiler. Note that the contents of \fBCMAKE_C_FLAGS\fP and its associated configuration\-specific variable are automatically added to the compiler command before the contents of \fBCMAKE_REQUIRED_FLAGS\fP\&. .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP A ;\-list of compiler definitions of the form \fB\-DFOO\fP or \fB\-DFOO=bar\fP\&. A definition for the name specified by \fBresultVar\fP will also be added automatically. .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP A ;\-list of header search paths to pass to the compiler. These will be the only header search paths used by \fBtry_compile()\fP, i.e. the contents of the \fBINCLUDE_DIRECTORIES\fP directory property will be ignored. .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP 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 \fBtry_compile()\fP for further details). .TP .B \fBCMAKE_REQUIRED_QUIET\fP If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. .UNINDENT .sp The check is only performed once, with the result cached in the variable named by \fBresultVar\fP\&. Every subsequent CMake run will re\-use this cached value rather than performing the check again, even if the \fBcode\fP changes. In order to force the check to be re\-evaluated, the variable named by \fBresultVar\fP must be manually removed from the cache. .UNINDENT .SS CheckCSourceRuns .sp Check if given C source compiles and links into an executable and can subsequently be run. .INDENT 0.0 .TP .B check_c_source_runs .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_c_source_runs(code resultVar) .ft P .fi .UNINDENT .UNINDENT .sp Check that the source supplied in \fBcode\fP can be compiled as a C source file, linked as an executable and then run. The \fBcode\fP must contain at least a \fBmain()\fP function. If the code could be built and run successfully, the internal cache variable specified by \fBresultVar\fP 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). .sp The underlying check is performed by the \fBtry_run()\fP command. The compile and link commands can be influenced by setting any of the following variables prior to calling \fBcheck_c_source_runs()\fP: .INDENT 7.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP Additional flags to pass to the compiler. Note that the contents of \fBCMAKE_C_FLAGS\fP and its associated configuration\-specific variable are automatically added to the compiler command before the contents of \fBCMAKE_REQUIRED_FLAGS\fP\&. .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP A ;\-list of compiler definitions of the form \fB\-DFOO\fP or \fB\-DFOO=bar\fP\&. A definition for the name specified by \fBresultVar\fP will also be added automatically. .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP A ;\-list of header search paths to pass to the compiler. These will be the only header search paths used by \fBtry_run()\fP, i.e. the contents of the \fBINCLUDE_DIRECTORIES\fP directory property will be ignored. .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP 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 \fBtry_run()\fP for further details). .TP .B \fBCMAKE_REQUIRED_QUIET\fP If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. .UNINDENT .sp The check is only performed once, with the result cached in the variable named by \fBresultVar\fP\&. Every subsequent CMake run will re\-use this cached value rather than performing the check again, even if the \fBcode\fP changes. In order to force the check to be re\-evaluated, the variable named by \fBresultVar\fP must be manually removed from the cache. .UNINDENT .SS CheckCXXCompilerFlag .sp Check whether the CXX compiler supports a given flag. .INDENT 0.0 .TP .B check_cxx_compiler_flag .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_cxx_compiler_flag( ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the \fB\fP is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named \fB\fP\&. .UNINDENT .sp This command temporarily sets the \fBCMAKE_REQUIRED_DEFINITIONS\fP variable and calls the \fBcheck_cxx_source_compiles\fP macro from the \fBCheckCXXSourceCompiles\fP module. See documentation of that module for a listing of variables that can otherwise modify the build. .sp 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. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Since the \fBtry_compile()\fP command forwards flags from variables like \fBCMAKE_CXX_FLAGS\fP, unknown flags in such variables may cause a false negative for this check. .UNINDENT .UNINDENT .SS CheckCXXSourceCompiles .sp Check if given C++ source compiles and links into an executable. .INDENT 0.0 .TP .B check_cxx_source_compiles .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_cxx_source_compiles(code resultVar [FAIL_REGEX regex1 [regex2...]]) .ft P .fi .UNINDENT .UNINDENT .sp Check that the source supplied in \fBcode\fP can be compiled as a C++ source file and linked as an executable (so it must contain at least a \fBmain()\fP function). The result will be stored in the internal cache variable specified by \fBresultVar\fP, with a boolean true value for success and boolean false for failure. If \fBFAIL_REGEX\fP is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions. .sp The underlying check is performed by the \fBtry_compile()\fP command. The compile and link commands can be influenced by setting any of the following variables prior to calling \fBcheck_cxx_source_compiles()\fP: .INDENT 7.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP Additional flags to pass to the compiler. Note that the contents of \fBCMAKE_CXX_FLAGS\fP and its associated configuration\-specific variable are automatically added to the compiler command before the contents of \fBCMAKE_REQUIRED_FLAGS\fP\&. .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP A ;\-list of compiler definitions of the form \fB\-DFOO\fP or \fB\-DFOO=bar\fP\&. A definition for the name specified by \fBresultVar\fP will also be added automatically. .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP A ;\-list of header search paths to pass to the compiler. These will be the only header search paths used by \fBtry_compile()\fP, i.e. the contents of the \fBINCLUDE_DIRECTORIES\fP directory property will be ignored. .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP 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 \fBtry_compile()\fP for further details). .TP .B \fBCMAKE_REQUIRED_QUIET\fP If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. .UNINDENT .sp The check is only performed once, with the result cached in the variable named by \fBresultVar\fP\&. Every subsequent CMake run will re\-use this cached value rather than performing the check again, even if the \fBcode\fP changes. In order to force the check to be re\-evaluated, the variable named by \fBresultVar\fP must be manually removed from the cache. .UNINDENT .SS CheckCXXSourceRuns .sp Check if given C++ source compiles and links into an executable and can subsequently be run. .INDENT 0.0 .TP .B check_cxx_source_runs .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_cxx_source_runs(code resultVar) .ft P .fi .UNINDENT .UNINDENT .sp Check that the source supplied in \fBcode\fP can be compiled as a C++ source file, linked as an executable and then run. The \fBcode\fP must contain at least a \fBmain()\fP function. If the code could be built and run successfully, the internal cache variable specified by \fBresultVar\fP 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). .sp The underlying check is performed by the \fBtry_run()\fP command. The compile and link commands can be influenced by setting any of the following variables prior to calling \fBcheck_cxx_source_runs()\fP: .INDENT 7.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP Additional flags to pass to the compiler. Note that the contents of \fBCMAKE_CXX_FLAGS\fP and its associated configuration\-specific variable are automatically added to the compiler command before the contents of \fBCMAKE_REQUIRED_FLAGS\fP\&. .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP A ;\-list of compiler definitions of the form \fB\-DFOO\fP or \fB\-DFOO=bar\fP\&. A definition for the name specified by \fBresultVar\fP will also be added automatically. .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP A ;\-list of header search paths to pass to the compiler. These will be the only header search paths used by \fBtry_run()\fP, i.e. the contents of the \fBINCLUDE_DIRECTORIES\fP directory property will be ignored. .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP 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 \fBtry_run()\fP for further details). .TP .B \fBCMAKE_REQUIRED_QUIET\fP If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. .UNINDENT .sp The check is only performed once, with the result cached in the variable named by \fBresultVar\fP\&. Every subsequent CMake run will re\-use this cached value rather than performing the check again, even if the \fBcode\fP changes. In order to force the check to be re\-evaluated, the variable named by \fBresultVar\fP must be manually removed from the cache. .UNINDENT .SS CheckCXXSymbolExists .sp Check if a symbol exists as a function, variable, or macro in C++ .sp CHECK_CXX_SYMBOL_EXISTS( ) .sp Check that the is available after including given header and store the result in a . Specify the list of files in one argument as a semicolon\-separated list. CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as opposed to CHECK_SYMBOL_EXISTS(), which works only for C. .sp If the header files define the symbol as a macro it is considered available and assumed to work. If the header files declare the symbol as a function or variable then the symbol must also be available for linking. If the symbol is a type or enum value it will not be recognized (consider using CheckTypeSize or CheckCSourceCompiles). .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .SS CheckFortranCompilerFlag .sp Check whether the Fortran compiler supports a given flag. .INDENT 0.0 .TP .B check_fortran_compiler_flag .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_fortran_compiler_flag( ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the \fB\fP is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named \fB\fP\&. .UNINDENT .sp This command temporarily sets the \fBCMAKE_REQUIRED_DEFINITIONS\fP variable and calls the \fBcheck_fortran_source_compiles\fP macro from the \fBCheckFortranSourceCompiles\fP module. See documentation of that module for a listing of variables that can otherwise modify the build. .sp 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. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Since the \fBtry_compile()\fP command forwards flags from variables like \fBCMAKE_Fortran_FLAGS\fP, unknown flags in such variables may cause a false negative for this check. .UNINDENT .UNINDENT .SS CheckFortranFunctionExists .sp macro which checks if the Fortran function exists .sp CHECK_FORTRAN_FUNCTION_EXISTS(FUNCTION VARIABLE) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C FUNCTION \- the name of the Fortran function VARIABLE \- variable to store the result Will be created as an internal cache variable. .ft P .fi .UNINDENT .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_LIBRARIES = list of libraries to link .ft P .fi .UNINDENT .UNINDENT .SS CheckFortranSourceCompiles .sp Check if given Fortran source compiles and links into an executable. .INDENT 0.0 .TP .B check_fortran_source_compiles .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_fortran_source_compiles(code resultVar [FAIL_REGEX regex1 [regex2...]] [SRC_EXT ext] ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the source supplied in \fBcode\fP can be compiled as a Fortran source file and linked as an executable (so it must contain at least a \fBPROGRAM\fP entry point). The result will be stored in the internal cache variable specified by \fBresultVar\fP, with a boolean true value for success and boolean false for failure. If \fBFAIL_REGEX\fP is provided, then failure is determined by checking if anything in the output matches any of the specified regular expressions. .sp By default, the test source file will be given a \fB\&.F\fP file extension. The \fBSRC_EXT\fP option can be used to override this with \fB\&.ext\fP instead. .sp The underlying check is performed by the \fBtry_compile()\fP command. The compile and link commands can be influenced by setting any of the following variables prior to calling \fBcheck_fortran_source_compiles()\fP: .INDENT 7.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP Additional flags to pass to the compiler. Note that the contents of \fBCMAKE_Fortran_FLAGS\fP and its associated configuration\-specific variable are automatically added to the compiler command before the contents of \fBCMAKE_REQUIRED_FLAGS\fP\&. .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP A ;\-list of compiler definitions of the form \fB\-DFOO\fP or \fB\-DFOO=bar\fP\&. A definition for the name specified by \fBresultVar\fP will also be added automatically. .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP A ;\-list of header search paths to pass to the compiler. These will be the only header search paths used by \fBtry_compile()\fP, i.e. the contents of the \fBINCLUDE_DIRECTORIES\fP directory property will be ignored. .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP 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 \fBtry_compile()\fP for further details). .TP .B \fBCMAKE_REQUIRED_QUIET\fP If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. .UNINDENT .sp The check is only performed once, with the result cached in the variable named by \fBresultVar\fP\&. Every subsequent CMake run will re\-use this cached value rather than performing the check again, even if the \fBcode\fP changes. In order to force the check to be re\-evaluated, the variable named by \fBresultVar\fP must be manually removed from the cache. .UNINDENT .SS CheckFunctionExists .sp Check if a C function can be linked: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_function_exists( ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the \fB\fP is provided by libraries on the system and store the result in a \fB\fP\&. \fB\fP will be created as an internal cache variable. .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Prefer using \fBCheckSymbolExists\fP instead of this module, for the following reasons: .INDENT 0.0 .IP \(bu 2 \fBcheck_function_exists()\fP can\(aqt detect functions that are inlined in headers or specified as a macro. .IP \(bu 2 \fBcheck_function_exists()\fP can\(aqt detect anything in the 32\-bit versions of the Win32 API, because of a mismatch in calling conventions. .IP \(bu 2 \fBcheck_function_exists()\fP only verifies linking, it does not verify that the function is declared in system headers. .UNINDENT .UNINDENT .UNINDENT .SS CheckIPOSupported .sp Check whether the compiler supports an interprocedural optimization (IPO/LTO). Use this before enabling the \fBINTERPROCEDURAL_OPTIMIZATION\fP target property. .INDENT 0.0 .TP .B check_ipo_supported .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_ipo_supported([RESULT ] [OUTPUT ] [LANGUAGES ...]) .ft P .fi .UNINDENT .UNINDENT .sp Options are: .INDENT 7.0 .TP .B \fBRESULT \fP Set \fB\fP variable to \fBYES\fP if IPO is supported by the compiler and \fBNO\fP otherwise. If this option is not given then the command will issue a fatal error if IPO is not supported. .TP .B \fBOUTPUT \fP Set \fB\fP variable with details about any error. .TP .B \fBLANGUAGES ...\fP Specify languages whose compilers to check. Languages \fBC\fP, \fBCXX\fP, and \fBFortran\fP are supported. .UNINDENT .UNINDENT .sp It makes no sense to use this module when \fBCMP0069\fP is set to \fBOLD\fP so module will return error in this case. See policy \fBCMP0069\fP for details. .SS Examples .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_ipo_supported() # fatal error if IPO is not supported set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # Optional IPO. Do not use IPO if it\(aqs not supported by compiler. check_ipo_supported(RESULT result OUTPUT output) if(result) set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) else() message(WARNING "IPO is not supported: ${output}") endif() .ft P .fi .UNINDENT .UNINDENT .SS CheckIncludeFileCXX .sp Provides a macro to check if a header file can be included in \fBCXX\fP\&. .INDENT 0.0 .TP .B CHECK_INCLUDE_FILE_CXX .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C CHECK_INCLUDE_FILE_CXX( []) .ft P .fi .UNINDENT .UNINDENT .sp Check if the given \fB\fP file may be included in a \fBCXX\fP source file and store the result in an internal cache entry named \fB\fP\&. The optional third argument may be used to add compilation flags to the check (or use \fBCMAKE_REQUIRED_FLAGS\fP below). .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP string of compile command line flags .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP list of macros to define (\-DFOO=bar) .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP list of include directories .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP A list of libraries to link. See policy \fBCMP0075\fP\&. .TP .B \fBCMAKE_REQUIRED_QUIET\fP execute quietly without messages .UNINDENT .sp See modules \fBCheckIncludeFile\fP and \fBCheckIncludeFiles\fP to check for one or more \fBC\fP headers. .SS CheckIncludeFile .sp Provides a macro to check if a header file can be included in \fBC\fP\&. .INDENT 0.0 .TP .B CHECK_INCLUDE_FILE .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C CHECK_INCLUDE_FILE( []) .ft P .fi .UNINDENT .UNINDENT .sp Check if the given \fB\fP file may be included in a \fBC\fP source file and store the result in an internal cache entry named \fB\fP\&. The optional third argument may be used to add compilation flags to the check (or use \fBCMAKE_REQUIRED_FLAGS\fP below). .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP string of compile command line flags .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP list of macros to define (\-DFOO=bar) .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP list of include directories .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP A list of libraries to link. See policy \fBCMP0075\fP\&. .TP .B \fBCMAKE_REQUIRED_QUIET\fP execute quietly without messages .UNINDENT .sp See the \fBCheckIncludeFiles\fP module to check for multiple headers at once. See the \fBCheckIncludeFileCXX\fP module to check for headers using the \fBCXX\fP language. .SS CheckIncludeFiles .sp Provides a macro to check if a list of one or more header files can be included together. .INDENT 0.0 .TP .B CHECK_INCLUDE_FILES .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C CHECK_INCLUDE_FILES("" [LANGUAGE ]) .ft P .fi .UNINDENT .UNINDENT .sp Check if the given \fB\fP list may be included together in a source file and store the result in an internal cache entry named \fB\fP\&. Specify the \fB\fP argument as a ;\-list of header file names. .UNINDENT .sp If LANGUAGE is set, the specified compiler will be used to perform the check. Acceptable values are \fBC\fP and \fBCXX\fP\&. 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. .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP string of compile command line flags .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP list of macros to define (\-DFOO=bar) .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP list of include directories .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP A list of libraries to link. See policy \fBCMP0075\fP\&. .TP .B \fBCMAKE_REQUIRED_QUIET\fP execute quietly without messages .UNINDENT .sp See modules \fBCheckIncludeFile\fP and \fBCheckIncludeFileCXX\fP to check for a single header file in \fBC\fP or \fBCXX\fP languages. .SS CheckLanguage .sp Check if a language can be enabled .sp Usage: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_language() .ft P .fi .UNINDENT .UNINDENT .sp where is a language that may be passed to enable_language() such as "Fortran". If CMAKE__COMPILER is already defined the check does nothing. Otherwise it tries enabling the language in a test project. The result is cached in CMAKE__COMPILER as the compiler that was found, or NOTFOUND if the language cannot be enabled. .sp Example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) else() message(STATUS "No Fortran support") endif() .ft P .fi .UNINDENT .UNINDENT .SS CheckLibraryExists .sp Check if the function exists. .sp CHECK_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C LIBRARY \- the name of the library you are looking for FUNCTION \- the name of the function LOCATION \- location where the library should be found VARIABLE \- variable to store the result Will be created as an internal cache variable. .ft P .fi .UNINDENT .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .SS CheckPrototypeDefinition .sp Check if the prototype we expect is correct. .sp check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C FUNCTION \- The name of the function (used to check if prototype exists) PROTOTYPE\- The prototype to check. RETURN \- The return value of the function. HEADER \- The header files required. VARIABLE \- The variable to store the result. Will be created as an internal cache variable. .ft P .fi .UNINDENT .UNINDENT .sp Example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_prototype_definition(getpwent_r "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)" "NULL" "unistd.h;pwd.h" SOLARIS_GETPWENT_R) .ft P .fi .UNINDENT .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .SS CheckStructHasMember .sp Check if the given struct or class has the specified member variable .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CHECK_STRUCT_HAS_MEMBER(
[LANGUAGE ]) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C \- the name of the struct or class you are interested in \- the member which existence you want to check
\- the header(s) where the prototype should be declared \- variable to store the result \- the compiler to use (C or CXX) .ft P .fi .UNINDENT .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .sp Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC LANGUAGE C) .SS CheckSymbolExists .sp Provides a macro to check if a symbol exists as a function, variable, or macro in \fBC\fP\&. .INDENT 0.0 .TP .B check_symbol_exists .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C check_symbol_exists( ) .ft P .fi .UNINDENT .UNINDENT .sp Check that the \fB\fP is available after including given header \fB\fP and store the result in a \fB\fP\&. Specify the list of files in one argument as a semicolon\-separated list. \fB\fP will be created as an internal cache variable. .UNINDENT .sp If the header files define the symbol as a macro it is considered available and assumed to work. If the header files declare the symbol as a function or variable then the symbol must also be available for linking (so intrinsics may not be detected). If the symbol is a type, enum value, or intrinsic it will not be recognized (consider using \fBCheckTypeSize\fP or \fBCheckCSourceCompiles\fP). If the check needs to be done in C++, consider using \fBCheckCXXSymbolExists\fP instead. .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .TP .B \fBCMAKE_REQUIRED_FLAGS\fP string of compile command line flags .TP .B \fBCMAKE_REQUIRED_DEFINITIONS\fP list of macros to define (\-DFOO=bar) .TP .B \fBCMAKE_REQUIRED_INCLUDES\fP list of include directories .TP .B \fBCMAKE_REQUIRED_LIBRARIES\fP list of libraries to link .TP .B \fBCMAKE_REQUIRED_QUIET\fP execute quietly without messages .UNINDENT .SS CheckTypeSize .sp Check sizeof a type .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY] [LANGUAGE ]) .ft P .fi .UNINDENT .UNINDENT .sp Check if the type exists and determine its size. On return, "HAVE_${VARIABLE}" holds the existence of the type, and "${VARIABLE}" holds one of the following: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C = type has non\-zero size "0" = type has arch\-dependent size (see below) "" = type does not exist .ft P .fi .UNINDENT .UNINDENT .sp Both \fBHAVE_${VARIABLE}\fP and \fB${VARIABLE}\fP will be created as internal cache variables. .sp Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code to define the macro "${VARIABLE}" to the size of the type, or leave the macro undefined if the type does not exist. .sp The variable "${VARIABLE}" may be "0" when CMAKE_OSX_ARCHITECTURES has multiple architectures for building OS X universal binaries. This indicates that the type size varies across architectures. In this case "${VARIABLE}_CODE" contains C preprocessor tests mapping from each architecture macro to the corresponding type size. The list of architecture macros is stored in "${VARIABLE}_KEYS", and the value for each key is stored in "${VARIABLE}\-${KEY}". .sp If the BUILTIN_TYPES_ONLY option is not given, the macro checks for headers , , and , and saves results in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type size check automatically includes the available headers, thus supporting checks of types defined in the headers. .sp If LANGUAGE is set, the specified compiler will be used to perform the check. Acceptable values are C and CXX .sp Despite the name of the macro you may use it to check the size of more complex expressions, too. To check e.g. for the size of a struct member you can do something like this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C check_type_size("((struct something*)0)\->member" SIZEOF_MEMBER) .ft P .fi .UNINDENT .UNINDENT .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include .ft P .fi .UNINDENT .UNINDENT .SS CheckVariableExists .sp Check if the variable exists. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CHECK_VARIABLE_EXISTS(VAR VARIABLE) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VAR \- the name of the variable VARIABLE \- variable to store the result Will be created as an internal cache variable. .ft P .fi .UNINDENT .UNINDENT .sp This macro is only for C variables. .sp The following variables may be set before calling this macro to modify the way the check is run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (\-DFOO=bar) CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages .ft P .fi .UNINDENT .UNINDENT .SS CMakeAddFortranSubdirectory .sp Use MinGW gfortran from VS if a fortran compiler is not found. .sp The \(aqadd_fortran_subdirectory\(aq function adds a subdirectory to a project that contains a fortran only sub\-project. The module will check the current compiler and see if it can support fortran. If no fortran compiler is found and the compiler is MSVC, then this module will find the MinGW gfortran. It will then use an external project to build with the MinGW tools. It will also create imported targets for the libraries created. This will only work if the fortran code is built into a dll, so BUILD_SHARED_LIBS is turned on in the project. In addition the CMAKE_GNUtoMS option is set to on, so that the MS .lib files are created. Usage is as follows: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cmake_add_fortran_subdirectory( # name of subdirectory PROJECT # project name in subdir top CMakeLists.txt ARCHIVE_DIR # dir where project places .lib files RUNTIME_DIR # dir where project places .dll files LIBRARIES ... # names of library targets to import LINK_LIBRARIES # link interface libraries for LIBRARIES [LINK_LIBS ...]... CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake NO_EXTERNAL_INSTALL # skip installation of external project ) .ft P .fi .UNINDENT .UNINDENT .sp 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. .sp Limitations: .sp NO_EXTERNAL_INSTALL is required for forward compatibility with a future version that supports installation of the external project binaries during "make install". .SS CMakeBackwardCompatibilityCXX .sp define a bunch of backwards compatibility variables .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_ANSI_CXXFLAGS \- flag for ansi c++ CMAKE_HAS_ANSI_STRING_STREAM \- has include(TestForANSIStreamHeaders) include(CheckIncludeFileCXX) include(TestForSTDNamespace) include(TestForANSIForScope) .ft P .fi .UNINDENT .UNINDENT .SS CMakeDependentOption .sp Macro to provide an option dependent on other options. .sp This macro presents an option to the user only if a set of other conditions are true. When the option is not presented a default value is used, but any value set by the user is preserved for when the option is presented again. Example invocation: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON "USE_BAR;NOT USE_ZOT" OFF) .ft P .fi .UNINDENT .UNINDENT .sp If USE_BAR is true and USE_ZOT is false, this provides an option called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to OFF. If the status of USE_BAR or USE_ZOT ever changes, any value for the USE_FOO option is saved so that when the option is re\-enabled it retains its old value. .SS CMakeDetermineVSServicePack .sp Deprecated. Do not use. .sp The functionality of this module has been superseded by the \fBCMAKE__COMPILER_VERSION\fP variable that contains the compiler version number. .sp Determine the Visual Studio service pack of the \(aqcl\(aq in use. .sp Usage: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C if(MSVC) include(CMakeDetermineVSServicePack) DetermineVSServicePack( my_service_pack ) if( my_service_pack ) message(STATUS "Detected: ${my_service_pack}") endif() endif() .ft P .fi .UNINDENT .UNINDENT .sp Function DetermineVSServicePack sets the given variable to one of the following values or an empty string if unknown: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C vc80, vc80sp1 vc90, vc90sp1 vc100, vc100sp1 vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4 .ft P .fi .UNINDENT .UNINDENT .SS CMakeExpandImportedTargets .sp Deprecated. Do not use. .sp This module was once needed to expand imported targets to the underlying libraries they reference on disk for use with the \fBtry_compile()\fP and \fBtry_run()\fP commands. These commands now support imported libraries in their \fBLINK_LIBRARIES\fP options (since CMake 2.8.11 for \fBtry_compile()\fP and since CMake 3.2 for \fBtry_run()\fP). .sp This module does not support the policy \fBCMP0022\fP \fBNEW\fP behavior or use of the \fBINTERFACE_LINK_LIBRARIES\fP property because \fBgenerator expressions\fP cannot be evaluated during configuration. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_EXPAND_IMPORTED_TARGETS( LIBRARIES lib1 lib2...libN [CONFIGURATION ]) .ft P .fi .UNINDENT .UNINDENT .sp CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces all imported targets contained in this list with their actual file paths of the referenced libraries on disk, including the libraries from their link interfaces. If a CONFIGURATION is given, it uses the respective configuration of the imported targets if it exists. If no CONFIGURATION is given, it uses the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) .ft P .fi .UNINDENT .UNINDENT .SS CMakeFindDependencyMacro .INDENT 0.0 .TP .B find_dependency The \fBfind_dependency()\fP macro wraps a \fBfind_package()\fP call for a package dependency: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C find_dependency( [...]) .ft P .fi .UNINDENT .UNINDENT .sp It is designed to be used in a Package Configuration File (\fBConfig.cmake\fP). \fBfind_dependency\fP forwards the correct parameters for \fBQUIET\fP and \fBREQUIRED\fP which were passed to the original \fBfind_package()\fP call. Any additional arguments specified are forwarded to \fBfind_package()\fP\&. .sp If the dependency could not be found it sets an informative diagnostic message and calls \fBreturn()\fP to end processing of the calling package configuration file and return to the \fBfind_package()\fP command that loaded it. .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 The call to \fBreturn()\fP makes this macro unsuitable to call from Find Modules\&. .UNINDENT .UNINDENT .UNINDENT .SS CMakeFindFrameworks .sp helper module to find OSX frameworks .sp This module reads hints about search locations from variables: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS \- Extra directories .ft P .fi .UNINDENT .UNINDENT .SS CMakeFindPackageMode .sp This file is executed by cmake when invoked with \-\-find\-package. It expects that the following variables are set using \-D: .INDENT 0.0 .TP .B \fBNAME\fP name of the package .TP .B \fBCOMPILER_ID\fP the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc. .TP .B \fBLANGUAGE\fP language for which the result will be used, i.e. C/CXX/Fortran/ASM .TP .B \fBMODE\fP .INDENT 7.0 .TP .B \fBEXIST\fP only check for existence of the given package .TP .B \fBCOMPILE\fP print the flags needed for compiling an object file which uses the given package .TP .B \fBLINK\fP print the flags needed for linking when using the given package .UNINDENT .TP .B \fBQUIET\fP if TRUE, don\(aqt print anything .UNINDENT .SS CMakeForceCompiler .sp Deprecated. Do not use. .sp The macros provided by this module were once intended for use by cross\-compiling toolchain files when CMake was not able to automatically detect the compiler identification. Since the introduction of this module, CMake\(aqs compiler identification capabilities have improved and can now be taught to recognize any compiler. Furthermore, the suite of information CMake detects from a compiler is now too extensive to be provided by toolchain files using these macros. .sp One common use case for this module was to skip CMake\(aqs checks for a working compiler when using a cross\-compiler that cannot link binaries without special flags or custom linker scripts. This case is now supported by setting the \fBCMAKE_TRY_COMPILE_TARGET_TYPE\fP variable in the toolchain file instead. .sp .ce ---- .ce 0 .sp .sp Macro CMAKE_FORCE_C_COMPILER has the following signature: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_FORCE_C_COMPILER( ) .ft P .fi .UNINDENT .UNINDENT .sp It sets CMAKE_C_COMPILER to the given compiler and the cmake internal variable CMAKE_C_COMPILER_ID to the given compiler\-id. It also bypasses the check for working compiler and basic compiler information tests. .sp Macro CMAKE_FORCE_CXX_COMPILER has the following signature: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_FORCE_CXX_COMPILER( ) .ft P .fi .UNINDENT .UNINDENT .sp It sets CMAKE_CXX_COMPILER to the given compiler and the cmake internal variable CMAKE_CXX_COMPILER_ID to the given compiler\-id. It also bypasses the check for working compiler and basic compiler information tests. .sp Macro CMAKE_FORCE_Fortran_COMPILER has the following signature: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_FORCE_Fortran_COMPILER( ) .ft P .fi .UNINDENT .UNINDENT .sp It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake internal variable CMAKE_Fortran_COMPILER_ID to the given compiler\-id. It also bypasses the check for working compiler and basic compiler information tests. .sp So a simple toolchain file could look like this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C include (CMakeForceCompiler) set(CMAKE_SYSTEM_NAME Generic) CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross) CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross) .ft P .fi .UNINDENT .UNINDENT .SS CMakeGraphVizOptions .sp The builtin graphviz support of CMake. .SS Variables specific to the graphviz support .sp CMake can generate \fI\%graphviz\fP files, showing the dependencies between the targets in a project and also external libraries which are linked against. When CMake is run with the \fB\-\-graphviz=foo.dot\fP option, it will produce: .INDENT 0.0 .IP \(bu 2 a \fBfoo.dot\fP file showing all dependencies in the project .IP \(bu 2 a \fBfoo.dot.\fP file for each target, file showing on which other targets the respective target depends .IP \(bu 2 a \fBfoo.dot..dependers\fP file, showing which other targets depend on the respective target .UNINDENT .sp The different dependency types \fBPUBLIC\fP, \fBPRIVATE\fP and \fBINTERFACE\fP are represented as solid, dashed and dotted edges. .sp This can result in huge graphs. Using the file \fBCMakeGraphVizOptions.cmake\fP the look and content of the generated graphs can be influenced. This file is searched first in \fBCMAKE_BINARY_DIR\fP and then in \fBCMAKE_SOURCE_DIR\fP\&. If found, it is read and the variables set in it are used to adjust options for the generated graphviz files. .INDENT 0.0 .TP .B GRAPHVIZ_GRAPH_TYPE The graph type. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : "digraph" .UNINDENT .sp Valid graph types are: .INDENT 7.0 .IP \(bu 2 "graph" : Nodes are joined with lines .IP \(bu 2 "digraph" : Nodes are joined with arrows showing direction .IP \(bu 2 "strict graph" : Like "graph" but max one line between each node .IP \(bu 2 "strict digraph" : Like "graph" but max one line between each node in each direction .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_GRAPH_NAME The graph name. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : "GG" .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_GRAPH_HEADER The header written at the top of the graphviz file. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : "node [n fontsize = "12"];" .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_NODE_PREFIX The prefix for each node in the graphviz file. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : "node" .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_EXECUTABLES Set this to FALSE to exclude executables from the generated graphs. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_STATIC_LIBS Set this to FALSE to exclude static libraries from the generated graphs. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_SHARED_LIBS Set this to FALSE to exclude shared libraries from the generated graphs. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_MODULE_LIBS Set this to FALSE to exclude module libraries from the generated graphs. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_EXTERNAL_LIBS Set this to FALSE to exclude external libraries from the generated graphs. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_IGNORE_TARGETS A list of regular expressions for ignoring targets. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : empty .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_GENERATE_PER_TARGET Set this to FALSE to exclude per target graphs \fBfoo.dot.\fP\&. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B GRAPHVIZ_GENERATE_DEPENDERS Set this to FALSE to exclude depender graphs \fBfoo.dot..dependers\fP\&. .INDENT 7.0 .IP \(bu 2 Mandatory : NO .IP \(bu 2 Default : TRUE .UNINDENT .UNINDENT .SS CMakePackageConfigHelpers .sp Helpers functions for creating config files that can be included by other projects to find and use a package. .sp Adds the \fI\%configure_package_config_file()\fP and \fI\%write_basic_package_version_file()\fP commands. .SS Generating a Package Configuration File .INDENT 0.0 .TP .B configure_package_config_file Create a config file for a project: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C configure_package_config_file( INSTALL_DESTINATION [PATH_VARS ... ] [NO_SET_AND_CHECK_MACRO] [NO_CHECK_REQUIRED_COMPONENTS_MACRO] [INSTALL_PREFIX ] ) .ft P .fi .UNINDENT .UNINDENT .UNINDENT .sp \fBconfigure_package_config_file()\fP should be used instead of the plain \fBconfigure_file()\fP command when creating the \fBConfig.cmake\fP or \fB\-config.cmake\fP file for installing a project or library. It helps making the resulting package relocatable by avoiding hardcoded paths in the installed \fBConfig.cmake\fP file. .sp In a \fBFooConfig.cmake\fP file there may be code like this to make the install destinations know to the using project: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) #...logic to determine installedPrefix from the own location... set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) .ft P .fi .UNINDENT .UNINDENT .sp All 4 options shown above are not sufficient, since the first 3 hardcode the absolute directory locations, and the 4th case works only if the logic to determine the \fBinstalledPrefix\fP is correct, and if \fBCONFIG_INSTALL_DIR\fP contains a relative path, which in general cannot be guaranteed. This has the effect that the resulting \fBFooConfig.cmake\fP file would work poorly under Windows and OSX, where users are used to choose the install location of a binary package at install time, independent from how \fBCMAKE_INSTALL_PREFIX\fP was set at build/cmake time. .sp Using \fBconfigure_package_config_file\fP helps. If used correctly, it makes the resulting \fBFooConfig.cmake\fP file relocatable. Usage: .INDENT 0.0 .IP 1. 3 write a \fBFooConfig.cmake.in\fP file as you are used to .IP 2. 3 insert a line containing only the string \fB@PACKAGE_INIT@\fP .IP 3. 3 instead of \fBset(FOO_DIR "@SOME_INSTALL_DIR@")\fP, use \fBset(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")\fP (this must be after the \fB@PACKAGE_INIT@\fP line) .IP 4. 3 instead of using the normal \fBconfigure_file()\fP, use \fBconfigure_package_config_file()\fP .UNINDENT .sp The \fB\fP and \fB\fP arguments are the input and output file, the same way as in \fBconfigure_file()\fP\&. .sp The \fB\fP given to \fBINSTALL_DESTINATION\fP must be the destination where the \fBFooConfig.cmake\fP file will be installed to. This path can either be absolute, or relative to the \fBINSTALL_PREFIX\fP path. .sp The variables \fB\fP to \fB\fP given as \fBPATH_VARS\fP are the variables which contain install destinations. For each of them the macro will create a helper variable \fBPACKAGE_\fP\&. These helper variables must be used in the \fBFooConfig.cmake.in\fP file for setting the installed location. They are calculated by \fBconfigure_package_config_file\fP so that they are always relative to the installed location of the package. This works both for relative and also for absolute locations. For absolute locations it works only if the absolute location is a subdirectory of \fBINSTALL_PREFIX\fP\&. .sp If the \fBINSTALL_PREFIX\fP argument is passed, this is used as base path to calculate all the relative paths. The \fB\fP argument must be an absolute path. If this argument is not passed, the \fBCMAKE_INSTALL_PREFIX\fP variable will be used instead. The default value is good when generating a FooConfig.cmake file to use your package from the install tree. When generating a FooConfig.cmake file to use your package from the build tree this option should be used. .sp By default \fBconfigure_package_config_file\fP also generates two helper macros, \fBset_and_check()\fP and \fBcheck_required_components()\fP into the \fBFooConfig.cmake\fP file. .sp \fBset_and_check()\fP should be used instead of the normal \fBset()\fP command for setting directories and file locations. Additionally to setting the variable it also checks that the referenced file or directory actually exists and fails with a \fBFATAL_ERROR\fP otherwise. This makes sure that the created \fBFooConfig.cmake\fP file does not contain wrong references. When using the \fBNO_SET_AND_CHECK_MACRO\fP, this macro is not generated into the \fBFooConfig.cmake\fP file. .sp \fBcheck_required_components()\fP should be called at the end of the \fBFooConfig.cmake\fP file. This macro checks whether all requested, non\-optional components have been found, and if this is not the case, sets the \fBFoo_FOUND\fP variable to \fBFALSE\fP, so that the package is considered to be not found. It does that by testing the \fBFoo__FOUND\fP variables for all requested required components. This macro should be called even if the package doesn\(aqt provide any components to make sure users are not specifying components erroneously. When using the \fBNO_CHECK_REQUIRED_COMPONENTS_MACRO\fP option, this macro is not generated into the \fBFooConfig.cmake\fP file. .sp For an example see below the documentation for \fI\%write_basic_package_version_file()\fP\&. .SS Generating a Package Version File .INDENT 0.0 .TP .B write_basic_package_version_file Create a version file for a project: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C write_basic_package_version_file( [VERSION ] COMPATIBILITY ) .ft P .fi .UNINDENT .UNINDENT .UNINDENT .sp Writes a file for use as \fBConfigVersion.cmake\fP file to \fB\fP\&. See the documentation of \fBfind_package()\fP for details on this. .sp \fB\fP is the output filename, it should be in the build tree. \fB\fP is the version number of the project to be installed. .sp If no \fBVERSION\fP is given, the \fBPROJECT_VERSION\fP variable is used. If this hasn\(aqt been set, it errors out. .sp The \fBCOMPATIBILITY\fP mode \fBAnyNewerVersion\fP means that the installed package version will be considered compatible if it is newer or exactly the same as the requested version. This mode should be used for packages which are fully backward compatible, also across major versions. If \fBSameMajorVersion\fP is used instead, then the behaviour differs from \fBAnyNewerVersion\fP in that the major version number must be the same as requested, e.g. version 2.0 will not be considered compatible if 1.0 is requested. This mode should be used for packages which guarantee backward compatibility within the same major version. If \fBSameMinorVersion\fP is used, the behaviour is the same as \fBSameMajorVersion\fP, but both major and minor version must be the same as requested, e.g version 0.2 will not be compatible if 0.1 is requested. If \fBExactVersion\fP is used, then the package is only considered compatible if the requested version matches exactly its own version number (not considering the tweak version). For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3. This mode is for packages without compatibility guarantees. If your project has more elaborated version matching rules, you will need to write your own custom \fBConfigVersion.cmake\fP file instead of using this macro. .sp Internally, this macro executes \fBconfigure_file()\fP to create the resulting version file. Depending on the \fBCOMPATIBILITY\fP, the corresponding \fBBasicConfigVersion\-.cmake.in\fP file is used. Please note that these files are internal to CMake and you should not call \fBconfigure_file()\fP on them yourself, but they can be used as starting point to create more sophisticted custom \fBConfigVersion.cmake\fP files. .SS Example Generating Package Files .sp Example using both \fI\%configure_package_config_file()\fP and \fBwrite_basic_package_version_file()\fP: .sp \fBCMakeLists.txt\fP: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set(INCLUDE_INSTALL_DIR include/ ... CACHE ) set(LIB_INSTALL_DIR lib/ ... CACHE ) set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) #... include(CMakePackageConfigHelpers) configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake VERSION 1.2.3 COMPATIBILITY SameMajorVersion ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) .ft P .fi .UNINDENT .UNINDENT .sp \fBFooConfig.cmake.in\fP: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set(FOO_VERSION x.y.z) \&... @PACKAGE_INIT@ \&... set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") check_required_components(Foo) .ft P .fi .UNINDENT .UNINDENT .SS CMakeParseArguments .sp This module once implemented the \fBcmake_parse_arguments()\fP 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. .SS CMakePrintHelpers .sp Convenience macros for printing properties and variables, useful e.g. for debugging. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN] [SOURCES source1 .. sourceN] [DIRECTORIES dir1 .. dirN] [TESTS test1 .. testN] [CACHE_ENTRIES entry1 .. entryN] PROPERTIES prop1 .. propN ) .ft P .fi .UNINDENT .UNINDENT .sp This macro prints the values of the properties of the given targets, source files, directories, tests or cache entries. Exactly one of the scope keywords must be used. Example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cmake_print_properties(TARGETS foo bar PROPERTIES LOCATION INTERFACE_INCLUDE_DIRS) .ft P .fi .UNINDENT .UNINDENT .sp This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for both targets foo and bar. .sp CMAKE_PRINT_VARIABLES(var1 var2 .. varN) .sp This macro will print the name of each variable followed by its value. Example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST) .ft P .fi .UNINDENT .UNINDENT .sp Gives: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C \-\- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST="" .ft P .fi .UNINDENT .UNINDENT .SS CMakePrintSystemInformation .sp print system information .sp This file can be used for diagnostic purposes just include it in a project to see various internal CMake variables. .SS CMakePushCheckState .sp This module defines three macros: CMAKE_PUSH_CHECK_STATE() CMAKE_POP_CHECK_STATE() and CMAKE_RESET_CHECK_STATE() These macros can be used to save, restore and reset (i.e., clear contents) the state of the variables CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_INCLUDES and CMAKE_EXTRA_INCLUDE_FILES used by the various Check\-files coming with CMake, like e.g. check_function_exists() etc. The variable contents are pushed on a stack, pushing multiple times is supported. This is useful e.g. when executing such tests in a Find\-module, where they have to be set, but after the Find\-module has been executed they should have the same value as they had before. .sp CMAKE_PUSH_CHECK_STATE() macro receives optional argument RESET. Whether it\(aqs specified, CMAKE_PUSH_CHECK_STATE() will set all CMAKE_REQUIRED_* variables to empty values, same as CMAKE_RESET_CHECK_STATE() call will do. .sp Usage: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cmake_push_check_state(RESET) set(CMAKE_REQUIRED_DEFINITIONS \-DSOME_MORE_DEF) check_function_exists(...) cmake_reset_check_state() set(CMAKE_REQUIRED_DEFINITIONS \-DANOTHER_DEF) check_function_exists(...) cmake_pop_check_state() .ft P .fi .UNINDENT .UNINDENT .SS CMakeVerifyManifest .sp CMakeVerifyManifest.cmake .sp This script is used to verify that embedded manifests and side by side manifests for a project match. To run this script, cd to a directory and run the script with cmake \-P. On the command line you can pass in versions that are OK even if not found in the .manifest files. For example, cmake \-Dallow_versions=8.0.50608.0 \-PCmakeVerifyManifest.cmake could be used to allow an embedded manifest of 8.0.50608.0 to be used in a project even if that version was not found in the .manifest file. .SS CPackComponent .sp Build binary and source package installers .SS Variables concerning CPack Components .sp The CPackComponent module is the module which handles the component part of CPack. See CPack module for general information about CPack. .sp For certain kinds of binary installers (including the graphical installers on macOS and Windows), CPack generates installers that allow users to select individual application components to install. The contents of each of the components are identified by the COMPONENT argument of CMake\(aqs INSTALL command. These components can be annotated with user\-friendly names and descriptions, inter\-component dependencies, etc., and grouped in various ways to customize the resulting installer. See the cpack_add_* commands, described below, for more information about component\-specific installations. .sp Component\-specific installation allows users to select specific sets of components to install during the install process. Installation components are identified by the COMPONENT argument of CMake\(aqs INSTALL commands, and should be further described by the following CPack commands: .INDENT 0.0 .TP .B CPACK_COMPONENTS_ALL The list of component to install. .sp 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. .sp 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 \fBget_cmake_property()\fP command can be used to obtain the \fBCOMPONENTS\fP property, then the \fBlist(REMOVE_ITEM)\fP command can be used to remove the unwanted ones. For example, to use all defined components except \fBfoo\fP and \fBbar\fP: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) list(REMOVE_ITEM CPACK_COMPONENTS_ALL "foo" "bar") .ft P .fi .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B CPACK__COMPONENT_INSTALL Enable/Disable component install for CPack generator . .sp 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. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENTS_GROUPING Specify how components are grouped for multi\-package component\-aware CPack generators. .sp Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several packages files when asked for component packaging. They group the component differently depending on the value of this variable: .INDENT 7.0 .IP \(bu 2 ONE_PER_GROUP (default): creates one package file per component group .IP \(bu 2 ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components .IP \(bu 2 IGNORE : creates one package per component, i.e. IGNORE component group .UNINDENT .sp One can specify different grouping for different CPack generator by using a CPACK_PROJECT_CONFIG_FILE. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__DISPLAY_NAME The name to be displayed for a component. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__DESCRIPTION The description of a component. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__GROUP The group of a component. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__DEPENDS The dependencies (list of components) on which this component depends. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__HIDDEN True if this component is hidden from the user. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__REQUIRED True if this component is required. .UNINDENT .INDENT 0.0 .TP .B CPACK_COMPONENT__DISABLED True if this component is not selected to be installed by default. .UNINDENT .INDENT 0.0 .TP .B cpack_add_component .UNINDENT .sp Describes a CPack installation component named by the COMPONENT argument to a CMake INSTALL command. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cpack_add_component(compname [DISPLAY_NAME name] [DESCRIPTION description] [HIDDEN | REQUIRED | DISABLED ] [GROUP group] [DEPENDS comp1 comp2 ... ] [INSTALL_TYPES type1 type2 ... ] [DOWNLOADED] [ARCHIVE_FILE filename] [PLIST filename]) .ft P .fi .UNINDENT .UNINDENT .sp The cmake_add_component command describes an installation component, which the user can opt to install or remove as part of the graphical installation process. compname is the name of the component, as provided to the COMPONENT argument of one or more CMake INSTALL commands. .sp DISPLAY_NAME is the displayed name of the component, used in graphical installers to display the component name. This value can be any string. .sp 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 \fB\en\fP as the line separator. Typically, these descriptions should be no more than a few lines long. .sp 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. .sp REQUIRED indicates that this component is required, and therefore will always be installed. It will be visible in the graphical installer, but it cannot be unselected. (Typically, required components are shown greyed out). .sp 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. .sp 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. .sp 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. .sp 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. .sp 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. .sp 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. .sp PLIST gives a filename that is passed to pkgbuild with the \fB\-\-component\-plist\fP argument when using the productbuild generator. .INDENT 0.0 .TP .B cpack_add_component_group .UNINDENT .sp Describes a group of related CPack installation components. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cpack_add_component_group(groupname [DISPLAY_NAME name] [DESCRIPTION description] [PARENT_GROUP parent] [EXPANDED] [BOLD_TITLE]) .ft P .fi .UNINDENT .UNINDENT .sp 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. .sp 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. .sp 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 \fB\en\fP as the line separator. Typically, these descriptions should be no more than a few lines long. .sp 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. .sp 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. .sp BOLD_TITLE indicates that the group title should appear in bold, to call the user\(aqs attention to the group. .INDENT 0.0 .TP .B cpack_add_install_type .UNINDENT .sp Add a new installation type containing a set of predefined component selections to the graphical installer. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cpack_add_install_type(typename [DISPLAY_NAME name]) .ft P .fi .UNINDENT .UNINDENT .sp 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\(aqs executable. Each component identifies itself with one or more install types via the INSTALL_TYPES argument to cpack_add_component. .sp 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. .INDENT 0.0 .TP .B cpack_configure_downloads .UNINDENT .sp Configure CPack to download selected components on\-the\-fly as part of the installation process. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C cpack_configure_downloads(site [UPLOAD_DIRECTORY dirname] [ALL] [ADD_REMOVE|NO_ADD_REMOVE]) .ft P .fi .UNINDENT .UNINDENT .sp 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: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C http://nsis.sourceforge.net/ZipDLL_plug\-in .ft P .fi .UNINDENT .UNINDENT .sp On macOS, installers that download components on\-the\-fly can only be built and installed on system using macOS 10.5 or later. .sp The site argument is a URL where the archives for downloadable components will reside, e.g., \fI\%https://cmake.org/files/2.6.1/installer/\fP All of the archives produced by CPack should be uploaded to that location. .sp 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. .sp 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). .sp ADD_REMOVE indicates that CPack should install a copy of the installer that can be called from Windows\(aq 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. .SS CPackIFW .sp The documentation for the CPack IFW generator has moved here: \fBCPack IFW Generator\fP .sp This module looks for the location of the command line utilities supplied with the Qt Installer Framework (\fI\%QtIFW\fP). .sp The module also defines several commands to control the behavior of the CPack \fBIFW\fP generator. .SS Commands .sp The module defines the following commands: .INDENT 0.0 .TP .B cpack_ifw_configure_component Sets the arguments specific to the CPack IFW generator. .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C cpack_ifw_configure_component( [COMMON] [ESSENTIAL] [VIRTUAL] [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] [NAME ] [DISPLAY_NAME ] # Note: Internationalization supported [DESCRIPTION ] # Note: Internationalization supported [UPDATE_TEXT ] [VERSION ] [RELEASE_DATE ] [SCRIPT