Back to Blog
Important cmake variables6/22/2023 It prints the results out in the form of XML. The script looks at the SystemInformation test output, and uses regular expressions to find the start and end of the “AllVariables.txt” section. Among other things, it lists the names and values of all of the CMake variables that are in use when the test is run. When a CMake dashboard is run, a “SystemInformation test” is usually run as well. The output of this script is rather raw, but it is a good starting point for finding more variables. Many – but not all of them – are also listed by this Dashboard script for extracting variables. Some things can be learned from inspecting the CMake source code. How does one find out about additional variables? The CMake mailing list is probably the best resource. This is a wiki, and other people can provide a better description as time goes on. Don’t worry about whether you have a precise description for it. If you know of a CMake variable that is not listed here, please edit the wiki and add it. Documenting all of them is an ongoing project. Variables not listed hereĬMake has many more variables than are listed above. Please note you can set these properties globally using SET or LIST, or for a single target using SET_TARGET_PROPERTIES. Expansion Rulesįrom examining the source code the following style names exist: ASSEMBLY_SOURCE FLAGS LANGUAGE_COMPILE_FLAGS LINK_FLAGS LINK_LIBRARIES OBJECT OBJECTS OBJECTS_QUOTED OBJECT_DIR PREPROCESSED_SOURCE SOURCE TARGET TARGET_BASE TARGET_IMPLIB TARGET_INSTALLNAME_DIR TARGET_PDB TARGET_QUOTED TARGET_SONAME TARGET_VERSION_MAJOR TARGET_VERSION_MINOR You should only do this if you know what you are doing and there is no other way. Usually you don’t have to change these rules, only in rare cases. replacing some flags in the linker command, but you can’t change the value of the variables in sharp braces. You can override the variables manually, e.g. Rules for C++ sources: CMAKE_CXX_CREATE_SHARED_LIBRARY CMAKE_CXX_CREATE_SHARED_MODULE CMAKE_CXX_CREATE_STATIC_LIBRARY CMAKE_CXX_COMPILE_OBJECT CMAKE_CXX_LINK_EXECUTABLEĪnd the equivalents for C sources: CMAKE_C_CREATE_SHARED_LIBRARY CMAKE_C_CREATE_SHARED_MODULE CMAKE_C_CREATE_STATIC_LIBRARY CMAKE_C_COMPILE_OBJECT CMAKE_C_LINK_EXECUTABLE Releases use tweak _POSTFIX Build rulesīuild rules are defined in CMakeCInformation.cmake and CMakeCXXInformation.cmake. the “3” in CMake 2.4.3 CMAKE_TWEAK_VERSION tweak version number for CMake, e.g. the “4” in CMake 2.4.3 CMAKE_PATCH_VERSION patch version number for CMake, e.g. the “2” in CMake 2.4.3 CMAKE_MINOR_VERSION minor version number for CMake, e.g. System & Compiler Information CMAKE_MAJOR_VERSION major version number for CMake, e.g. Since the value of CMAKE_INSTALL_PREFIX may be included in installed files it is important to use DESTDIR rather than changing CMAKE_INSTALL_PREFIX when it is necessary to install to a intermediate staging directory. This allows the files to be installed in an intermediate directory tree without changing the final installation path name. $) DESTDIR If this environment variable is set it will be prefixed to CMAKE_INSTALL_PREFIX in places where it is used to access files during installation. Typically used with the current binary directory, i.e. Note the leading slash for the directory. CMAKE_CURRENT_LIST_LINE this is linenumber where the variable is used.ĬMakeLists.txt contains the PROJECT() command CMAKE_CURRENT_SOURCE_DIR this is the directory where the currently processed CMakeLists.txt is located in CMAKE_FILES_DIRECTORY the directory within the current binary directory that contains all the CMake generated files. CMAKE_CURRENT_LIST_DIR (since 2.8.3) this is the directory of the listfile currently being processed. usr/local/bin/cmake) CMAKE_CURRENT_BINARY_DIR if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this is the directory where the compiled or generated files from the current CMakeLists.txt will go to CMAKE_CURRENT_LIST_FILE this is the full path to the listfile currently being processed. Locations CMAKE_BINARY_DIR if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise this is the top level directory of your build tree CMAKE_COMMAND this is the complete path of the cmake which runs currently (e.g. 6 Prefixes, Suffixes (Postfixes), and Extensions.
0 Comments
Read More
Leave a Reply. |