1CMAKE-GENERATORS(7)                  CMake                 CMAKE-GENERATORS(7)
2
3
4

NAME

6       cmake-generators - CMake Generators Reference
7

INTRODUCTION

9       A  CMake  Generator  is  responsible  for writing the input files for a
10       native build system.  Exactly one  of  the  CMake  Generators  must  be
11       selected  for  a build tree to determine what native build system is to
12       be used.  Optionally one of the Extra Generators may be selected  as  a
13       variant  of  some  of the Command-Line Build Tool Generators to produce
14       project files for an auxiliary IDE.
15
16       CMake Generators are platform-specific so each may be available only on
17       certain  platforms.  The cmake(1) command-line tool --help output lists
18       available generators on the current platform.  Use  its  -G  option  to
19       specify  the  generator  for a new build tree.  The cmake-gui(1) offers
20       interactive selection of a generator when creating a new build tree.
21

CMAKE GENERATORS

23   Command-Line Build Tool Generators
24       These generators support command-line build tools.   In  order  to  use
25       them,  one  must launch CMake from a command-line prompt whose environ‐
26       ment is already configured for the chosen compiler and build tool.
27
28   Makefile Generators
29   Borland Makefiles
30       Generates Borland makefiles.
31
32   MSYS Makefiles
33       Generates makefiles for use with MSYS make under the MSYS shell.
34
35       Use this generator in a MSYS shell prompt and using make as  the  build
36       tool.  The generated makefiles use /bin/sh as the shell to launch build
37       rules.  They are not compatible with a Windows command prompt.
38
39       To build under a Windows command prompt, use the MinGW Makefiles gener‐
40       ator.
41
42   MinGW Makefiles
43       Generates  makefiles  for use with mingw32-make under a Windows command
44       prompt.
45
46       Use this generator under a Windows command prompt  with  MinGW  in  the
47       PATH and using mingw32-make as the build tool.  The generated makefiles
48       use cmd.exe as the shell to launch build rules.  They are not  compati‐
49       ble with MSYS or a unix shell.
50
51       To build under the MSYS shell, use the MSYS Makefiles generator.
52
53   NMake Makefiles
54       Generates NMake makefiles.
55
56   NMake Makefiles JOM
57       Generates JOM makefiles.
58
59   Unix Makefiles
60       Generates standard UNIX makefiles.
61
62       A  hierarchy  of  UNIX makefiles is generated into the build tree.  Any
63       standard UNIX-style make program can  build  the  project  through  the
64       default make target.  A “make install” target is also provided.
65
66   Watcom WMake
67       Generates Watcom WMake makefiles.
68
69   Ninja Generator
70   Ninja
71       Generates build.ninja files.
72
73       A  build.ninja  file is generated into the build tree.  Recent versions
74       of the ninja program can build the project through  the  “all”  target.
75       An “install” target is also provided.
76
77       For  each  subdirectory  sub/dir of the project, additional targets are
78       generated:
79
80       sub/dir/all
81              Depends on all targets required by the subdirectory.
82
83       sub/dir/install
84              Runs the install step in the subdirectory, if any.
85
86       sub/dir/test
87              Runs the test step in the subdirectory, if any.
88
89       sub/dir/package
90              Runs the package step in the subdirectory, if any.
91
92   Fortran Support
93       The Ninja generator conditionally supports Fortran when the ninja  tool
94       has the required features.  As of this version of CMake the needed fea‐
95       tures have not been integrated into upstream Ninja.  Kitware  maintains
96       a    branch    of    Ninja    with    the    required    features    on
97       github.com/Kitware/ninja.
98
99   IDE Build Tool Generators
100       These  generators  support  Integrated  Development  Environment  (IDE)
101       project  files.  Since the IDEs configure their own environment one may
102       launch CMake from any environment.
103
104   Visual Studio Generators
105   Visual Studio 6
106       Removed.  This once generated Visual Studio 6 project  files,  but  the
107       generator  has  been  removed since CMake 3.6.  It is still possible to
108       build with VS 6 tools using the NMake Makefiles generator.
109
110   Visual Studio 7
111       Removed.  This once generated Visual Studio .NET  2002  project  files,
112       but the generator has been removed since CMake 3.6.  It is still possi‐
113       ble to build with VS 7.0 tools using the NMake Makefiles generator.
114
115   Visual Studio 7 .NET 2003
116       Removed.  This once generated Visual Studio .NET  2003  project  files,
117       but the generator has been removed since CMake 3.9.  It is still possi‐
118       ble to build with VS 7.1 tools using the NMake Makefiles generator.
119
120   Visual Studio 8 2005
121       Deprecated.  Generates Visual Studio 8 2005 project files.
122
123       NOTE:
124          This generator is deprecated and will be removed in a future version
125          of  CMake.   It will still be possible to build with VS 8 2005 tools
126          using the Visual Studio 10 2010 (or above) generator with CMAKE_GEN‐
127          ERATOR_TOOLSET  set  to v80, or by using the NMake Makefiles genera‐
128          tor.
129
130       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
131       platform name.
132
133       For  compatibility  with CMake versions prior to 3.1, one may specify a
134       target platform name optionally at the end of this generator name:
135
136       Visual Studio 8 2005 Win64
137              Specify target platform x64.
138
139       Visual Studio 8 2005 <WinCE-SDK>
140              Specify target platform matching a Windows CE SDK name.
141
142   Visual Studio 9 2008
143       Generates Visual Studio 9 2008 project files.
144
145       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
146       platform name.
147
148       For  compatibility  with CMake versions prior to 3.1, one may specify a
149       target platform name optionally at the end of this generator name:
150
151       Visual Studio 9 2008 Win64
152              Specify target platform x64.
153
154       Visual Studio 9 2008 IA64
155              Specify target platform Itanium.
156
157       Visual Studio 9 2008 <WinCE-SDK>
158              Specify target platform matching a Windows CE SDK name.
159
160   Visual Studio 10 2010
161       Generates Visual Studio 10 (VS 2010) project files.
162
163       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
164       platform name (architecture).
165
166       For  compatibility  with CMake versions prior to 3.1, one may specify a
167       target platform name optionally at the end of this generator name:
168
169       Visual Studio 10 2010 Win64
170              Specify target platform x64.
171
172       Visual Studio 10 2010 IA64
173              Specify target platform Itanium.
174
175       For compatibility with CMake versions prior to  3.0,  one  may  specify
176       this  generator using the name Visual Studio 10 without the year compo‐
177       nent.
178
179   Toolset Selection
180       The v100 toolset that comes with Visual Studio 10 2010 is  selected  by
181       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
182       the cmake(1) -T option, to specify another toolset.
183
184   Visual Studio 11 2012
185       Generates Visual Studio 11 (VS 2012) project files.
186
187       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
188       platform name (architecture).
189
190       For  compatibility  with CMake versions prior to 3.1, one may specify a
191       target platform name optionally at the end of this generator name:
192
193       Visual Studio 11 2012 Win64
194              Specify target platform x64.
195
196       Visual Studio 11 2012 ARM
197              Specify target platform ARM.
198
199       Visual Studio 11 2012 <WinCE-SDK>
200              Specify target platform matching a Windows CE SDK name.
201
202       For compatibility with CMake versions prior to  3.0,  one  may  specify
203       this  generator using the name “Visual Studio 11” without the year com‐
204       ponent.
205
206   Toolset Selection
207       The v110 toolset that comes with Visual Studio 11 2012 is  selected  by
208       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
209       the cmake(1) -T option, to specify another toolset.
210
211   Visual Studio 12 2013
212       Generates Visual Studio 12 (VS 2013) project files.
213
214       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
215       platform name (architecture).
216
217       For  compatibility  with CMake versions prior to 3.1, one may specify a
218       target platform name optionally at the end of this generator name:
219
220       Visual Studio 12 2013 Win64
221              Specify target platform x64.
222
223       Visual Studio 12 2013 ARM
224              Specify target platform ARM.
225
226       For compatibility with CMake versions prior to  3.0,  one  may  specify
227       this  generator using the name “Visual Studio 12” without the year com‐
228       ponent.
229
230   Toolset Selection
231       The v120 toolset that comes with Visual Studio 12 2013 is  selected  by
232       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
233       the cmake(1) -T option, to specify another toolset.
234
235       For each toolset that comes with this version of Visual  Studio,  there
236       are  variants  that are themselves compiled for 32-bit (x86) and 64-bit
237       (x64) hosts (independent of the architecture they target).  By  default
238       Visual  Studio  chooses  the 32-bit variant even on a 64-bit host.  One
239       may request use of the 64-bit host tools by adding a host=x64 option to
240       the  toolset  specification.   See the CMAKE_GENERATOR_TOOLSET variable
241       for details.
242
243   Visual Studio 14 2015
244       Generates Visual Studio 14 (VS 2015) project files.
245
246       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
247       platform name (architecture).
248
249       For  compatibility  with CMake versions prior to 3.1, one may specify a
250       target platform name optionally at the end of this generator name:
251
252       Visual Studio 14 2015 Win64
253              Specify target platform x64.
254
255       Visual Studio 14 2015 ARM
256              Specify target platform ARM.
257
258   Toolset Selection
259       The v140 toolset that comes with Visual Studio 14 2015 is  selected  by
260       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
261       the cmake(1) -T option, to specify another toolset.
262
263       For each toolset that comes with this version of Visual  Studio,  there
264       are  variants  that are themselves compiled for 32-bit (x86) and 64-bit
265       (x64) hosts (independent of the architecture they target).  By  default
266       Visual  Studio  chooses  the 32-bit variant even on a 64-bit host.  One
267       may request use of the 64-bit host tools by adding a host=x64 option to
268       the  toolset  specification.   See the CMAKE_GENERATOR_TOOLSET variable
269       for details.
270
271   Visual Studio 15 2017
272       Generates Visual Studio 15 (VS 2017) project files.
273
274       The CMAKE_GENERATOR_PLATFORM variable may be set to  specify  a  target
275       platform name (architecture).
276
277       For  compatibility  with CMake versions prior to 3.1, one may specify a
278       target platform name optionally at the end of this generator name:
279
280       Visual Studio 15 2017 Win64
281              Specify target platform x64.
282
283       Visual Studio 15 2017 ARM
284              Specify target platform ARM.
285
286   Instance Selection
287       VS 2017 supports multiple  installations  on  the  same  machine.   The
288       CMAKE_GENERATOR_INSTANCE  variable may be set as a cache entry contain‐
289       ing the absolute path to a Visual Studio instance.  If the value is not
290       specified explicitly by the user or a toolchain file, CMake queries the
291       Visual Studio Installer to locate VS instances, chooses one,  and  sets
292       the variable as a cache entry to hold the value persistently.
293
294       When CMake first chooses an instance, if the VS150COMNTOOLS environment
295       variable is set and points to the Common7/Tools directory within one of
296       the instances, that instance will be used.  Otherwise, if more than one
297       instance is installed we do not define which one is chosen by default.
298
299   Toolset Selection
300       The v141 toolset that comes with Visual Studio 15 2017 is  selected  by
301       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
302       the cmake(1) -T option, to specify another toolset.
303
304       For each toolset that comes with this version of Visual  Studio,  there
305       are  variants  that are themselves compiled for 32-bit (x86) and 64-bit
306       (x64) hosts (independent of the architecture they target).  By  default
307       Visual  Studio  chooses  the 32-bit variant even on a 64-bit host.  One
308       may request use of the 64-bit host tools by adding a host=x64 option to
309       the  toolset  specification.   See the CMAKE_GENERATOR_TOOLSET variable
310       for details.
311
312   Other Generators
313   Green Hills MULTI
314       Generates   Green   Hills   MULTI    project    files    (experimental,
315       work-in-progress).
316
317       Customizations are available through the following cache variables:
318
319       · GHS_BSP_NAME
320
321       · GHS_CUSTOMIZATION
322
323       · GHS_GPJ_MACROS
324
325       · GHS_OS_DIR
326
327       NOTE:
328          This  generator  is  deemed  experimental  as of CMake 3.11.4 and is
329          still a work in progress.  Future versions of CMake may make  break‐
330          ing changes as the generator matures.
331
332   Xcode
333       Generate Xcode project files.
334
335       This supports Xcode 3.0 and above.
336
337   Toolset Selection
338       By  default  Xcode is allowed to select its own default toolchain.  The
339       CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1)  -T
340       option, to specify another toolset.
341

EXTRA GENERATORS

343       Some  of  the CMake Generators listed in the cmake(1) command-line tool
344       --help output may have variants that specify an extra generator for  an
345       auxiliary  IDE tool.  Such generator names have the form <extra-genera‐
346       tor> - <main-generator>.  The following extra generators are  known  to
347       CMake.
348
349   CodeBlocks
350       Generates CodeBlocks project files.
351
352       Project  files  for CodeBlocks will be created in the top directory and
353       in every subdirectory which features a CMakeLists.txt file containing a
354       PROJECT()  call.   Additionally  a  hierarchy of makefiles is generated
355       into the build tree.  The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES vari‐
356       able may be set to ON to exclude any files which are located outside of
357       the project root directory.  The appropriate make program can build the
358       project  through  the  default make target.  A “make install” target is
359       also provided.
360
361       This “extra” generator may be specified as:
362
363       CodeBlocks - MinGW Makefiles
364              Generate with MinGW Makefiles.
365
366       CodeBlocks - NMake Makefiles
367              Generate with NMake Makefiles.
368
369       CodeBlocks - NMake Makefiles JOM
370              Generate with NMake Makefiles JOM.
371
372       CodeBlocks - Ninja
373              Generate with Ninja.
374
375       CodeBlocks - Unix Makefiles
376              Generate with Unix Makefiles.
377
378   CodeLite
379       Generates CodeLite project files.
380
381       Project files for CodeLite will be created in the top directory and  in
382       every  subdirectory  which  features a CMakeLists.txt file containing a
383       project() call.  The CMAKE_CODELITE_USE_TARGETS variable may be set  to
384       ON  to  change  the  default  behaviour from projects to targets as the
385       basis for project files.  The appropriate make program  can  build  the
386       project  through  the  default make target.  A “make install” target is
387       also provided.
388
389       This “extra” generator may be specified as:
390
391       CodeLite - MinGW Makefiles
392              Generate with MinGW Makefiles.
393
394       CodeLite - NMake Makefiles
395              Generate with NMake Makefiles.
396
397       CodeLite - Ninja
398              Generate with Ninja.
399
400       CodeLite - Unix Makefiles
401              Generate with Unix Makefiles.
402
403   Eclipse CDT4
404       Generates Eclipse CDT 4.0 project files.
405
406       Project files for Eclipse will be created in the top directory.  In out
407       of  source  builds, a linked resource to the top level source directory
408       will be created.  Additionally a hierarchy of  makefiles  is  generated
409       into  the  build  tree.   The  appropriate  make  program can build the
410       project through the default make target.  A “make  install”  target  is
411       also provided.
412
413       This “extra” generator may be specified as:
414
415       Eclipse CDT4 - MinGW Makefiles
416              Generate with MinGW Makefiles.
417
418       Eclipse CDT4 - NMake Makefiles
419              Generate with NMake Makefiles.
420
421       Eclipse CDT4 - Ninja
422              Generate with Ninja.
423
424       Eclipse CDT4 - Unix Makefiles
425              Generate with Unix Makefiles.
426
427   Kate
428       Generates Kate project files.
429
430       A project file for Kate will be created in the top directory in the top
431       level build directory.  To use it in kate, the Project plugin  must  be
432       enabled.  The project file is loaded in kate simply by opening the Pro‐
433       jectName.kateproject file in the editor.  If the kate  Build-plugin  is
434       enabled, all targets generated by CMake are available for building.
435
436       This “extra” generator may be specified as:
437
438       Kate - MinGW Makefiles
439              Generate with MinGW Makefiles.
440
441       Kate - NMake Makefiles
442              Generate with NMake Makefiles.
443
444       Kate - Ninja
445              Generate with Ninja.
446
447       Kate - Unix Makefiles
448              Generate with Unix Makefiles.
449
450   Sublime Text 2
451       Generates Sublime Text 2 project files.
452
453       Project  files  for Sublime Text 2 will be created in the top directory
454       and in every subdirectory which features a CMakeLists.txt file contain‐
455       ing  a  PROJECT()  call.  Additionally Makefiles (or build.ninja files)
456       are generated into the build tree.  The appropriate  make  program  can
457       build  the  project  through the default make target.  A “make install”
458       target is also provided.
459
460       This “extra” generator may be specified as:
461
462       Sublime Text 2 - MinGW Makefiles
463              Generate with MinGW Makefiles.
464
465       Sublime Text 2 - NMake Makefiles
466              Generate with NMake Makefiles.
467
468       Sublime Text 2 - Ninja
469              Generate with Ninja.
470
471       Sublime Text 2 - Unix Makefiles
472              Generate with Unix Makefiles.
473
475       2000-2018 Kitware, Inc. and Contributors
476
477
478
479
4803.11.4                           May 13, 2019              CMAKE-GENERATORS(7)
Impressum