CMAKE-MODULES(7) CMake CMAKE-MODULES(7) NAME cmake-modules - CMake Modules Reference The modules listed here are part of the CMake distribution. Projects may provide further modules; their location(s) can be specified in the CMAKE_MODULE_PATH variable. UTILITY MODULES These modules are loaded using the include() command. AndroidTestUtilities Added in version 3.7. Create a test that automatically loads specified data onto an Android device. Introduction 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. For example: include(AndroidTestUtilities) android_add_test_data( example_setup_test FILES ... LIBS ... DEVICE_TEST_DIR "/data/local/tests/example" DEVICE_OBJECT_STORE "/sdcard/.ExternalData/SHA" ) 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. Module Functions android_add_test_data android_add_test_data( [FILES ...] [FILES_DEST ] [LIBS ...] [LIBS_DEST ] [DEVICE_OBJECT_STORE ] [DEVICE_TEST_DIR ] [NO_LINK_REGEX ...] ) 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 ... zero or more files needed for testing LIBS ... zero or more libraries needed for testing FILES_DEST absolute path where the data files are expected to be LIBS_DEST absolute path where the libraries are expected to be DEVICE_OBJECT_STORE absolute path to the location where the data is stored on-device DEVICE_TEST_DIR absolute path to the root directory of the on-device test location NO_LINK_REGEX ... list of regex strings matching the names of files that should be copied from the object store to the testing directory BundleUtilities Functions to help assemble a standalone bundle application. A collection of CMake utility functions useful for dealing with .app bundles on the Mac and bundle-like directories on any OS. NOTE: Do not use these functions at configure time (from CMakeLists.txt). Instead, invoke them from an install(CODE) or install(SCRIPT). Functions The following functions are provided by this module: fixup_bundle fixup_bundle( [IGNORE_ITEM ...]) Fix up bundle in-place and make it standalone, such that it can be drag-n-drop copied to another machine and run on that machine as long as all of the system libraries are compatible. If you pass plugins to fixup_bundle as the libs parameter, you should install them or copy them into the bundle before calling fixup_bundle. The parameter is a list of libraries that must be fixed up, but that cannot be determined by otool output analysis (i.e. plugins). Gather all the keys for all the executables and libraries in a bundle, and then, for each key, copy each prerequisite into the bundle. Then fix each one up according to its own list of prerequisites. Then clear all the keys and call verify_app on the final bundle to ensure that it is truly standalone. Added in version 3.6: As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"). copy_and_fixup_bundle copy_and_fixup_bundle( ) Makes a copy of the bundle at location and then fixes up the new copied bundle in-place at . verify_app verify_app( [IGNORE_ITEM ...]) Verifies that an application appears valid based on running analysis tools on it. Calls message(FATAL_ERROR) if the application is not verified. Added in version 3.6: As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") get_bundle_main_executable get_bundle_main_executable( ) The result will be the full path name of the bundle's main executable file or an error: prefixed string if it could not be determined. get_dotapp_dir get_dotapp_dir( ) Returns the nearest parent dir whose name ends with .app given the full path to an executable. If there is no such parent dir, then simply return the dir containing the executable. The returned directory may or may not exist. get_bundle_and_executable get_bundle_and_executable( ) Takes either a .app directory name or the name of an executable nested inside a .app directory and returns the path to the .app directory in and the path to its main executable in . get_bundle_all_executables get_bundle_all_executables( ) Scans bundle recursively for all executable files and accumulates them into a variable. get_item_key get_item_key( ) Given file name, generate key that should be unique considering the set of libraries that need copying or fixing up to make a bundle standalone. This is essentially the file name including extension with . replaced by _ This key is used as a prefix for CMake variables so that we can associate a set of variables with a given item based on its key. get_item_rpaths get_item_rpaths( ) Get RPATHS of the file name and store them to the variable with provided name . clear_bundle_keys clear_bundle_keys() Loop over the list of keys, clearing all the variables associated with each key. After the loop, clear the list of keys itself. Caller of get_bundle_keys should call clear_bundle_keys when done with list of keys. set_bundle_key_values set_bundle_key_values( []) Add key to the list (if necessary) for the given item. If added, also set all the variables associated with that key. get_bundle_keys get_bundle_keys( [IGNORE_ITEM ...]) Loop over all the executable and library files within 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. Added in version 3.6: As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") copy_resolved_item_into_bundle copy_resolved_item_into_bundle( ) Copy a resolved item into the bundle if necessary. Copy is not necessary, if the is "the same as" the . copy_resolved_framework_into_bundle copy_resolved_framework_into_bundle( ) Copy a resolved framework into the bundle if necessary. Copy is not necessary, if the is "the same as" the . By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework dylib itself plus the framework Resources directory. fixup_bundle_item fixup_bundle_item( ) Get the direct/non-system prerequisites of the . For each prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to an @executable_path style reference.) This function requires that the be inside the bundle already. In other words, if you pass plugins to fixup_bundle as the libs parameter, you should install them or copy them into the bundle before calling fixup_bundle. The libs parameter is a list of libraries that must be fixed up, but that cannot be determined by otool output analysis. (i.e., plugins) Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value. Accumulate changes in a local variable and make one call to install_name_tool at the end of the function with all the changes at once. If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be marked writable before install_name_tool tries to change them. verify_bundle_prerequisites verify_bundle_prerequisites( [IGNORE_ITEM ...]) 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. Added in version 3.6: As an optional parameter (IGNORE_ITEM) a list of file names can be passed, which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") verify_bundle_symlinks verify_bundle_symlinks( ) 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. CheckCCompilerFlag Check once whether the C compiler supports a given flag. check_c_compiler_flag check_c_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. See also check_compiler_flag() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_c_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCompilerFlag Added in version 3.19. Check once whether the compiler supports a given flag. check_compiler_flag check_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. The compile and link commands can be influenced by setting any of the following variables prior to calling check_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCSourceCompiles Check once if C source code can be built. check_c_source_compiles check_c_source_compiles( [FAIL_REGEX [...]]) Check once that the source supplied in can be built. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. See also check_source_compiles() for a more general command syntax. See also check_source_runs() to run compiled source. The compile and link commands can be influenced by setting any of the following variables prior to calling check_c_source_compiles(): CMAKE_REQUIRED_FLAGS String of additional flags to pass to the compiler. The string must be space-delimited--a ;-list will not work. The contents of CMAKE__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCSourceRuns Check once if given C source compiles and links into an executable and can subsequently be run. check_c_source_runs check_c_source_runs( ) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain at least a main() function. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. See also check_source_runs() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_c_source_runs(): CMAKE_REQUIRED_FLAGS String of additional flags to pass to the compiler. The string must be space-delimited--a ;-list will not work. The contents of CMAKE__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCXXCompilerFlag Check once whether the CXX compiler supports a given flag. check_cxx_compiler_flag check_cxx_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. See also check_compiler_flag() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_cxx_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCXXSourceCompiles Check once if C++ source code can be built. check_cxx_source_compiles check_cxx_source_compiles( [FAIL_REGEX [...]]) Check once that the source supplied in can be built. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. See also check_source_compiles() for a more general command syntax. See also check_source_runs() to run compiled source. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCXXSourceRuns Check once if given C++ source compiles and links into an executable and can subsequently be run. check_cxx_source_runs check_cxx_source_runs( ) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain at least a main() function. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. See also check_source_runs() for a more general command syntax. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckCXXSymbolExists Check if a symbol exists as a function, variable, or macro in C++. check_cxx_symbol_exists check_cxx_symbol_exists( ) 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 for symbols as seen by the C++ compiler, as opposed to check_symbol_exists(), which always uses the C compiler. 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, enum value, or C++ template it will not be recognized: consider using the CheckTypeSize or CheckSourceCompiles module instead. NOTE: This command is unreliable when is (potentially) an overloaded function. Since there is no reliable way to predict whether a given function in the system environment may be defined as an overloaded function or may be an overloaded function on other systems or will become so in the future, it is generally advised to use the CheckSourceCompiles module for checking any function symbol (unless somehow you surely know the checked function is not overloaded on other systems or will not be so in the future). 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. For example: include(CheckCXXSymbolExists) # Check for macro SEEK_SET check_cxx_symbol_exists(SEEK_SET "cstdio" HAVE_SEEK_SET) # Check for function std::fopen check_cxx_symbol_exists(std::fopen "cstdio" HAVE_STD_FOPEN) CheckFortranCompilerFlag Added in version 3.3. Check once whether the Fortran compiler supports a given flag. check_fortran_compiler_flag check_fortran_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. See also check_compiler_flag() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_fortran_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckFortranFunctionExists Check if a Fortran function exists. check_fortran_function_exists check_fortran_function_exists( ) where the name of the Fortran function 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CheckFortranSourceCompiles Added in version 3.1. Check once if Fortran source code can be built. check_fortran_source_compiles check_fortran_source_compiles( [FAIL_REGEX ...] [SRC_EXT ] ) Check once that the source supplied in can be built. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. By default, the test source file will be given a .F file extension. The SRC_EXT option can be used to override this with . instead-- .F90 is a typical choice. See also check_source_compiles() for a more general command syntax. See also check_source_runs() to run compiled source. Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. The compile and link commands can be influenced by setting any of the following variables prior to calling check_fortran_source_compiles(): CMAKE_REQUIRED_FLAGS String of additional flags to pass to the compiler. The string must be space-delimited--a ;-list will not work. The contents of CMAKE__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckFortranSourceRuns Added in version 3.14. Check once if given Fortran source compiles and links into an executable and can subsequently be run. check_fortran_source_runs check_fortran_source_runs( [SRC_EXT ]) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain a Fortran program. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. check_fortran_source_runs("program test real :: x[*] call co_sum(x) end program" HAVE_COARRAY) By default, the test source file will be given a .F90 file extension. The SRC_EXT option can be used to override this with . instead. See also check_source_runs() for a more general command syntax. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckFunctionExists Check once if a C function can be linked from system libraries. check_function_exists check_function_exists( ) Checks that the is provided by libraries on the system and store the result in internal cache variable . 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. NOTE: Prefer using CheckSymbolExists or CheckSourceCompiles instead of this module, for the following reasons: o check_function_exists() can't detect functions that are inlined in headers or specified as a macro. o check_function_exists() can't detect anything in the 32-bit versions of the Win32 API, because of a mismatch in calling conventions. o check_function_exists() only verifies linking, it does not verify that the function is declared in system headers. CheckIncludeFileCXX Provides a macro to check if a header file can be included in CXX. check_include_file_cxx check_include_file_cxx( []) Check if the given file may be included in a CXX source file and store the result in an internal cache entry named . 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. See modules CheckIncludeFile and CheckIncludeFiles to check for one or more C headers. CheckIncludeFile Provides a macro to check if a header file can be included in C. check_include_file check_include_file( []) Check if the given file may be included in a C source file and store the result in an internal cache entry named . 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. See the CheckIncludeFiles module to check for multiple headers at once. See the CheckIncludeFileCXX module to check for headers using the CXX language. CheckIncludeFiles Provides a macro to check if a list of one or more header files can be included together. check_include_files check_include_files("" [LANGUAGE ]) Check if the given list may be included together in a source file and store the result in an internal cache entry named . Specify the 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. See modules CheckIncludeFile and CheckIncludeFileCXX to check for a single header file in C or CXX languages. CheckIPOSupported Added in version 3.9. Check whether the compiler supports an interprocedural optimization (IPO/LTO). Use this before enabling the INTERPROCEDURAL_OPTIMIZATION target property. check_ipo_supported check_ipo_supported([RESULT ] [OUTPUT ] [LANGUAGES ...]) Options are: RESULT Set 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 Set variable with details about any error. LANGUAGES ... Specify languages whose compilers to check. The following languages are supported: o C o CXX o CUDA Added in version 3.25. o Fortran If this option is not given, the default languages are picked from the current ENABLED_LANGUAGES global property. NOTE: To use check_ipo_supported(), policy CMP0069 must be set to NEW; otherwise, a fatal error will occur. Added in version 3.13: Support for Visual Studio generators. Added in version 3.24: The check uses the caller's CMAKE__FLAGS and CMAKE__FLAGS_ values. See policy CMP0138. Examples check_ipo_supported() # fatal error if IPO is not supported set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) # Optional IPO. Do not use IPO if it's 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() CheckLanguage Check whether a language can be enabled by the enable_language() or project() commands: check_language check_language() Try enabling language in a test project and record results in the cache: CMAKE__COMPILER If the language can be enabled, this variable is set to the compiler that was found. If the language cannot be enabled, this variable is set to NOTFOUND. If this variable is already set, either explicitly or cached by a previous call, the check is skipped. CMAKE__HOST_COMPILER This variable is set when is CUDA or HIP. If the check detects an explicit host compiler that is required for compilation, this variable will be set to that compiler. If the check detects that no explicit host compiler is needed, this variable will be cleared. If this variable is already set, its value is preserved only if CMAKE__COMPILER is also set. Otherwise, the check runs and overwrites CMAKE__HOST_COMPILER with a new result. Note that CMAKE__HOST_COMPILER documents it should not be set without also setting CMAKE__COMPILER to a NVCC compiler. CMAKE__PLATFORM This variable is set to the detected GPU platform when is HIP. If the variable is already set its value is always preserved. Only compatible values will be considered for CMAKE__COMPILER. For example: check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) else() message(STATUS "No Fortran support") endif() CheckLibraryExists Check once if the function exists in system or specified library. check_library_exists check_library_exists( ) Check that the library exists in the given location and has the specified . The result is stored in an internal cache variable . If is empty string, default directories are searched. Prefer using CheckSymbolExists or CheckSourceCompiles instead of this module for more robust detection if a function is available in a library. 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__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 will also be added automatically. CMAKE_REQUIRED_LINK_OPTIONS Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. Examples This module can be useful for performing so-called sanity checks to verify that the specified library provides the expected functionality and is indeed the correct one being located. For example, to check if the curl library exists in the default paths and has the curl_easy_perform function: include(CheckLibraryExists) check_library_exists(curl curl_easy_perform "" HAVE_LIBRARY_CURL) To check if library exists in specific non-standard location and has a specified function: include(CheckLibraryExists) check_library_exists(curl curl_easy_perform "/opt/curl/lib" HAVE_LIBRARY_CURL) Also IMPORTED library (for example, from the find_package() call) can be used: find_package(CURL) # ... if(TARGET CURL::libcurl) include(CheckLibraryExists) check_library_exists(CURL::libcurl curl_easy_perform "" HAVE_LIBRARY_CURL) endif() CheckLinkerFlag Added in version 3.18. Check whether the compiler supports a given link flag. check_linker_flag check_linker_flag( ) Check that the link is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry named . This command temporarily sets the CMAKE_REQUIRED_LINK_OPTIONS variable and calls the check_source_compiles() command from the CheckSourceCompiles module. See that module's documentation for a listing of variables that can otherwise modify the build. The underlying implementation relies on the LINK_OPTIONS property to check the specified flag. The LINKER: prefix, as described in the target_link_options() command, can be used as well. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the link 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__FLAGS, unknown flags in such variables may cause a false negative for this check. CheckOBJCCompilerFlag Added in version 3.16. Check once whether the Objective-C compiler supports a given flag. check_objc_compiler_flag check_objc_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. See also check_compiler_flag() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_objc_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckOBJCSourceCompiles Added in version 3.16. Check once if Objective-C source can be built. check_objc_source_compiles check_objc_source_compiles( [FAIL_REGEX [...]]) Check once that the source supplied in can be built. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. See also check_source_compiles() for a more general command syntax. See also check_source_runs() to run compiled source. The compile and link commands can be influenced by setting any of the following variables prior to calling check_objc_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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckOBJCSourceRuns Added in version 3.16. Check once if given Objective-C source compiles and links into an executable and can subsequently be run. check_objc_source_runs check_objc_source_runs( ) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain at least a main() function. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. See also check_source_runs() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_objc_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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckOBJCXXCompilerFlag Added in version 3.16. Check once whether the Objective-C++ compiler supports a given flag. check_objcxx_compiler_flag check_objcxx_compiler_flag( ) Check once that the is accepted by the compiler without a diagnostic. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. true indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect is beyond the scope of this module. Internally, try_compile() is used to perform the check. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the check compiles and links an executable program. If set to STATIC_LIBRARY, the check is compiled but not linked. See also check_compiler_flag() for a more general command syntax. The compile and link commands can be influenced by setting any of the following variables prior to calling check_objcxx_compiler_flag(). Unknown flags in these variables can case a false negative result. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckOBJCXXSourceCompiles Added in version 3.16. Check once if Objective-C++ source can be built. check_objcxx_source_compiles check_objcxx_source_compiles( [FAIL_REGEX [...]]) Check once that the source supplied in can be built. The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. See also check_source_compiles() for a more general command syntax. See also check_source_runs() to run compiled source. The compile and link commands can be influenced by setting any of the following variables prior to calling check_objcxx_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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckOBJCXXSourceRuns Added in version 3.16. Check once if given Objective-C++ source compiles and links into an executable and can subsequently be run. check_objcxx_source_runs check_objcxx_source_runs( ) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain at least a main() function. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. See also check_source_runs() for a more general command syntax. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckPIESupported Added in version 3.14. Check whether the linker supports Position Independent Code (PIE) or No Position Independent Code (NO_PIE) for executables. Use this to ensure that the POSITION_INDEPENDENT_CODE target property for executables will be honored at link time. check_pie_supported check_pie_supported([OUTPUT_VARIABLE ] [LANGUAGES ...]) Options are: OUTPUT_VARIABLE Set variable with details about any error. If the check is bypassed because it uses cached results from a previous call, the output will be empty even if errors were present in the previous call. LANGUAGES ... Check the linkers used for each of the specified languages. If this option is not provided, the command checks all enabled languages. C, CXX, Fortran are supported. Added in version 3.23: OBJC, OBJCXX, CUDA, and HIP are supported. It makes no sense to use this module when CMP0083 is set to OLD, so the command will return an error in this case. See policy CMP0083 for details. Variables For each language checked, two boolean cache variables are defined. CMAKE__LINK_PIE_SUPPORTED Set to true if PIE is supported by the linker and false otherwise. CMAKE__LINK_NO_PIE_SUPPORTED Set to true if NO_PIE is supported by the linker and false otherwise. Examples check_pie_supported() set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE) # Retrieve any error message. check_pie_supported(OUTPUT_VARIABLE output LANGUAGES C) set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE) if(NOT CMAKE_C_LINK_PIE_SUPPORTED) message(WARNING "PIE is not supported at link time: ${output}.\n" "PIE link options will not be passed to linker.") endif() CheckPrototypeDefinition Check if a C function has the expected prototype. check_prototype_definition check_prototype_definition( ) The name of the function whose prototype is being checked. The expected prototype of the function, provided as a string. The return value of the function. This will be used as a return value in the function definition body of the generated test program to verify that the function's return type matches the expected type. A semicolon-separated list of header file names required for checking the function prototype. The name of the variable to store the check result. This variable will be created as an internal cache variable. This command generates a test program and verifies that it builds without errors. The generated test program includes specified , defines a function with given literal and value and then uses the specified . The simplified test program can be illustrated as: #include // ... { return ; } int main(...) { ...()... } The following variables may be set before calling this function 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. Examples Checking if the getpwent_r() function on Solaris/illumos systems has the expected prototype: include(CheckPrototypeDefinition) check_prototype_definition( getpwent_r "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)" "NULL" "unistd.h;pwd.h" HAVE_SOLARIS_GETPWENT_R ) CheckSourceCompiles Added in version 3.19. Check once if source code can be built for a given language. check_source_compiles check_source_compiles( [FAIL_REGEX [...]] [SRC_EXT ]) Check once that the source supplied in can be built for code language . The result is stored in the internal cache variable specified by , with boolean true for success and boolean false for failure. If FAIL_REGEX is provided, then failure is determined by checking if anything in the compiler output matches any of the specified regular expressions. By default, the test source file will be given a file extension that matches the requested language. The SRC_EXT option can be used to override this with . instead. The C example checks if the compiler supports the noreturn attribute: set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") check_source_compiles(C "#if !__has_c_attribute(noreturn) #error \"No noreturn attribute\" #endif" HAVE_NORETURN) The Fortran example checks if the compiler supports the pure procedure attribute: set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") check_source_compiles(Fortran "pure subroutine foo() end subroutine" HAVE_PURE) Internally, try_compile() is used to compile the source. If CMAKE_TRY_COMPILE_TARGET_TYPE is set to EXECUTABLE (default), the source is compiled and linked as an executable program. If set to STATIC_LIBRARY, the source is compiled but not linked. In any case, all functions must be declared as usual. See also check_source_runs() to run compiled source. The compile and link commands can be influenced by setting any of the following variables prior to calling check_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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckSourceRuns Added in version 3.19. Check if given source compiles and links into an executable and can subsequently be run. check_source_runs check_source_runs( [SRC_EXT ]) Check once that the source supplied in can be built, linked as an executable, and then run. The must contain at least a main() function, or in Fortran a program. The result is stored in the internal cache variable specified by . If the code builds and runs with exit code 0, success is indicated by boolean true. Failure to build or run is indicated by boolean false, such as an empty string or an error message. By default, the test source file will be given a file extension that matches the requested language. The SRC_EXT option can be used to override this with . instead. The must contain a valid main program. For example: check_source_runs(C "#include #include noreturn void f(){ exit(0); } int main(void) { f(); return 1; }" HAVE_NORETURN) check_source_runs(Fortran "program test real :: x[*] call co_sum(x) end program" HAVE_COARRAY) The compile and link commands can be influenced by setting any of the following variables prior to calling check_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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CheckStructHasMember Check if the given struct or class has the specified member variable check_struct_has_member check_struct_has_member( [LANGUAGE ]) Check that the struct or class has the specified after including the given header(s) where the prototype should be declared. Specify the list of header files in one argument as a semicolon-separated list. The result is stored in an internal cache variable . The options are: LANGUAGE Use the compiler to perform the check. Acceptable values are C and CXX. If not specified, it defaults to C. 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. Example include(CheckStructHasMember) check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC LANGUAGE C) CheckSymbolExists Provides a macro to check if a symbol exists as a function, variable, or macro in C. check_symbol_exists check_symbol_exists( ) 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. will be created as an internal cache variable. If the header files define the symbol as a macro it is considered available and assumed to work. If the header files declare the symbol as a function or variable then the symbol must also be available for linking (so intrinsics may not be detected). If the symbol is a type, enum value, or intrinsic it will not be recognized (consider using CheckTypeSize or CheckSourceCompiles). If the check needs to be done in C++, consider using CheckCXXSymbolExists instead. The following variables may be set before calling this macro to modify the way the check is run: 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. For example: include(CheckSymbolExists) # Check for macro SEEK_SET check_symbol_exists(SEEK_SET "stdio.h" HAVE_SEEK_SET) # Check for function fopen check_symbol_exists(fopen "stdio.h" HAVE_FOPEN) CheckTypeSize Check sizeof a type check_type_size check_type_size( [BUILTIN_TYPES_ONLY] [LANGUAGE ]) Check if the type exists and determine its size. Results are reported in the following variables: HAVE_ Holds a true or false value indicating whether the type exists. Holds one of the following values: Type has non-zero size . 0 Type has architecture-dependent size. This may occur when CMAKE_OSX_ARCHITECTURES has multiple architectures. In this case _CODE contains C preprocessor tests mapping from each architecture macro to the corresponding type size. The list of architecture macros is stored in _KEYS, and the value for each key is stored in -. "" (empty string) Type does not exist. _CODE Holds C preprocessor code to define the macro to the size of the type, or to leave the macro undefined if the type does not exist. The options are: BUILTIN_TYPES_ONLY Support only compiler-builtin types. If 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. LANGUAGE Use the compiler to perform the check. Acceptable values are C and CXX. If not specified, it defaults to C. Despite the name of the macro you may use it to check the size of more complex expressions, too. To check e.g. for the size of a struct member you can do something like this: check_type_size("((struct something*)0)->member" SIZEOF_MEMBER) The following variables may be set before calling this macro to modify the way the check is run: 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__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 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 Added 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_LINK_DIRECTORIES Added in version 3.31. A ;-list of libraries search paths to pass to the linker (see try_compile() for further details). CMAKE_REQUIRED_QUIET Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CMAKE_EXTRA_INCLUDE_FILES list of extra headers to include. Examples Consider the code: include(CheckTypeSize) # Check for size of long. check_type_size(long SIZEOF_LONG) message("HAVE_SIZEOF_LONG: ${HAVE_SIZEOF_LONG}") message("SIZEOF_LONG: ${SIZEOF_LONG}") message("SIZEOF_LONG_CODE: ${SIZEOF_LONG_CODE}") On a 64-bit architecture, the output may look something like this: HAVE_SIZEOF_LONG: TRUE SIZEOF_LONG: 8 SIZEOF_LONG_CODE: #define SIZEOF_LONG 8 On Apple platforms, when CMAKE_OSX_ARCHITECTURES has multiple architectures, types may have architecture-dependent sizes. For example, with the code include(CheckTypeSize) check_type_size(long SIZEOF_LONG) message("HAVE_SIZEOF_LONG: ${HAVE_SIZEOF_LONG}") message("SIZEOF_LONG: ${SIZEOF_LONG}") foreach(key IN LISTS SIZE_OF_LONG_KEYS) message("key: ${key}") message("value: ${SIZE_OF_LONG-${key}}") endforeach() message("SIZEOF_LONG_CODE: ${SIZEOF_LONG_CODE}") the result may be: HAVE_SIZEOF_LONG: TRUE SIZEOF_LONG: 0 key: __i386 value: 4 key: __x86_64 value: 8 SIZEOF_LONG_CODE: #if defined(__i386) # define SIZE_OF_LONG 4 #elif defined(__x86_64) # define SIZE_OF_LONG 8 #else # error SIZE_OF_LONG unknown #endif CheckVariableExists Check if the variable exists. check_variable_exists check_variable_exists( ) Check if the variable exists and store the result in 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__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 will also be added automatically. CMAKE_REQUIRED_LINK_OPTIONS Added 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 Added in version 3.1. If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. CMakeAddFortranSubdirectory 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( # 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 ) 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 make install. CMakeBackwardCompatibilityCXX define a bunch of backwards compatibility variables CMAKE_ANSI_CXXFLAGS - flag for ansi c++ CMAKE_HAS_ANSI_STRING_STREAM - has include(TestForANSIStreamHeaders) include(CheckIncludeFileCXX) include(TestForSTDNamespace) include(TestForANSIForScope) CMakeDependentOption Macro to provide an option dependent on other options. This macro presents an option to the user only if a set of other conditions are true. cmake_dependent_option cmake_dependent_option(