1CMAKE-GENERATORS(7) CMake CMAKE-GENERATORS(7)
2
3
4
6 cmake-generators - CMake Generators Reference
7
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
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 Removed. This once generated Visual Studio 8 2005 project files, but
122 the generator has been removed since CMake 3.12. It is still possible
123 to build with VS 2005 tools using the NMake Makefiles generator.
124
125 Visual Studio 9 2008
126 Generates Visual Studio 9 2008 project files.
127
128 Platform Selection
129 The default target platform name (architecture) is Win32.
130
131 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
132 cmake(1) -A option, to specify a target platform name (architecture).
133 For example:
134
135 · cmake -G "Visual Studio 9 2008" -A Win32
136
137 · cmake -G "Visual Studio 9 2008" -A x64
138
139 · cmake -G "Visual Studio 9 2008" -A Itanium
140
141 · cmake -G "Visual Studio 9 2008" -A <WinCE-SDK> (Specify a target
142 platform matching a Windows CE SDK name.)
143
144 For compatibility with CMake versions prior to 3.1, one may specify a
145 target platform name optionally at the end of the generator name. This
146 is supported only for:
147
148 Visual Studio 9 2008 Win64
149 Specify target platform x64.
150
151 Visual Studio 9 2008 IA64
152 Specify target platform Itanium.
153
154 Visual Studio 9 2008 <WinCE-SDK>
155 Specify target platform matching a Windows CE SDK name.
156
157 Visual Studio 10 2010
158 Generates Visual Studio 10 (VS 2010) project files.
159
160 For compatibility with CMake versions prior to 3.0, one may specify
161 this generator using the name Visual Studio 10 without the year compo‐
162 nent.
163
164 Project Types
165 Only Visual C++ and C# projects may be generated. Other types of
166 projects (Database, Website, etc.) are not supported.
167
168 Platform Selection
169 The default target platform name (architecture) is Win32.
170
171 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
172 cmake(1) -A option, to specify a target platform name (architecture).
173 For example:
174
175 · cmake -G "Visual Studio 10 2010" -A Win32
176
177 · cmake -G "Visual Studio 10 2010" -A x64
178
179 · cmake -G "Visual Studio 10 2010" -A Itanium
180
181 For compatibility with CMake versions prior to 3.1, one may specify a
182 target platform name optionally at the end of the generator name. This
183 is supported only for:
184
185 Visual Studio 10 2010 Win64
186 Specify target platform x64.
187
188 Visual Studio 10 2010 IA64
189 Specify target platform Itanium.
190
191 Toolset Selection
192 The v100 toolset that comes with Visual Studio 10 2010 is selected by
193 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
194 the cmake(1) -T option, to specify another toolset.
195
196 Visual Studio 11 2012
197 Generates Visual Studio 11 (VS 2012) project files.
198
199 For compatibility with CMake versions prior to 3.0, one may specify
200 this generator using the name “Visual Studio 11” without the year com‐
201 ponent.
202
203 Project Types
204 Only Visual C++ and C# projects may be generated. Other types of
205 projects (JavaScript, Database, Website, etc.) are not supported.
206
207 Platform Selection
208 The default target platform name (architecture) is Win32.
209
210 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
211 cmake(1) -A option, to specify a target platform name (architecture).
212 For example:
213
214 · cmake -G "Visual Studio 11 2012" -A Win32
215
216 · cmake -G "Visual Studio 11 2012" -A x64
217
218 · cmake -G "Visual Studio 11 2012" -A ARM
219
220 · cmake -G "Visual Studio 11 2012" -A <WinCE-SDK> (Specify a target
221 platform matching a Windows CE SDK name.)
222
223 For compatibility with CMake versions prior to 3.1, one may specify a
224 target platform name optionally at the end of the generator name. This
225 is supported only for:
226
227 Visual Studio 11 2012 Win64
228 Specify target platform x64.
229
230 Visual Studio 11 2012 ARM
231 Specify target platform ARM.
232
233 Visual Studio 11 2012 <WinCE-SDK>
234 Specify target platform matching a Windows CE SDK name.
235
236 Toolset Selection
237 The v110 toolset that comes with Visual Studio 11 2012 is selected by
238 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
239 the cmake(1) -T option, to specify another toolset.
240
241 Visual Studio 12 2013
242 Generates Visual Studio 12 (VS 2013) project files.
243
244 For compatibility with CMake versions prior to 3.0, one may specify
245 this generator using the name “Visual Studio 12” without the year com‐
246 ponent.
247
248 Project Types
249 Only Visual C++ and C# projects may be generated. Other types of
250 projects (JavaScript, Powershell, Python, etc.) are not supported.
251
252 Platform Selection
253 The default target platform name (architecture) is Win32.
254
255 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
256 cmake(1) -A option, to specify a target platform name (architecture).
257 For example:
258
259 · cmake -G "Visual Studio 12 2013" -A Win32
260
261 · cmake -G "Visual Studio 12 2013" -A x64
262
263 · cmake -G "Visual Studio 12 2013" -A ARM
264
265 For compatibility with CMake versions prior to 3.1, one may specify a
266 target platform name optionally at the end of the generator name. This
267 is supported only for:
268
269 Visual Studio 12 2013 Win64
270 Specify target platform x64.
271
272 Visual Studio 12 2013 ARM
273 Specify target platform ARM.
274
275 Toolset Selection
276 The v120 toolset that comes with Visual Studio 12 2013 is selected by
277 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
278 the cmake(1) -T option, to specify another toolset.
279
280 For each toolset that comes with this version of Visual Studio, there
281 are variants that are themselves compiled for 32-bit (x86) and 64-bit
282 (x64) hosts (independent of the architecture they target). By default
283 this generator uses the 32-bit variant even on a 64-bit host. One may
284 explicitly request use of either the 32-bit or 64-bit host tools by
285 adding either host=x86 or host=x64 to the toolset specification. See
286 the CMAKE_GENERATOR_TOOLSET variable for details.
287
288 Visual Studio 14 2015
289 Generates Visual Studio 14 (VS 2015) project files.
290
291 Project Types
292 Only Visual C++ and C# projects may be generated. Other types of
293 projects (JavaScript, Powershell, Python, etc.) are not supported.
294
295 Platform Selection
296 The default target platform name (architecture) is Win32.
297
298 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
299 cmake(1) -A option, to specify a target platform name (architecture).
300 For example:
301
302 · cmake -G "Visual Studio 14 2015" -A Win32
303
304 · cmake -G "Visual Studio 14 2015" -A x64
305
306 · cmake -G "Visual Studio 14 2015" -A ARM
307
308 For compatibility with CMake versions prior to 3.1, one may specify a
309 target platform name optionally at the end of the generator name. This
310 is supported only for:
311
312 Visual Studio 14 2015 Win64
313 Specify target platform x64.
314
315 Visual Studio 14 2015 ARM
316 Specify target platform ARM.
317
318 Toolset Selection
319 The v140 toolset that comes with Visual Studio 14 2015 is selected by
320 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
321 the cmake(1) -T option, to specify another toolset.
322
323 For each toolset that comes with this version of Visual Studio, there
324 are variants that are themselves compiled for 32-bit (x86) and 64-bit
325 (x64) hosts (independent of the architecture they target). By default
326 this generator uses the 32-bit variant even on a 64-bit host. One may
327 explicitly request use of either the 32-bit or 64-bit host tools by
328 adding either host=x86 or host=x64 to the toolset specification. See
329 the CMAKE_GENERATOR_TOOLSET variable for details.
330
331 Visual Studio 15 2017
332 Generates Visual Studio 15 (VS 2017) project files.
333
334 Project Types
335 Only Visual C++ and C# projects may be generated. Other types of
336 projects (JavaScript, Powershell, Python, etc.) are not supported.
337
338 Instance Selection
339 VS 2017 supports multiple installations on the same machine. The
340 CMAKE_GENERATOR_INSTANCE variable may be set as a cache entry contain‐
341 ing the absolute path to a Visual Studio instance. If the value is not
342 specified explicitly by the user or a toolchain file, CMake queries the
343 Visual Studio Installer to locate VS instances, chooses one, and sets
344 the variable as a cache entry to hold the value persistently.
345
346 When CMake first chooses an instance, if the VS150COMNTOOLS environment
347 variable is set and points to the Common7/Tools directory within one of
348 the instances, that instance will be used. Otherwise, if more than one
349 instance is installed we do not define which one is chosen by default.
350
351 Platform Selection
352 The default target platform name (architecture) is Win32.
353
354 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
355 cmake(1) -A option, to specify a target platform name (architecture).
356 For example:
357
358 · cmake -G "Visual Studio 15 2017" -A Win32
359
360 · cmake -G "Visual Studio 15 2017" -A x64
361
362 · cmake -G "Visual Studio 15 2017" -A ARM
363
364 · cmake -G "Visual Studio 15 2017" -A ARM64
365
366 For compatibility with CMake versions prior to 3.1, one may specify a
367 target platform name optionally at the end of the generator name. This
368 is supported only for:
369
370 Visual Studio 15 2017 Win64
371 Specify target platform x64.
372
373 Visual Studio 15 2017 ARM
374 Specify target platform ARM.
375
376 Toolset Selection
377 The v141 toolset that comes with Visual Studio 15 2017 is selected by
378 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
379 the cmake(1) -T option, to specify another toolset.
380
381 For each toolset that comes with this version of Visual Studio, there
382 are variants that are themselves compiled for 32-bit (x86) and 64-bit
383 (x64) hosts (independent of the architecture they target). By default
384 this generator uses the 32-bit variant even on a 64-bit host. One may
385 explicitly request use of either the 32-bit or 64-bit host tools by
386 adding either host=x86 or host=x64 to the toolset specification. See
387 the CMAKE_GENERATOR_TOOLSET variable for details.
388
389 Visual Studio 16 2019
390 Generates Visual Studio 16 (VS 2019) project files.
391
392 Project Types
393 Only Visual C++ and C# projects may be generated. Other types of
394 projects (JavaScript, Powershell, Python, etc.) are not supported.
395
396 Instance Selection
397 VS 2019 supports multiple installations on the same machine. The
398 CMAKE_GENERATOR_INSTANCE variable may be set as a cache entry contain‐
399 ing the absolute path to a Visual Studio instance. If the value is not
400 specified explicitly by the user or a toolchain file, CMake queries the
401 Visual Studio Installer to locate VS instances, chooses one, and sets
402 the variable as a cache entry to hold the value persistently.
403
404 When CMake first chooses an instance, if the VS160COMNTOOLS environment
405 variable is set and points to the Common7/Tools directory within one of
406 the instances, that instance will be used. Otherwise, if more than one
407 instance is installed we do not define which one is chosen by default.
408
409 Platform Selection
410 The default target platform name (architecture) is that of the host and
411 is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
412
413 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
414 cmake(1) -A option, to specify a target platform name (architecture).
415 For example:
416
417 · cmake -G "Visual Studio 16 2019" -A Win32
418
419 · cmake -G "Visual Studio 16 2019" -A x64
420
421 · cmake -G "Visual Studio 16 2019" -A ARM
422
423 · cmake -G "Visual Studio 16 2019" -A ARM64
424
425 Toolset Selection
426 The v142 toolset that comes with Visual Studio 16 2019 is selected by
427 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
428 the cmake(1) -T option, to specify another toolset.
429
430 For each toolset that comes with this version of Visual Studio, there
431 are variants that are themselves compiled for 32-bit (x86) and 64-bit
432 (x64) hosts (independent of the architecture they target). By default
433 this generator uses the 64-bit variant on x64 hosts and the 32-bit
434 variant otherwise. One may explicitly request use of either the 32-bit
435 or 64-bit host tools by adding either host=x86 or host=x64 to the
436 toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for
437 details.
438
439 Other Generators
440 Green Hills MULTI
441 Generates Green Hills MULTI project files (experimental,
442 work-in-progress).
443
444 The buildsystem has predetermined build-configuration settings that can
445 be controlled via the CMAKE_BUILD_TYPE variable.
446
447 Customizations that are used to pick toolset and target system:
448
449 The -A <arch> can be supplied for setting the target architecture.
450 <arch> usually is one of “arm”, “ppc”, “86”, etcetera. If the target
451 architecture is not specified then the default architecture of “arm”
452 will be used.
453
454 The -T <toolset> option can be used to set the directory location of
455 the toolset. Both absolute and relative paths are valid. Relative
456 paths use GHS_TOOLSET_ROOT as the root. If the toolset is not specified
457 then the latest toolset found in GHS_TOOLSET_ROOT will be used.
458
459 Cache variables that are used for toolset and target system customiza‐
460 tion:
461
462 · GHS_TARGET_PLATFORM
463 Defaults to integrity.
464 Usual values are integrity, threadx, uvelosity, velosity,
465 vxworks, standalone.
466
467
468 · GHS_PRIMARY_TARGET
469 Sets primaryTarget entry in project file.
470 Defaults to <arch>_<GHS_TARGET_PLATFORM>.tgt.
471
472
473 · GHS_TOOLSET_ROOT
474 Root path for toolset searches.
475 Defaults to C:/ghs.
476
477
478 · GHS_OS_ROOT
479 Root path for RTOS searches.
480 Defaults to C:/ghs.
481
482
483 · GHS_OS_DIR
484 Sets -os_dir entry in project file.
485 Defaults to latest platform OS installation at GHS_OS_ROOT. Set this value if
486 a specific RTOS is to be used.
487
488
489 · GHS_BSP_NAME
490 Sets -bsp entry in project file.
491 Defaults to sim<arch> for integrity platforms.
492
493
494 Customizations are available through the following cache variables:
495
496 · GHS_CUSTOMIZATION
497
498 · GHS_GPJ_MACROS
499
500 The following properties are available:
501
502 · GHS_INTEGRITY_APP
503
504 · GHS_NO_SOURCE_GROUP_FILE
505
506 NOTE:
507 This generator is deemed experimental as of CMake 3.14.5 and is
508 still a work in progress. Future versions of CMake may make break‐
509 ing changes as the generator matures.
510
511 Xcode
512 Generate Xcode project files.
513
514 This supports Xcode 3.0 and above. Support for Xcode versions prior to
515 Xcode 5 is deprecated and will be dropped in a future version of CMake.
516
517 Toolset Selection
518 By default Xcode is allowed to select its own default toolchain. The
519 CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T
520 option, to specify another toolset.
521
523 Some of the CMake Generators listed in the cmake(1) command-line tool
524 --help output may have variants that specify an extra generator for an
525 auxiliary IDE tool. Such generator names have the form <extra-genera‐
526 tor> - <main-generator>. The following extra generators are known to
527 CMake.
528
529 CodeBlocks
530 Generates CodeBlocks project files.
531
532 Project files for CodeBlocks will be created in the top directory and
533 in every subdirectory which features a CMakeLists.txt file containing a
534 PROJECT() call. Additionally a hierarchy of makefiles is generated
535 into the build tree. The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES vari‐
536 able may be set to ON to exclude any files which are located outside of
537 the project root directory. The appropriate make program can build the
538 project through the default make target. A “make install” target is
539 also provided.
540
541 This “extra” generator may be specified as:
542
543 CodeBlocks - MinGW Makefiles
544 Generate with MinGW Makefiles.
545
546 CodeBlocks - NMake Makefiles
547 Generate with NMake Makefiles.
548
549 CodeBlocks - NMake Makefiles JOM
550 Generate with NMake Makefiles JOM.
551
552 CodeBlocks - Ninja
553 Generate with Ninja.
554
555 CodeBlocks - Unix Makefiles
556 Generate with Unix Makefiles.
557
558 CodeLite
559 Generates CodeLite project files.
560
561 Project files for CodeLite will be created in the top directory and in
562 every subdirectory which features a CMakeLists.txt file containing a
563 project() call. The CMAKE_CODELITE_USE_TARGETS variable may be set to
564 ON to change the default behaviour from projects to targets as the
565 basis for project files. The appropriate make program can build the
566 project through the default make target. A “make install” target is
567 also provided.
568
569 This “extra” generator may be specified as:
570
571 CodeLite - MinGW Makefiles
572 Generate with MinGW Makefiles.
573
574 CodeLite - NMake Makefiles
575 Generate with NMake Makefiles.
576
577 CodeLite - Ninja
578 Generate with Ninja.
579
580 CodeLite - Unix Makefiles
581 Generate with Unix Makefiles.
582
583 Eclipse CDT4
584 Generates Eclipse CDT 4.0 project files.
585
586 Project files for Eclipse will be created in the top directory. In out
587 of source builds, a linked resource to the top level source directory
588 will be created. Additionally a hierarchy of makefiles is generated
589 into the build tree. The appropriate make program can build the
590 project through the default make target. A “make install” target is
591 also provided.
592
593 This “extra” generator may be specified as:
594
595 Eclipse CDT4 - MinGW Makefiles
596 Generate with MinGW Makefiles.
597
598 Eclipse CDT4 - NMake Makefiles
599 Generate with NMake Makefiles.
600
601 Eclipse CDT4 - Ninja
602 Generate with Ninja.
603
604 Eclipse CDT4 - Unix Makefiles
605 Generate with Unix Makefiles.
606
607 Kate
608 Generates Kate project files.
609
610 A project file for Kate will be created in the top directory in the top
611 level build directory. To use it in kate, the Project plugin must be
612 enabled. The project file is loaded in kate simply by opening the Pro‐
613 jectName.kateproject file in the editor. If the kate Build-plugin is
614 enabled, all targets generated by CMake are available for building.
615
616 This “extra” generator may be specified as:
617
618 Kate - MinGW Makefiles
619 Generate with MinGW Makefiles.
620
621 Kate - NMake Makefiles
622 Generate with NMake Makefiles.
623
624 Kate - Ninja
625 Generate with Ninja.
626
627 Kate - Unix Makefiles
628 Generate with Unix Makefiles.
629
630 Sublime Text 2
631 Generates Sublime Text 2 project files.
632
633 Project files for Sublime Text 2 will be created in the top directory
634 and in every subdirectory which features a CMakeLists.txt file contain‐
635 ing a PROJECT() call. Additionally Makefiles (or build.ninja files)
636 are generated into the build tree. The appropriate make program can
637 build the project through the default make target. A “make install”
638 target is also provided.
639
640 This “extra” generator may be specified as:
641
642 Sublime Text 2 - MinGW Makefiles
643 Generate with MinGW Makefiles.
644
645 Sublime Text 2 - NMake Makefiles
646 Generate with NMake Makefiles.
647
648 Sublime Text 2 - Ninja
649 Generate with Ninja.
650
651 Sublime Text 2 - Unix Makefiles
652 Generate with Unix Makefiles.
653
655 2000-2019 Kitware, Inc. and Contributors
656
657
658
659
6603.14.5 Jun 01, 2019 CMAKE-GENERATORS(7)