Lines Matching full:cmake

2 Building LLVM with CMake
11 `CMake <http://www.cmake.org/>`_ is a cross-platform build-generator tool. CMake
20 `Quick start`_ section. If you are a CMake novice, start with `Basic CMake usage`_
23 you already have experience with CMake, this is the recommended starting point.
25 This page is geared towards users of the LLVM CMake build. If you're looking for
26 information about modifying the LLVM CMake build system you may want to see the
27 :doc:`CMakePrimer` page. It has a basic overview of the CMake language.
34 We use here the command-line, non-interactive CMake interface.
36 #. `Download <http://www.cmake.org/cmake/resources/software.html>`_ and install
37 CMake. Version 3.20.0 is the minimum required.
55 $ cmake path/to/llvm/source/root
57 CMake will detect your development environment, perform a series of tests, and
58 generate the files required for building LLVM. CMake will use default values
62 This can fail if CMake can't detect your toolset, or if it thinks that the
65 itself is the correct one for your development environment. CMake will refuse
67 environment variable, for instance. You can force CMake to use a given build
73 #. After CMake has finished running, proceed to use IDE project files, or start
78 $ cmake --build .
80 The ``--build`` option tells ``cmake`` to invoke the underlying build
90 $ cmake --build . --target install
93 the ``--build`` option tells ``cmake`` to build the ``install`` target.
96 by invoking the ``cmake_install.cmake`` script generated in the
101 $ cmake -DCMAKE_INSTALL_PREFIX=/tmp/llvm -P cmake_install.cmake
103 .. _Basic CMake usage:
106 Basic CMake usage
109 This section explains basic aspects of CMake
112 CMake comes with extensive documentation, in the form of html files, and as
113 online help accessible via the ``cmake`` executable itself. Execute ``cmake
116 CMake allows you to specify a build tool (e.g., GNU make, Visual Studio,
117 or Xcode). If not specified on the command line, CMake tries to guess which
119 build tool, CMake uses the corresponding *Generator* to create files for your
126 $ cmake --help
131 you should enter them exactly as they are listed in the ``cmake --help``
137 $ cmake -G "Visual Studio 12" path/to/llvm/source/root
141 for building with NMake. By default, CMake chooses the most specific generator
143 you must tell this to CMake with the ``-G`` option.
156 CMake command line like this:
160 $ cmake -DVARIABLE=value path/to/llvm/source
162 You can set a variable after the initial CMake invocation to change its
167 $ cmake -UVARIABLE path/to/llvm/source
169 Variables are stored in the CMake cache. This is a file named ``CMakeCache.txt``
170 stored at the root of your build directory that is generated by ``cmake``.
173 Variables are listed in the CMake cache and later in this document with
175 variable and type on the CMake command line:
179 $ cmake -DVARIABLE:TYPE=value path/to/llvm/source
183 Frequently-used CMake variables
186 Here are some of the CMake variables that are used often, along with a
187 brief explanation. For full documentation, consult the CMake manual,
188 or execute ``cmake --help-variable VARIABLE_NAME``. See `Frequently
221 Note: on Windows (building with MSVC or clang-cl), CMake's **RelWithDebInfo**
234 compilers installed, CMake might not default to the one you wish to
276 Rarely-used CMake variables
279 Here are some of the CMake variables that are rarely used, along with a brief
280 explanation and LLVM-related notes. For full documentation, consult the CMake
281 manual, or execute ``cmake --help-variable VARIABLE_NAME``.
377 is enabled while building llvm. If CMake can locate the code coverage
420 constructed using the LLVM build's CMake export list.
428 macOS Only: If enabled CMake will generate a target named
449 The path to the ``qhelpgenerator`` executable. Defaults to whatever CMake's
456 more information. Defaults to the CMake variable ``${PACKAGE_STRING}`` which
620 If specified, CMake will search for the ``sphinx-build`` executable and will make
621 the ``SPHINX_OUTPUT_HTML`` and ``SPHINX_OUTPUT_MAN`` CMake options available.
746 $ D:\llvm-project> cmake ... -DLLVM_INTEGRATED_CRT_ALLOC=D:\git\rpmalloc
787 Defaults to ``OFF``. If set to ``ON``, CMake's default logic for library IDs
789 IDs will be used in the build tree as well. Mainly useful when other CMake
794 If enabled and building a debug or asserts build the CMake build system will
878 search. For example to link LLVM with the Gold linker, cmake can be invoked
901 If enabled CMake will pass ``-gsplit-dwarf`` to the compiler. This option
907 The path to the ``sphinx-build`` executable detected by CMake.
948 CMake Caches
953 CMake variables passed on the command line. Clang provides a collection of CMake
956 CMake cache files are utilized using CMake's -C flag:
960 $ cmake -C <path to cache file> <path to sources>
962 CMake cache scripts are processed in an isolated scope, only cached variables
963 remain set when the main configuration runs. CMake cached variables do not reset
966 A few notes about CMake Caches:
999 See `this wiki page <https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling>`_ for
1000 generic instructions on how to cross-compile with CMake. It goes into detailed
1012 From LLVM 3.5 onwards the CMake build system exports LLVM libraries as
1013 importable CMake targets. This means that clients of LLVM can now reliably use
1014 CMake to develop their own LLVM-based projects against an installed version of
1020 .. code-block:: cmake
1028 message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
1050 example) will look for the ``LLVMConfig.cmake`` file in various locations (see
1051 cmake manual for details). It creates a ``LLVM_DIR`` cache entry to save the
1052 directory where ``LLVMConfig.cmake`` is found or allows the user to specify the
1053 directory (e.g. by passing ``-DLLVM_DIR=/usr/lib/cmake/llvm`` to
1054 the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
1058 * ``<LLVM_INSTALL_PACKAGE_DIR>/LLVMConfig.cmake`` where
1059 ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
1061 ``cmake/llvm/`` within the lib directory. On Linux, this is typically
1062 ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
1064 * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
1066 available when building LLVM with CMake.**
1074 The ``LLVMConfig.cmake`` file sets various useful variables. Notable variables
1078 The path to the LLVM CMake directory (i.e. the directory containing
1079 LLVMConfig.cmake).
1099 The LLVM version. This string can be used with CMake conditionals, e.g., ``if
1107 ``llvm_map_components_to_libnames()`` CMake function. For a list of available
1135 .. code-block:: cmake
1147 .. code-block:: cmake
1159 .. code-block:: cmake
1166 .. code-block:: cmake
1191 Studio 2010 CMake generator. 0 means use all processors. Default is 0.
1194 When compiling with clang-cl, recent CMake versions will default to selecting