cmakevars - Reference of CMake variables.
variables defined by cmake, that give information about the project, and cmake
This specifies name of the program that creates archive or static libraries.
This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
This variable is set to the program that will be needed to build the output of CMake. If the generator selected was Visual Studio 6, the CMAKE_MAKE_PROGRAM will be set to msdev, for Unix makefiles it will be set to make or gmake, and for Visual Studio 7 it set to devenv. For Nmake Makefiles the value is nmake. This can be useful for adding special flags and commands based on the final build environment.
This is the full path to the directory that has the CMakeCache.txt file in it. This is the same as CMAKE_BINARY_DIR.
This is stores the major version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run on a previously created cache file.
This is stores the minor version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run on a previously created cache file.
This is stores the release version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run on a previously created cache file.
This is a variable that is used to provide developers access to the intermediate directory used by Visual Studio IDE projects. For example, if building Debug all executables and libraries end up in a Debug directory. On UNIX systems this variable is set to ".". However, with Visual Studio this variable is set to $(IntDir). $(IntDir) is expanded by the IDE only. So this variable should only be used in custom commands that will be run during the build process. This variable should not be used directly in a CMake command. CMake has no way of knowing if Debug or Release will be picked by the IDE for a build type. If a program needs to know the directory it was built in, it can use CMAKE_INTDIR. CMAKE_INTDIR is a C/C++ preprocessor macro that is defined on the command line of the compiler. If it has a value, it will be the intermediate directory used to build the file. This way an executable or a library can find files that are located in the build directory.
This is the full path to the CMake executable cmake which is useful from custom commands that want to use the cmake -E option for portable system commands. (e.g. /usr/local/bin/cmake
This variable will be set to true by CMake if CMake is cross compiling. Specifically if the build platform is different from the target platform.
This is the full path to the CTest executable ctest which is useful from custom commands that want to use the cmake -E option for portable system commands.
This the full path to the build directory that is currently being processed by cmake. Each directory added by add_subdirectory will create a binary directory in the build tree, and as it is being processed this variable will be set. For in-source builds this is the current source directory being processed.
As CMake processes the listfiles in your project this variable will always be set to the one currently being processed. See also CMAKE_PARENT_LIST_FILE.
This is the line number of the file currently being processed by cmake.
This the full path to the source directory that is currently being processed by cmake.
The name of the library that has dlopen and dlclose in it, usually -ldl on most UNIX machines.
This is the full path to the CMake executable that can graphically edit the cache. For example, CMakeSetup, ccmake, or cmake -i.
The suffix to use for the end of an executable if any, .exe on Windows.
The name of the generator that is being used to generate the build files. (e.g. "Unix Makefiles", "Visual Studio 6", etc.)
This is the path to the top level of the source tree.
The prefix to use for the name of an import library if used on this platform.
The suffix to use for the end of an import library if used onthis platform.
The suffix to use for the end of a library, .lib on Windows.
This specifies the major version of the CMake executable being run.
This variable is around for backwards compatibility, see CMAKE_BUILD_TOOL.
This specifies the minor version of the CMake executable being run.
As CMake processes the listfiles in your project this variable will always be set to the listfile that included or somehow invoked the one currently being processed. See also CMAKE_CURRENT_LIST_FILE.
This specifies the patch version of the CMake executable being run.
This specifies name of the current project from the closest inherited PROJECT command.
This specifies name of the program that randomizes libraries on UNIX, not used on Windows, but may be present.
This is the install root for the running CMake and the Modules directory can be found here. This is commonly used in this format: ${CMAKE_ROOT}/Modules
The prefix to use for the name of a shared library, lib on UNIX.
The suffix to use for the end of a shared library, .dll on Windows.
The prefix to use for the name of a loadable module on this platform.
The suffix to use for the end of a loadable module on this platform
This is set to the size of a pointer on the machine, and is determined by a try compile. If a 64 bit size is found, then the library search path is modified to look for 64 bit libraries first.
If this is set to TRUE, then the rpath information is not added to compiled executables. The defaultis to add rpath information if the platform supports it.This allows for easy running from the build tree.
This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as CMAKE_BINARY_DIR.
This is the list of libraries that are linked into all executables and libraries.
The prefix to use for the name of a static library, lib on UNIX.
The suffix to use for the end of a static library, .lib on Windows.
This is set to true if the compiler is Visual Studio free tools.
This variable defaults to false. You can set this variable to true to make CMake produce verbose makefiles that show each command line as it is used.
This specifies the full version of the CMake executable being run. This variable is defined by versions 2.6.3 and higher. See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, and CMAKE_PATCH_VERSION for individual version components.
This is the binary directory of the most recent PROJECT command.
This is the name given to the most recent PROJECT command.
This is the source directory of the most recent PROJECT command.
A variable is created with the name used in the PROJECT command, and is the binary directory for the project. This can be useful when SUBDIR is used to connect several projects.
A variable is created with the name used in the PROJECT command, and is the source directory for the project. This can be useful when add_subdirectory is used to connect several projects.
If present and true, this will cause all libraries to be built shared unless the library was explicitly added as a static library. This variable is often added to projects as an OPTION so that each user of a project can decide if they want to build the project using shared or static libraries.
From the point of view of backwards compatibility, this specifies what version of CMake should be supported. By default this value is the version number of CMake that you are running. You can set this to an older version of CMake to support deprecated commands of CMake in projects that were written to use older versions of CMake. This can be set by the user or set at the beginning of a CMakeLists file.
This specifies what build type will be built in this tree. Possible values are empty, Debug, Release, RelWithDebInfo and MinSizeRel. This variable is only supported for make based generators. If this variable is supported, then CMake will also provide initial values for the variables with the name CMAKE_C_FLAGS_[Debug|Release|RelWithDebInfo|MinSizeRel]. For example, if CMAKE_BUILD_TYPE is Debug, then CMAKE_C_FLAGS_DEBUG will be added to the CMAKE_C_FLAGS.
When enabled, the generated Makefiles will produce colored output. Default is ON.
This specifies what build types will be available such as Debug, Release, RelWithDebInfo etc. This has reasonable defaults on most platforms. But can be extended to provide other build types. See also CMAKE_BUILD_TYPE.
This specifies what prefixes to add to library names when the find_library command looks for libraries. On UNIX systems this is typically lib, meaning that when trying to find the foo library it will look for libfoo.
This specifies what suffixes to add to library names when the find_library command looks for libraries. On Windows systems this is typically .lib and .dll, meaning that when trying to find the foo library it will look for foo.dll etc.
Specifies a path which will be used both by FIND_FILE() and FIND_PATH(). Both commands will check each of the contained directories for the existence of the file which is currently searched. By default it is empty, it is intended to be set by the project. See also CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_PREFIX_PATH.
If "make install" is invoked or INSTALL is built, this directory is pre-pended onto all install directories. This variable defaults to /usr/local on UNIX and c:/Program Files on Windows.
Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY() will check each of the contained directories for the existence of the library which is currently searched. By default it is empty, it is intended to be set by the project. See also CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_PREFIX_PATH.
This can be set in a CMakeLists.txt file and will enable MFC in the application. It should be set to 1 for static the static MFC library, and 2 for the shared MFC library. This is used in visual studio 6 and 7 project files. The CMakeSetup dialog uses MFC and the CMakeLists.txt looks like this:
ADD_DEFINITIONS(-D_AFXDLL)
set(CMAKE_MFC_FLAG 2)
add_executable(CMakeSetup WIN32 ${SRCS})
Specifies a path to override the default seach path for CMake modules. For example include commands will look in this path first for modules to include.
This is an internal flag used by the generators in CMake to tell CMake to skip the _BUILD_TYPE flags.
Specifies a path which will be used by the FIND_XXX() commands. It contains the "base" directories, the FIND_XXX() commands append appropriate subdirectories to the base directories. So FIND_PROGRAM() adds /bin to each of the directories in the path, FIND_LIBRARY() appends /lib to each of the directories, and FIND_PATH() and FIND_FILE() append /include . By default it is empty, it is intended to be set by the project. See also CMAKE_SYSTEM_PREFIX_PATH, CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH, CMAKE_PROGRAM_PATH.
Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM() will check each of the contained directories for the existence of the program which is currently searched. By default it is empty, it is intended to be set by the project. See also CMAKE_SYSTEM_PROGRAM_PATH, CMAKE_PREFIX_PATH.
Specifies a path which will be used both by FIND_FILE() and FIND_PATH(). Both commands will check each of the contained directories for the existence of the file which is currently searched. By default it contains the standard directories for the current system. It is NOT intended to be modified by the project, use CMAKE_INCLUDE_PATH for this. See also CMAKE_SYSTEM_PREFIX_PATH.
Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY() will check each of the contained directories for the existence of the library which is currently searched. By default it contains the standard directories for the current system. It is NOT intended to be modified by the project, use CMAKE_SYSTEM_LIBRARY_PATH for this. See also CMAKE_SYSTEM_PREFIX_PATH.
Specifies a path which will be used by the FIND_XXX() commands. It contains the "base" directories, the FIND_XXX() commands append appropriate subdirectories to the base directories. So FIND_PROGRAM() adds /bin to each of the directories in the path, FIND_LIBRARY() appends /lib to each of the directories, and FIND_PATH() and FIND_FILE() append /include . By default this contains the standard directories for the current system. It is NOT intended to be modified by the project, use CMAKE_PREFIX_PATH for this. See also CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_SYSTEM_PROGRAM_PATH.
Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM() will check each of the contained directories for the existence of the program which is currently searched. By default it contains the standard directories for the current system. It is NOT intended to be modified by the project, use CMAKE_PROGRAM_PATH for this. See also CMAKE_SYSTEM_PREFIX_PATH.
If this variable is set, it should to point to a CMakeLists.txt file that will be read in by CMake after all the system settings have been set, but before they have been used. This would allow you to override any variables that need to be changed for some special project.
Set to true on Mac OSX.
This is set to true if the Borland compiler is being used.
Set to true when using the 64 bit cl compiler from Microsoft.
Set to true when using the Visual Studio 2005 compiler from Microsoft.
Set to true when the host system is Apple OSX.
The same as CMAKE_SYSTEM but for the host system instead of the target system when cross compiling.
The same as CMAKE_SYSTEM_NAME but for the host system instead of the target system when cross compiling.
The same as CMAKE_SYSTEM_PROCESSOR but for the host system instead of the target system when cross compiling.
The same as CMAKE_SYSTEM_VERSION but for the host system instead of the target system when cross compiling.
Set to true when the host system is UNIX or UNIX like (i.e. APPLE and CYGWIN).
Set to true when the host system is Windows and on cygwin.
CMake computes for every source file an object file name that is unique to the source file and deterministic with respect to the full path to the source file. This allows multiple source files in a target to share the same name if they lie in different directories without rebuilding when one is added or removed. However, it can produce long full paths in a few cases, so CMake shortens the path using a hashing scheme when the full path to an object file exceeds a limit. CMake has a built-in limit for each platform that is sufficient for common tools, but some native tools may have a lower limit. This variable may be set to specify the limit explicitly. The value must be an integer no less than 128.
This variable is the composite of CMAKE_SYSTEM_NAMEand CMAKE_SYSTEM_VERSION, like this ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}. If CMAKE_SYSTEM_VERSION is not set, then CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME.
This is the name of the operating system on which CMake is targeting. On systems that have the uname command, this variable is set to the output of uname -s. Linux, Windows, and Darwin for Mac OSX are the values found on the big three operating systems.
On systems that support uname, this variable is set to the output of uname -p, on windows it is set to the value of the environment variable PROCESSOR_ARCHITECTURE
A numeric version string for the system, on systems that support uname, this variable is set to the output of uname -r. On other systems this is set to major-minor version numbers.
Set to true when using CYGWIN.
Set to true when the compiler is some version of Microsoft Visual C.
Set to true when the compiler is version 8.0 of Microsoft Visual C.
Set to true when the target platform is the Microsoft Visual C IDE, as opposed to the command line compiler.
The version of Microsoft Visual C/C++ being used if any. For example 1300 is MSVC 6.0.
Set to true when the target system is UNIX or UNIX like (i.e. APPLE and CYGWIN).
Set to true when the target system is Windows and on cygwin.
When a non-executable target is created its <CONFIG>_POSTFIX target property is initialized with the value of this variable if it is set.
This variable is used to initialize the ARCHIVE_OUTPUT_DIRECTORY property on all the targets. See that target property for additional information.
Normally CMake uses the build tree for the RPATH when building executables etc on systems that use RPATH. When the software is installed the executables etc are relinked by CMake to have the install RPATH. If this variable is set to true then the software is always built with the install path for the RPATH and does not need to be relinked when installed.
This variable is a special case of the more-general CMAKE_<CONFIG>_POSTFIX variable for the DEBUG configuration.
Flags used by the linker when creating an executable.
Same as CMAKE_C_FLAGS_* but used by the linker when creating executables.
This variable is used to initialize the Fortran_MODULE_DIRECTORY property on all the targets. See that target property for additional information.
CMAKE_INSTALL_NAME_DIR is used to initialize the INSTALL_NAME_DIR property on all targets. See that target property for more information.
A semicolon-separated list specifying the rpath to use in installed targets (for platforms that support it). This is used to initialize the target property INSTALL_RPATH for all targets.
CMAKE_INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will append directories in the linker search path and outside the project to the INSTALL_RPATH. This is used to initialize the target property INSTALL_RPATH_USE_LINK_PATH for all targets.
This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY property on all the targets. See that target property for additional information.
The flag used to specify a library directory to the compiler. On most compilers this is "-L".
The flag used to add a .def file when creating a dll on Windows, this is only defined on Windows.
The flag used before a library file path is given to the linker. This is needed only on very few platforms.
The flag used to specify a library to link to an executable. On most compilers this is "-l".
This variable is used to initialize the RUNTIME_OUTPUT_DIRECTORY property on all the targets. See that target property for additional information.
Normally CMake uses the build tree for the RPATH when building executables etc on systems that use RPATH. When the software is installed the executables etc are relinked by CMake to have the install RPATH. If this variable is set to true then the software is always built with no RPATH.
If this is set to TRUE, then the CMake will use relative paths between the source and binary tree. This option does not work for more complicated projects, and relative paths are used when possible. In general, it is not possible to move CMake generated makefiles to a different location regardless of the value of this variable.
The target property RUNTIME_OUTPUT_DIRECTORY supercedes this variable for a target if it is set. Executable targets are otherwise placed in this directory.
The target properties ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY supercede this variable for a target if they are set. Library targets are otherwise placed in this directory.
This is a rule variable that tells CMake how to append to a static archive. It is used in place of CMAKE_<LANG>_CREATE_STATIC_LIBRARY on some platforms in order to support large object counts. See also CMAKE_<LANG>_ARCHIVE_CREATE and CMAKE_<LANG>_ARCHIVE_FINISH.
This is a rule variable that tells CMake how to create a static archive. It is used in place of CMAKE_<LANG>_CREATE_STATIC_LIBRARY on some platforms in order to support large object counts. See also CMAKE_<LANG>_ARCHIVE_APPEND and CMAKE_<LANG>_ARCHIVE_FINISH.
This is a rule variable that tells CMake how to finish a static archive. It is used in place of CMAKE_<LANG>_CREATE_STATIC_LIBRARY on some platforms in order to support large object counts. See also CMAKE_<LANG>_ARCHIVE_CREATE and CMAKE_<LANG>_ARCHIVE_APPEND.
This is the command that will be used as the <LANG> compiler. Once set, you can not change this variable.
This is used in determining the compiler ABI and is subject to change.
This is used in determining the compiler and is subject to change.
This is a rule variable that tells CMake how to compile a single object file for for the language <LANG>.
This is a rule variable that tells CMake how to create a shared library for the language <LANG>.
This is a rule variable that tells CMake how to create a shared library for the language <LANG>.
This is a rule variable that tells CMake how to create a static library for the language <LANG>.
<LANG> flags used when CMAKE_BUILD_TYPE is Debug.
<LANG> flags used when CMAKE_BUILD_TYPE is MinSizeRel.Short for minimum size release.
<LANG> flags used when CMAKE_BUILD_TYPE is Release
<LANG> flags used when CMAKE_BUILD_TYPE is RelWithDebInfo. Short for Release With Debug Information.
This is a list of file extensions that may be part of a project for a given language but are not compiled.
CMake does not explicitly specify these directories on compiler command lines for language <LANG>. This prevents system include directories from being treated as user include directories on some compilers.
If this is "Preferred" then if there is a mixed language shared library or executable, then this languages linker command will be used.
Rule variable to link and executable for the given language.
This is the extension for an object file for the given <LANG>. For example .obj for C on Windows.
This is used in determining the platform and is subject to change.
This is used in determining the architecture and is subject to change.
This is the list of extensions for a given languages source files.
If the selected <LANG> compiler is the GNU compiler then this is TRUE, if not it is FALSE.
This is used in determining the compiler ABI and is subject to change.
If this variable is set, it should to point to a CMakeLists.txt file that will be read in by CMake after all the system settings have been set, but before they have been used. This would allow you to override any variables that need to be changed for some language.
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The names of Kitware, Inc., the Insight Consortium, or the names of any consortium members, or of any contributors, may not be used to endorse or promote products derived from this software without specific prior written permission.
Modified source versions must be plainly marked as such, and must not be misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following resources are available to get help using CMake:
The primary starting point for learning about CMake.
A Wiki is provided containing answers to frequently asked questions.
Links to available documentation may be found on this web page.
For help and discussion about using cmake, a mailing list is provided at cmake@cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at http://www.cmake.org before posting questions to the list.
Summary of helpful links:
Home: http://www.cmake.org Docs: http://www.cmake.org/HTML/Documentation.html Mail: http://www.cmake.org/HTML/MailingLists.html FAQ: http://www.cmake.org/Wiki/CMake_FAQ