@@ -40,7 +40,7 @@ We use here the command-line, non-interactive CMake interface.
40
40
through the ``PATH `` environment variable.
41
41
42
42
#. Create a build directory. Building LLVM in the source
43
- directory is not supported. cd to this directory:
43
+ directory is not supported. `` cd `` to this directory:
44
44
45
45
.. code-block :: console
46
46
@@ -108,7 +108,7 @@ Basic CMake usage
108
108
109
109
This section explains basic aspects of CMake for daily use.
110
110
111
- CMake comes with extensive documentation, in the form of html files, and as
111
+ CMake comes with extensive documentation, in the form of HTML files, and as
112
112
online help accessible via the ``cmake `` executable itself. Execute ``cmake
113
113
--help `` for further help options.
114
114
@@ -139,7 +139,7 @@ A given development platform can have more than one adequate
139
139
generator. If you use Visual Studio, "NMake Makefiles" is a generator you can use
140
140
for building with NMake. By default, CMake chooses the most specific generator
141
141
supported by your development environment. If you want an alternative generator,
142
- you must tell this to CMake with the ``-G `` option.
142
+ you must specify this to CMake with the ``-G `` option.
143
143
144
144
.. todo ::
145
145
@@ -206,7 +206,7 @@ used variables that control features of LLVM and enabled subprojects.
206
206
207
207
* Optimizations make LLVM/Clang run faster but can be an impediment for
208
208
step-by-step debugging.
209
- * Builds with debug information can use a lot of RAM and disk space and is
209
+ * Builds with debug information can use a lot of RAM and disk space and are
210
210
usually slower to run. You can improve RAM usage by using ``lld ``, see
211
211
the :ref: `LLVM_USE_LINKER <llvm_use_linker >` option.
212
212
* Assertions are internal checks to help you find bugs. They typically slow
@@ -257,10 +257,10 @@ description is in `LLVM-related variables`_ below.
257
257
258
258
**LLVM_PARALLEL_{COMPILE,LINK}_JOBS **:STRING
259
259
Building the llvm toolchain can use a lot of resources, particularly
260
- linking. These options, when you use the Ninja generator, allow you
260
+ during linking. These options, when you use the Ninja generator, allow you
261
261
to restrict the parallelism. For example, to avoid OOMs or going
262
- into swap, permit only one link job per 15GB of RAM available on a
263
- 32GB machine, specify ``-G Ninja -DLLVM_PARALLEL_LINK_JOBS=2 ``.
262
+ into swap, permit only one link job per 15 GB of RAM available on a
263
+ 32 GB machine, specify ``-G Ninja -DLLVM_PARALLEL_LINK_JOBS=2 ``.
264
264
265
265
**LLVM_TARGETS_TO_BUILD **:STRING
266
266
Control which targets are enabled. For example, you may only need to enable
@@ -324,13 +324,13 @@ its enabled sub-projects. Nearly all of these variable names begin with
324
324
Used to decide if LLVM should be built with ABI breaking checks or
325
325
not. Allowed values are `WITH_ASSERTS ` (default), `FORCE_ON ` and
326
326
`FORCE_OFF `. `WITH_ASSERTS ` turns on ABI breaking checks in an
327
- assertion enabled build. `FORCE_ON ` (`FORCE_OFF `) turns them on
327
+ assertion- enabled build. `FORCE_ON ` (`FORCE_OFF `) turns them on
328
328
(off) irrespective of whether normal (`NDEBUG `-based) assertions are
329
329
enabled or not. A version of LLVM built with ABI breaking checks
330
330
is not ABI compatible with a version built without it.
331
331
332
332
**LLVM_ADDITIONAL_BUILD_TYPES **:LIST
333
- Adding a semicolon separated list of additional build types to this flag
333
+ Adding a semicolon- separated list of additional build types to this flag
334
334
allows for them to be specified as values in ``CMAKE_BUILD_TYPE `` without
335
335
encountering a fatal error during the configuration process.
336
336
@@ -346,7 +346,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
346
346
determine it.
347
347
348
348
**LLVM_FORCE_VC_REVISION **:STRING
349
- Force a specific Git revision id rather than calling to git to determine it.
349
+ Force a specific Git revision id rather than calling git to determine it.
350
350
This is useful in environments where git is not available or non-functional
351
351
but the VC revision is available through other means.
352
352
@@ -358,9 +358,9 @@ its enabled sub-projects. Nearly all of these variable names begin with
358
358
Adds benchmarks to the list of default targets. Defaults to OFF.
359
359
360
360
**LLVM_BUILD_DOCS **:BOOL
361
- Adds all *enabled * documentation targets (i.e. Doxygen and Sphinx targets) as
361
+ Adds all *enabled * documentation targets (i.e., Doxygen and Sphinx targets) as
362
362
dependencies of the default build targets. This results in all of the (enabled)
363
- documentation targets being as part of a normal build. If the ``install ``
363
+ documentation targets being built as part of a normal build. If the ``install ``
364
364
target is run, then this also enables all built documentation targets to be
365
365
installed. Defaults to OFF. To enable a particular documentation target, see
366
366
``LLVM_ENABLE_SPHINX `` and ``LLVM_ENABLE_DOXYGEN ``.
@@ -414,17 +414,17 @@ its enabled sub-projects. Nearly all of these variable names begin with
414
414
variables, respectively.
415
415
416
416
**LLVM_CODE_COVERAGE_TARGETS **:STRING
417
- If set to a semicolon separated list of targets, those targets will be used
417
+ If set to a semicolon- separated list of targets, those targets will be used
418
418
to drive the code coverage reports. If unset, the target list will be
419
419
constructed using the LLVM build's CMake export list.
420
420
421
421
**LLVM_COVERAGE_SOURCE_DIRS **:STRING
422
- If set to a semicolon separated list of directories, the coverage reports
422
+ If set to a semicolon- separated list of directories, the coverage reports
423
423
will limit code coverage summaries to just the listed directories. If unset,
424
424
coverage reports will include all sources identified by the tooling.
425
425
426
426
**LLVM_CREATE_XCODE_TOOLCHAIN **:BOOL
427
- macOS Only : If enabled, CMake will generate a target named
427
+ macOS only : If enabled, CMake will generate a target named
428
428
'install-xcode-toolchain'. This target will create a directory at
429
429
``$CMAKE_INSTALL_PREFIX/Toolchains `` containing an xctoolchain directory which can
430
430
be used to override the default system tools.
@@ -588,8 +588,8 @@ its enabled sub-projects. Nearly all of these variable names begin with
588
588
Semicolon-separated list of projects to build, or *all * for building all
589
589
(clang, lldb, lld, polly, etc) projects. This flag assumes that projects
590
590
are checked out side-by-side and not nested, i.e. clang needs to be in
591
- parallel of llvm instead of nested in ``llvm/tools ``. This feature allows
592
- to have one build for only LLVM and another for clang+llvm using the same
591
+ parallel to llvm instead of nested in ``llvm/tools ``. This feature allows
592
+ having one build for only LLVM and another for clang+llvm using the same
593
593
source checkout.
594
594
595
595
The full list is:
@@ -657,11 +657,11 @@ its enabled sub-projects. Nearly all of these variable names begin with
657
657
**LLVM_EXPERIMENTAL_TARGETS_TO_BUILD **:STRING
658
658
Semicolon-separated list of experimental targets to build and linked into
659
659
llvm. This will build the experimental target without needing it to add to the
660
- list of all the targets available in the LLVM's main CMakeLists.txt.
660
+ list of all the targets available in the LLVM's main `` CMakeLists.txt `` .
661
661
662
662
**LLVM_EXTERNAL_PROJECTS **:STRING
663
663
Semicolon-separated list of additional external projects to build as part of
664
- llvm. For each project LLVM_EXTERNAL_<NAME>_SOURCE_DIR have to be specified
664
+ llvm. For each project, `` LLVM_EXTERNAL_<NAME>_SOURCE_DIR `` has to be specified
665
665
with the path for the source code of the project. Example:
666
666
``-DLLVM_EXTERNAL_PROJECTS="Foo;Bar"
667
667
-DLLVM_EXTERNAL_FOO_SOURCE_DIR=/src/foo
@@ -676,7 +676,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
676
676
to a valid path, then that project will not be built.
677
677
678
678
**LLVM_EXTERNALIZE_DEBUGINFO **:BOOL
679
- Generate dSYM files and strip executables and libraries (Darwin Only ).
679
+ Generate dSYM files and strip executables and libraries (Darwin only ).
680
680
Defaults to OFF.
681
681
682
682
**LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES **:BOOL
@@ -751,7 +751,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
751
751
$ D:\git> git clone https://github.com/mjansson/rpmalloc
752
752
$ D:\llvm-project> cmake ... -DLLVM_INTEGRATED_CRT_ALLOC=D:\git\rpmalloc
753
753
754
- This option needs to be used along with the static CRT, ie. if building the
754
+ This option needs to be used along with the static CRT, i.e., if building the
755
755
Release target, add ``-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ``.
756
756
Note that rpmalloc is also supported natively in-tree, see option below.
757
757
@@ -778,7 +778,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
778
778
**LLVM_LIT_TOOLS_DIR **:PATH
779
779
The path to GnuWin32 tools for tests. Valid on Windows host. Defaults to
780
780
the empty string, in which case lit will look for tools needed for tests
781
- (e.g. ``grep ``, ``sort ``, etc.) in your ``%PATH% ``. If GnuWin32 is not in your
781
+ (e.g., ``grep ``, ``sort ``, etc.) in your ``%PATH% ``. If GnuWin32 is not in your
782
782
``%PATH% ``, then you can set this variable to the GnuWin32 directory so that
783
783
lit can find tools needed for tests in that directory.
784
784
@@ -797,7 +797,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
797
797
set to non-standard values.
798
798
799
799
**LLVM_OPTIMIZED_TABLEGEN **:BOOL
800
- If enabled and building a debug or asserts build, the CMake build system will
800
+ If enabled and building a debug or assert build, the CMake build system will
801
801
generate a Release build tree to build a fully optimized tablegen for use
802
802
during the build. Enabling this option can significantly speed up build times,
803
803
especially when building LLVM in Debug configurations.
@@ -818,7 +818,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
818
818
``LLVM_PARALLEL_{COMPILE,LINK,TABLEGEN}_JOBS `` variable is
819
819
overwritten by computing the memory size divided by the
820
820
specified value. The largest memory user is linking, but remember
821
- that jobs in the other categories might run in parallel to the link
821
+ that jobs in the other categories might run in parallel with the link
822
822
jobs, and you need to consider their memory requirements when
823
823
in a memory-limited environment. Using a
824
824
``-DLLVM_RAM_PER_LINK_JOB=10000 `` is a good approximation. On ELF
@@ -869,7 +869,7 @@ its enabled sub-projects. Nearly all of these variable names begin with
869
869
the default set of UBSan flags.
870
870
871
871
**LLVM_UNREACHABLE_OPTIMIZE **:BOOL
872
- This flag controls the behavior of ``llvm_unreachable() `` in release build
872
+ This flag controls the behavior of ``llvm_unreachable() `` in a release build
873
873
(when assertions are disabled in general). When ON (default) then
874
874
``llvm_unreachable() `` is considered "undefined behavior" and optimized as
875
875
such. When OFF it is instead replaced with a guaranteed "trap".
@@ -879,9 +879,9 @@ its enabled sub-projects. Nearly all of these variable names begin with
879
879
880
880
**LLVM_USE_LINKER **:STRING
881
881
Add ``-fuse-ld={name} `` to the link invocation. The possible values depend on
882
- your compiler, for clang the value can be an absolute path to your custom
882
+ your compiler. For clang, the value can be an absolute path to your custom
883
883
linker, otherwise clang will prefix the name with ``ld. `` and apply its usual
884
- search. For example to link LLVM with the Gold linker, cmake can be invoked
884
+ search. For example, to link LLVM with the Gold linker, cmake can be invoked
885
885
with ``-DLLVM_USE_LINKER=gold ``.
886
886
887
887
**LLVM_USE_OPROFILE **:BOOL
@@ -892,11 +892,11 @@ its enabled sub-projects. Nearly all of these variable names begin with
892
892
893
893
**LLVM_USE_RELATIVE_PATHS_IN_FILES **:BOOL
894
894
Rewrite absolute source paths in sources and debug info to relative ones. The
895
- source prefix can be adjusted via the LLVM_SOURCE_PREFIX variable.
895
+ source prefix can be adjusted via the `` LLVM_SOURCE_PREFIX `` variable.
896
896
897
897
**LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO **:BOOL
898
898
Rewrite absolute source paths in debug info to relative ones. The source prefix
899
- can be adjusted via the LLVM_SOURCE_PREFIX variable.
899
+ can be adjusted via the `` LLVM_SOURCE_PREFIX `` variable.
900
900
901
901
**LLVM_USE_SANITIZER **:STRING
902
902
Define the sanitizer used to build LLVM binaries and tests. Possible values
@@ -916,9 +916,9 @@ its enabled sub-projects. Nearly all of these variable names begin with
916
916
917
917
**SPHINX_OUTPUT_HTML **:BOOL
918
918
If enabled (and ``LLVM_ENABLE_SPHINX `` is enabled) then the targets for
919
- building the documentation as html are added (but not built by default unless
919
+ building the documentation as HTML are added (but not built by default unless
920
920
``LLVM_BUILD_DOCS `` is enabled). There is a target for each project in the
921
- source tree that uses sphinx (e.g. ``docs-llvm-html ``, ``docs-clang-html ``
921
+ source tree that uses sphinx (e.g., ``docs-llvm-html ``, ``docs-clang-html ``
922
922
and ``docs-lld-html ``). Defaults to ON.
923
923
924
924
**SPHINX_OUTPUT_MAN **:BOOL
@@ -973,15 +973,15 @@ A few notes about CMake Caches:
973
973
974
974
- Order of command line arguments is important
975
975
976
- - ``-D `` arguments specified before -C are set before the cache is processed and
976
+ - ``-D `` arguments specified before `` -C `` are set before the cache is processed and
977
977
can be read inside the cache file
978
- - ``-D `` arguments specified after -C are set after the cache is processed and
978
+ - ``-D `` arguments specified after `` -C `` are set after the cache is processed and
979
979
are unset inside the cache file
980
980
981
981
- All ``-D `` arguments will override cache file settings
982
982
- CMAKE_TOOLCHAIN_FILE is evaluated after both the cache file and the command
983
983
line arguments
984
- - It is recommended that all ``-D `` options should be specified *before * -C
984
+ - It is recommended that all ``-D `` options be specified *before * `` -C ``
985
985
986
986
For more information about some of the advanced build configurations supported
987
987
via Cache files see :doc: `AdvancedBuilds `.
@@ -1004,7 +1004,7 @@ Cross compiling
1004
1004
1005
1005
See `this wiki page <https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling >`_ for
1006
1006
generic instructions on how to cross-compile with CMake. It goes into detailed
1007
- explanations and may seem daunting, but it is not. On the wiki page there are
1007
+ explanations and may seem daunting, but it is not. The wiki page has
1008
1008
several examples including toolchain files. Go directly to the
1009
1009
``Information how to set up various cross compiling toolchains `` section
1010
1010
for a quick solution.
@@ -1015,12 +1015,12 @@ cross-compiling.
1015
1015
Embedding LLVM in your project
1016
1016
==============================
1017
1017
1018
- From LLVM 3.5 onwards the CMake build system exports LLVM libraries as
1018
+ From LLVM 3.5 onward, the CMake build system exports LLVM libraries as
1019
1019
importable CMake targets. This means that clients of LLVM can now reliably use
1020
1020
CMake to develop their own LLVM-based projects against an installed version of
1021
1021
LLVM regardless of how it was built.
1022
1022
1023
- Here is a simple example of a CMakeLists.txt file that imports the LLVM libraries
1023
+ Here is a simple example of a `` CMakeLists.txt `` file that imports the LLVM libraries
1024
1024
and uses them to build a simple application ``simple-tool ``.
1025
1025
1026
1026
.. code-block :: cmake
@@ -1054,9 +1054,9 @@ and uses them to build a simple application ``simple-tool``.
1054
1054
1055
1055
The ``find_package(...) `` directive when used in CONFIG mode (as in the above
1056
1056
example) will look for the ``LLVMConfig.cmake `` file in various locations (see
1057
- cmake manual for details). It creates an ``LLVM_DIR `` cache entry to save the
1057
+ CMake manual for details). It creates an ``LLVM_DIR `` cache entry to save the
1058
1058
directory where ``LLVMConfig.cmake `` is found or allows the user to specify the
1059
- directory (e.g. by passing ``-DLLVM_DIR=/usr/lib/cmake/llvm `` to
1059
+ directory (e.g., by passing ``-DLLVM_DIR=/usr/lib/cmake/llvm `` to
1060
1060
the ``cmake `` command or by setting it directly in ``ccmake `` or ``cmake-gui ``).
1061
1061
1062
1062
This file is available in two different locations.
@@ -1081,7 +1081,7 @@ The ``LLVMConfig.cmake`` file sets various useful variables. Notable variables
1081
1081
include:
1082
1082
1083
1083
``LLVM_CMAKE_DIR ``
1084
- The path to the LLVM CMake directory (i.e. the directory containing
1084
+ The path to the LLVM CMake directory (i.e., the directory containing
1085
1085
``LLVMConfig.cmake ``).
1086
1086
1087
1087
``LLVM_DEFINITIONS ``
@@ -1106,7 +1106,7 @@ include:
1106
1106
(${LLVM_PACKAGE_VERSION} VERSION_LESS "3.5") ``.
1107
1107
1108
1108
``LLVM_TOOLS_BINARY_DIR ``
1109
- The path to the directory containing the LLVM tools (e.g. ``llvm-as ``).
1109
+ The path to the directory containing the LLVM tools (e.g., ``llvm-as ``).
1110
1110
1111
1111
Notice that in the above example we link ``simple-tool `` against several LLVM
1112
1112
libraries. The list of libraries is determined by using the
@@ -1122,7 +1122,7 @@ and will be removed in a future version of LLVM.
1122
1122
Developing LLVM passes out of source
1123
1123
------------------------------------
1124
1124
1125
- You can develop LLVM passes out of LLVM's source tree (i.e. against an
1125
+ You can develop LLVM passes out of LLVM's source tree (i.e., against an
1126
1126
installed or built LLVM). An example of a project layout is provided below.
1127
1127
1128
1128
.. code-block :: none
@@ -1197,6 +1197,6 @@ Windows
1197
1197
Studio 2010 CMake generator. 0 means use all processors. Default is 0.
1198
1198
1199
1199
**CMAKE_MT **:STRING
1200
- When compiling with clang-cl, CMake may use `llvm-mt ` as the Manifest Tool
1201
- when available. `llvm-mt ` is only present when libxml2 is found at build-time.
1200
+ When compiling with clang-cl, CMake may use `` llvm-mt ` ` as the Manifest Tool
1201
+ when available. `` ` llvm-mt` ` ` is only present when libxml2 is found at build-time.
1202
1202
To ensure using Microsoft's Manifest Tool set `CMAKE_MT=mt `.
0 commit comments