xref: /llvm-project/llvm/docs/CommandGuide/llvm-config.rst (revision c061892fcdbdfe46884c54a7a7bfe6df54d1df12)
1llvm-config - Print LLVM compilation options
2============================================
3
4.. program:: llvm-config
5
6SYNOPSIS
7--------
8
9**llvm-config** *option* [*components*...]
10
11DESCRIPTION
12-----------
13
14**llvm-config** makes it easier to build applications that use LLVM.  It can
15print the compiler flags, linker flags and object libraries needed to link
16against LLVM.
17
18EXAMPLES
19--------
20
21To link against the JIT:
22
23.. code-block:: sh
24
25   g++ `llvm-config --cxxflags` -o HowToUseJIT.o -c HowToUseJIT.cpp
26   g++ `llvm-config --ldflags` -o HowToUseJIT HowToUseJIT.o \
27       `llvm-config --libs engine bcreader scalaropts`
28
29OPTIONS
30-------
31
32**--assertion-mode**
33
34 Print the assertion mode used when LLVM was built (ON or OFF).
35
36**--bindir**
37
38 Print the installation directory for LLVM binaries.
39
40**--build-mode**
41
42 Print the build mode used when LLVM was built (e.g. Debug or Release).
43
44**--build-system**
45
46 Print the build system used to build LLVM (e.g. `cmake` or `gn`).
47
48**--cflags**
49
50 Print the C compiler flags needed to use LLVM headers.
51
52**--cmakedir**
53
54 Print the installation directory for LLVM CMake modules.
55
56**--components**
57
58 Print all valid component names.
59
60**--cppflags**
61
62 Print the C preprocessor flags needed to use LLVM headers.
63
64**--cxxflags**
65
66 Print the C++ compiler flags needed to use LLVM headers.
67
68**--has-rtti**
69
70 Print whether or not LLVM was built with rtti (YES or NO).
71
72**--help**
73
74 Print a summary of **llvm-config** arguments.
75
76**--host-target**
77
78 Print the target triple used to configure LLVM.
79
80**--ignore-libllvm**
81
82 Ignore libLLVM and link component libraries instead.
83
84**--includedir**
85
86 Print the installation directory for LLVM headers.
87
88**--ldflags**
89
90 Print the flags needed to link against LLVM libraries.
91
92**--libdir**
93
94 Print the installation directory for LLVM libraries.
95
96**--libfiles**
97
98 Similar to **--libs**, but print the full path to each library file.  This is
99 useful when creating makefile dependencies, to ensure that a tool is relinked if
100 any library it uses changes.
101
102**--libnames**
103
104 Similar to **--libs**, but prints the bare filenames of the libraries
105 without **-l** or pathnames.  Useful for linking against a not-yet-installed
106 copy of LLVM.
107
108**--libs**
109
110 Print all the libraries needed to link against the specified LLVM
111 *components*, including any dependencies.
112
113**--link-shared**
114
115 Link the components as shared libraries.
116
117**--link-static**
118
119 Link the component libraries statically.
120
121**--obj-root**
122
123 Print the object root used to build LLVM.
124
125**--prefix**
126
127 Print the installation prefix for LLVM.
128
129**--shared-mode**
130
131 Print how the provided components can be collectively linked (`shared` or `static`).
132
133**--system-libs**
134
135 Print all the system libraries needed to link against the specified LLVM
136 *components*, including any dependencies.
137
138**--targets-built**
139
140 Print the component names for all targets supported by this copy of LLVM.
141
142**--version**
143
144 Print the version number of LLVM.
145
146
147COMPONENTS
148----------
149
150To print a list of all available components, run **llvm-config
151--components**.  In most cases, components correspond directly to LLVM
152libraries.  Useful "virtual" components include:
153
154**all**
155
156 Includes all LLVM libraries.  The default if no components are specified.
157
158**backend**
159
160 Includes either a native backend or the C backend.
161
162**engine**
163
164 Includes either a native JIT or the bitcode interpreter.
165
166
167EXIT STATUS
168-----------
169
170If **llvm-config** succeeds, it will exit with 0.  Otherwise, if an error
171occurs, it will exit with a non-zero value.
172