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 na‐
10       tive build system.  Exactly one of the CMake  Generators  must  be  se‐
11       lected  for a build tree to determine what native build system is to be
12       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 (Minimal SYStem) make  under  the
34       MSYS shell.
35
36       Use  this  generator in a MSYS shell prompt and using make as the build
37       tool.  The generated makefiles use /bin/sh as the shell to launch build
38       rules.  They are not compatible with a Windows command prompt.
39
40       To build under a Windows command prompt, use the MinGW Makefiles gener‐
41       ator.
42
43   MinGW Makefiles
44       Generates makefiles for use with mingw32-make under a  Windows  command
45       prompt.
46
47       Use  this generator under a Windows command prompt with MinGW (Minimal‐
48       ist GNU for Windows) in the PATH and using mingw32-make  as  the  build
49       tool.  The generated makefiles use cmd.exe as the shell to launch build
50       rules.  They are not compatible with MSYS or a unix shell.
51
52       To build under the MSYS shell, use the MSYS Makefiles generator.
53
54   NMake Makefiles
55       Generates NMake makefiles.
56
57   NMake Makefiles JOM
58       Generates JOM makefiles.
59
60       New in version 3.8: CodeBlocks generator can be used as an extra gener‐
61       ator.
62
63
64   Unix Makefiles
65       Generates standard UNIX makefiles.
66
67       A  hierarchy  of  UNIX makefiles is generated into the build tree.  Use
68       any standard UNIX-style make program to build the project  through  the
69       all  target  and  install  the  project  through  the  install  (or in‐
70       stall/strip) target.
71
72       For each subdirectory sub/dir of the project a UNIX  makefile  will  be
73       created, containing the following targets:
74
75       all    Depends on all targets required by the subdirectory.
76
77       install
78              Runs the install step in the subdirectory, if any.
79
80       install/strip
81              Runs  the  install  step  in  the  subdirectory  followed  by  a
82              CMAKE_STRIP command, if any.
83
84              The CMAKE_STRIP variable will contain the platform's strip util‐
85              ity, which removes symbols information from generated binaries.
86
87       test   Runs the test step in the subdirectory, if any.
88
89       package
90              Runs the package step in the subdirectory, if any.
91
92   Watcom WMake
93       Generates Watcom WMake makefiles.
94
95   Ninja Generators
96   Ninja
97       Generates build.ninja files.
98
99       A  build.ninja  file  is  generated into the build tree.  Use the ninja
100       program to build the project through the all  target  and  install  the
101       project through the install (or install/strip) target.
102
103       For  each  subdirectory  sub/dir of the project, additional targets are
104       generated:
105
106       sub/dir/all
107          New in version 3.6: Depends on all targets required by the subdirec‐
108          tory.
109
110
111       sub/dir/install
112          New  in  version  3.7: Runs the install step in the subdirectory, if
113          any.
114
115
116       sub/dir/install/strip
117          New in version 3.7: Runs the install step in the  subdirectory  fol‐
118          lowed by a CMAKE_STRIP command, if any.
119
120          The  CMAKE_STRIP variable will contain the platform's strip utility,
121          which removes symbols information from generated binaries.
122
123
124       sub/dir/test
125          New in version 3.7: Runs the test step in the subdirectory, if any.
126
127
128       sub/dir/package
129          New in version 3.7: Runs the package step in  the  subdirectory,  if
130          any.
131
132
133   Fortran Support
134       New in version 3.7.
135
136
137       The  Ninja generator conditionally supports Fortran when the ninja tool
138       is at least version 1.10 (which has the required features).
139
140   Swift Support
141       New in version 3.15.
142
143
144       The Swift support is  experimental,  not  considered  stable,  and  may
145       change in future releases of CMake.
146
147   See Also
148       New in version 3.17: The Ninja Multi-Config generator is similar to the
149       Ninja generator, but generates multiple configurations at once.
150
151
152   Ninja Multi-Config
153       New in version 3.17.
154
155
156       Generates multiple build-<Config>.ninja files.
157
158       This generator is very much like the Ninja generator, but with some key
159       differences. Only these differences will be discussed in this document.
160
161       Unlike  the Ninja generator, Ninja Multi-Config generates multiple con‐
162       figurations at once with CMAKE_CONFIGURATION_TYPES instead of only  one
163       configuration with CMAKE_BUILD_TYPE. One build-<Config>.ninja file will
164       be generated for each of these configurations (with <Config> being  the
165       configuration  name.)  These files are intended to be run with ninja -f
166       build-<Config>.ninja. A build.ninja file is also generated,  using  the
167       configuration  from  either  CMAKE_DEFAULT_BUILD_TYPE or the first item
168       from CMAKE_CONFIGURATION_TYPES.
169
170       cmake --build . --config <Config> will always use  build-<Config>.ninja
171       to  build.  If  no --config argument is specified, cmake --build . will
172       use build.ninja.
173
174       Each build-<Config>.ninja file contains <target>  targets  as  well  as
175       <target>:<Config> targets, where <Config> is the same as the configura‐
176       tion specified in build-<Config>.ninja  Additionally,  if  cross-config
177       mode  is  enabled, build-<Config>.ninja may contain <target>:<OtherCon‐
178       fig> targets, where <OtherConfig> is a cross-config, as well  as  <tar‐
179       get>:all,  which  builds the target in all cross-configs. See below for
180       how to enable cross-config mode.
181
182       The Ninja Multi-Config generator recognizes the following variables:
183
184       CMAKE_CONFIGURATION_TYPES
185              Specifies the total set of configurations to build. Unlike  with
186              other  multi-config generators, this variable has a value of De‐
187              bug;Release;RelWithDebInfo by default.
188
189       CMAKE_CROSS_CONFIGS
190              Specifies a semicolon-separated list of configurations available
191              from all build-<Config>.ninja files.
192
193       CMAKE_DEFAULT_BUILD_TYPE
194              Specifies  the  configuration to use by default in a build.ninja
195              file.
196
197       CMAKE_DEFAULT_CONFIGS
198              Specifies a semicolon-separated list of configurations to  build
199              for a target in build.ninja if no :<Config> suffix is specified.
200
201       Consider the following example:
202
203          cmake_minimum_required(VERSION 3.16)
204          project(MultiConfigNinja C)
205
206          add_executable(generator generator.c)
207          add_custom_command(OUTPUT generated.c COMMAND generator generated.c)
208          add_library(generated ${CMAKE_BINARY_DIR}/generated.c)
209
210       Now  assume  you  configure the project with Ninja Multi-Config and run
211       one of the following commands:
212
213          ninja -f build-Debug.ninja generated
214          # OR
215          cmake --build . --config Debug --target generated
216
217       This would build the Debug configuration of generator, which  would  be
218       used  to  generate  generated.c, which would be used to build the Debug
219       configuration of generated.
220
221       But if CMAKE_CROSS_CONFIGS is set to all, and you run the following in‐
222       stead:
223
224          ninja -f build-Release.ninja generated:Debug
225          # OR
226          cmake --build . --config Release --target generated:Debug
227
228       This would build the Release configuration of generator, which would be
229       used to generate generated.c, which would be used to  build  the  Debug
230       configuration  of generated. This is useful for running a release-opti‐
231       mized version of a generator utility while  still  building  the  debug
232       version of the targets built with the generated code.
233
234   Custom Commands
235       New in version 3.20.
236
237
238       The  Ninja  Multi-Config  generator adds extra capabilities to add_cus‐
239       tom_command() and add_custom_target() through  its  cross-config  mode.
240       The  COMMAND, DEPENDS, and WORKING_DIRECTORY arguments can be evaluated
241       in the context of either the "command config" (the "native"  configura‐
242       tion  of  the  build-<Config>.ninja file in use) or the "output config"
243       (the configuration used to evaluate the OUTPUT and BYPRODUCTS).
244
245       If either OUTPUT or BYPRODUCTS names a path that is common to more than
246       one configuration (e.g. it does not use any generator expressions), all
247       arguments are evaluated in the command config by default.  If all  OUT‐
248       PUT  and BYPRODUCTS paths are unique to each configuration (e.g. by us‐
249       ing the $<CONFIG> generator expression), the first argument of  COMMAND
250       is  still  evaluated in the command config by default, while all subse‐
251       quent arguments, as well as the arguments to DEPENDS and WORKING_DIREC‐
252       TORY,  are  evaluated in the output config. These defaults can be over‐
253       ridden with the $<OUTPUT_CONFIG:...> and $<COMMAND_CONFIG:...>  genera‐
254       tor-expressions.  Note that if a target is specified by its name in DE‐
255       PENDS, or as the first argument of COMMAND, it is always  evaluated  in
256       the  command config, even if it is wrapped in $<OUTPUT_CONFIG:...> (be‐
257       cause its plain name is not a generator expression).
258
259       As an example, consider the following:
260
261          add_custom_command(
262            OUTPUT "$<CONFIG>.txt"
263            COMMAND generator "$<CONFIG>.txt" "$<OUTPUT_CONFIG:$<CONFIG>>" "$<COMMAND_CONFIG:$<CONFIG>>"
264            DEPENDS tgt1 "$<TARGET_FILE:tgt2>" "$<OUTPUT_CONFIG:$<TARGET_FILE:tgt3>>" "$<COMMAND_CONFIG:$<TARGET_FILE:tgt4>>"
265            )
266
267       Assume that generator, tgt1, tgt2, tgt3, and tgt4  are  all  executable
268       targets,  and  assume  that  $<CONFIG>.txt is built in the Debug output
269       config using the Release command config. The Release build of the  gen‐
270       erator  target is called with Debug.txt Debug Release as arguments. The
271       command depends on the Release builds of tgt1 and tgt4, and  the  Debug
272       builds of tgt2 and tgt3.
273
274       PRE_BUILD,  PRE_LINK,  and  POST_BUILD custom commands for targets only
275       get run in their "native" configuration (the Release  configuration  in
276       the  build-Release.ninja  file) unless they have no BYPRODUCTS or their
277       BYPRODUCTS are unique per config. Consider the following example:
278
279          add_executable(exe main.c)
280          add_custom_command(
281            TARGET exe
282            POST_BUILD
283            COMMAND ${CMAKE_COMMAND} -E echo "Running no-byproduct command"
284            )
285          add_custom_command(
286            TARGET exe
287            POST_BUILD
288            COMMAND ${CMAKE_COMMAND} -E echo "Running separate-byproduct command for $<CONFIG>"
289            BYPRODUCTS $<CONFIG>.txt
290            )
291          add_custom_command(
292            TARGET exe
293            POST_BUILD
294            COMMAND ${CMAKE_COMMAND} -E echo "Running common-byproduct command for $<CONFIG>"
295            BYPRODUCTS exe.txt
296            )
297
298       In this example, if you build  exe:Debug  in  build-Release.ninja,  the
299       first  and  second  custom commands get run, since their byproducts are
300       unique per-config, but the last custom command does  not.  However,  if
301       you build exe:Release in build-Release.ninja, all three custom commands
302       get run.
303
304   IDE Build Tool Generators
305       These  generators  support  Integrated  Development  Environment  (IDE)
306       project  files.  Since the IDEs configure their own environment one may
307       launch CMake from any environment.
308
309   Visual Studio Generators
310   Visual Studio 6
311       Removed.  This once generated Visual Studio 6 project  files,  but  the
312       generator  has  been  removed since CMake 3.6.  It is still possible to
313       build with VS 6 tools using the NMake Makefiles generator.
314
315   Visual Studio 7
316       Removed.  This once generated Visual Studio .NET  2002  project  files,
317       but the generator has been removed since CMake 3.6.  It is still possi‐
318       ble to build with VS 7.0 tools using the NMake Makefiles generator.
319
320   Visual Studio 7 .NET 2003
321       Removed.  This once generated Visual Studio .NET  2003  project  files,
322       but the generator has been removed since CMake 3.9.  It is still possi‐
323       ble to build with VS 7.1 tools using the NMake Makefiles generator.
324
325   Visual Studio 8 2005
326       Removed.  This once generated Visual Studio 8 2005 project  files,  but
327       the  generator has been removed since CMake 3.12.  It is still possible
328       to build with VS 2005 tools using the NMake Makefiles generator.
329
330   Visual Studio 9 2008
331       Generates Visual Studio 9 2008 project files.
332
333   Platform Selection
334       The default target platform name (architecture) is Win32.
335
336       New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may  be  set,
337       perhaps  via  the cmake(1) -A option, to specify a target platform name
338       (architecture).  For example:
339
340cmake -G "Visual Studio 9 2008" -A Win32
341
342cmake -G "Visual Studio 9 2008" -A x64
343
344cmake -G "Visual Studio 9 2008" -A Itanium
345
346cmake -G "Visual Studio 9 2008"  -A  <WinCE-SDK>  (Specify  a  target
347         platform matching a Windows CE SDK name.)
348
349
350       For  compatibility  with CMake versions prior to 3.1, one may specify a
351       target platform name optionally at the end of the generator name.  This
352       is supported only for:
353
354       Visual Studio 9 2008 Win64
355              Specify target platform x64.
356
357       Visual Studio 9 2008 IA64
358              Specify target platform Itanium.
359
360       Visual Studio 9 2008 <WinCE-SDK>
361              Specify target platform matching a Windows CE SDK name.
362
363   Visual Studio 10 2010
364       Deprecated.  Generates Visual Studio 10 (VS 2010) project files.
365
366       NOTE:
367          This generator is deprecated and will be removed in a future version
368          of CMake.  It will still be possible to build with VS 10 2010  tools
369          using the Visual Studio 11 2012 (or above) generator with CMAKE_GEN‐
370          ERATOR_TOOLSET set to v100, or by using the NMake Makefiles  genera‐
371          tor.
372
373       For  compatibility  with  CMake  versions prior to 3.0, one may specify
374       this generator using the name Visual Studio 10 without the year  compo‐
375       nent.
376
377   Project Types
378       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
379       tel compiler integration).  Other types of projects (Database, Website,
380       etc.) are not supported.
381
382   Platform Selection
383       The default target platform name (architecture) is Win32.
384
385       New  in  version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
386       perhaps via the cmake(1) -A option, to specify a target  platform  name
387       (architecture).  For example:
388
389cmake -G "Visual Studio 10 2010" -A Win32
390
391cmake -G "Visual Studio 10 2010" -A x64
392
393cmake -G "Visual Studio 10 2010" -A Itanium
394
395
396       For  compatibility  with CMake versions prior to 3.1, one may specify a
397       target platform name optionally at the end of the generator name.  This
398       is supported only for:
399
400       Visual Studio 10 2010 Win64
401              Specify target platform x64.
402
403       Visual Studio 10 2010 IA64
404              Specify target platform Itanium.
405
406   Toolset Selection
407       The  v100  toolset that comes with Visual Studio 10 2010 is selected by
408       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
409       the cmake(1) -T option, to specify another toolset.
410
411   Visual Studio 11 2012
412       Generates Visual Studio 11 (VS 2012) project files.
413
414       For  compatibility  with  CMake  versions prior to 3.0, one may specify
415       this generator using the name "Visual Studio 11" without the year  com‐
416       ponent.
417
418   Project Types
419       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
420       tel compiler integration).  Other types of projects (JavaScript,  Data‐
421       base, Website, etc.) are not supported.
422
423   Platform Selection
424       The default target platform name (architecture) is Win32.
425
426       New  in  version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
427       perhaps via the cmake(1) -A option, to specify a target  platform  name
428       (architecture).  For example:
429
430cmake -G "Visual Studio 11 2012" -A Win32
431
432cmake -G "Visual Studio 11 2012" -A x64
433
434cmake -G "Visual Studio 11 2012" -A ARM
435
436cmake  -G  "Visual  Studio  11 2012" -A <WinCE-SDK> (Specify a target
437         platform matching a Windows CE SDK name.)
438
439
440       For compatibility with CMake versions prior to 3.1, one may  specify  a
441       target platform name optionally at the end of the generator name.  This
442       is supported only for:
443
444       Visual Studio 11 2012 Win64
445              Specify target platform x64.
446
447       Visual Studio 11 2012 ARM
448              Specify target platform ARM.
449
450       Visual Studio 11 2012 <WinCE-SDK>
451              Specify target platform matching a Windows CE SDK name.
452
453   Toolset Selection
454       The v110 toolset that comes with Visual Studio 11 2012 is  selected  by
455       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
456       the cmake(1) -T option, to specify another toolset.
457
458   Visual Studio 12 2013
459       Generates Visual Studio 12 (VS 2013) project files.
460
461       For compatibility with CMake versions prior to  3.0,  one  may  specify
462       this  generator using the name "Visual Studio 12" without the year com‐
463       ponent.
464
465   Project Types
466       Only Visual C++ and C# projects may be generated (and Fortran with  In‐
467       tel compiler integration).  Other types of projects (JavaScript, Power‐
468       shell, Python, etc.) are not supported.
469
470   Platform Selection
471       The default target platform name (architecture) is Win32.
472
473       New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may  be  set,
474       perhaps  via  the cmake(1) -A option, to specify a target platform name
475       (architecture).  For example:
476
477cmake -G "Visual Studio 12 2013" -A Win32
478
479cmake -G "Visual Studio 12 2013" -A x64
480
481cmake -G "Visual Studio 12 2013" -A ARM
482
483
484       For compatibility with CMake versions prior to 3.1, one may  specify  a
485       target platform name optionally at the end of the generator name.  This
486       is supported only for:
487
488       Visual Studio 12 2013 Win64
489              Specify target platform x64.
490
491       Visual Studio 12 2013 ARM
492              Specify target platform ARM.
493
494   Toolset Selection
495       The v120 toolset that comes with Visual Studio 12 2013 is  selected  by
496       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
497       the cmake(1) -T option, to specify another toolset.
498
499       New in version 3.8: For each toolset that comes with  this  version  of
500       Visual  Studio,  there  are  variants  that are themselves compiled for
501       32-bit (x86) and 64-bit (x64) hosts (independent  of  the  architecture
502       they  target).   By default this generator uses the 32-bit variant even
503       on a 64-bit host.  One may explicitly request use of either the  32-bit
504       or  64-bit  host  tools  by  adding  either host=x86 or host=x64 to the
505       toolset specification.  See the  CMAKE_GENERATOR_TOOLSET  variable  for
506       details.
507
508
509       New in version 3.14: Added support for host=x86 option.
510
511
512   Visual Studio 14 2015
513       New in version 3.1.
514
515
516       Generates Visual Studio 14 (VS 2015) project files.
517
518   Project Types
519       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
520       tel compiler integration).  Other types of projects (JavaScript, Power‐
521       shell, Python, etc.) are not supported.
522
523   Platform Selection
524       The default target platform name (architecture) is Win32.
525
526       The  CMAKE_GENERATOR_PLATFORM  variable  may  be  set,  perhaps via the
527       cmake(1) -A option, to specify a target platform  name  (architecture).
528       For example:
529
530cmake -G "Visual Studio 14 2015" -A Win32
531
532cmake -G "Visual Studio 14 2015" -A x64
533
534cmake -G "Visual Studio 14 2015" -A ARM
535
536       For  compatibility  with CMake versions prior to 3.1, one may specify a
537       target platform name optionally at the end of the generator name.  This
538       is supported only for:
539
540       Visual Studio 14 2015 Win64
541              Specify target platform x64.
542
543       Visual Studio 14 2015 ARM
544              Specify target platform ARM.
545
546   Toolset Selection
547       The  v140  toolset that comes with Visual Studio 14 2015 is selected by
548       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
549       the cmake(1) -T option, to specify another toolset.
550
551       New  in  version  3.8: For each toolset that comes with this version of
552       Visual Studio, there are variants  that  are  themselves  compiled  for
553       32-bit  (x86)  and  64-bit (x64) hosts (independent of the architecture
554       they target).  By default this generator uses the 32-bit  variant  even
555       on  a 64-bit host.  One may explicitly request use of either the 32-bit
556       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
557       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
558       details.
559
560
561       New in version 3.14: Added support for host=x86 option.
562
563
564   Windows 10 SDK Maximum Version for VS 2015
565       New in version 3.19.
566
567
568       Microsoft stated in a "Windows 10 October 2018 Update" blog  post  that
569       Windows  10 SDK versions (15063, 16299, 17134, 17763) are not supported
570       by VS 2015 and are only supported by VS 2017 and later.   Therefore  by
571       default   CMake   automatically   ignores   Windows   10   SDKs  beyond
572       10.0.14393.0.
573
574       However, there  are  other  recommendations  for  certain  driver/Win32
575       builds  that  indicate otherwise.  A user can override this behavior by
576       either setting the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM  to
577       a  false  value  or  setting  the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VER‐
578       SION_MAXIMUM  to  the  string  value  of  the  required  maximum  (e.g.
579       10.0.15063.0).
580
581   Visual Studio 15 2017
582       New in version 3.7.1.
583
584
585       Generates Visual Studio 15 (VS 2017) project files.
586
587   Project Types
588       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
589       tel compiler integration).  Other types of projects (JavaScript, Power‐
590       shell, Python, etc.) are not supported.
591
592   Instance Selection
593       New in version 3.11.
594
595
596       VS  2017  supports  multiple  installations  on  the same machine.  The
597       CMAKE_GENERATOR_INSTANCE variable may be set as a cache entry  contain‐
598       ing the absolute path to a Visual Studio instance.  If the value is not
599       specified explicitly by the user or a toolchain file, CMake queries the
600       Visual  Studio  Installer to locate VS instances, chooses one, and sets
601       the variable as a cache entry to hold the value persistently.
602
603       When CMake first chooses an instance, if the VS150COMNTOOLS environment
604       variable is set and points to the Common7/Tools directory within one of
605       the instances, that instance will be used.  Otherwise, if more than one
606       instance is installed we do not define which one is chosen by default.
607
608   Platform Selection
609       The default target platform name (architecture) is Win32.
610
611       The  CMAKE_GENERATOR_PLATFORM  variable  may  be  set,  perhaps via the
612       cmake(1) -A option, to specify a target platform  name  (architecture).
613       For example:
614
615cmake -G "Visual Studio 15 2017" -A Win32
616
617cmake -G "Visual Studio 15 2017" -A x64
618
619cmake -G "Visual Studio 15 2017" -A ARM
620
621cmake -G "Visual Studio 15 2017" -A ARM64
622
623       For  compatibility  with CMake versions prior to 3.1, one may specify a
624       target platform name optionally at the end of the generator name.  This
625       is supported only for:
626
627       Visual Studio 15 2017 Win64
628              Specify target platform x64.
629
630       Visual Studio 15 2017 ARM
631              Specify target platform ARM.
632
633   Toolset Selection
634       The  v141  toolset that comes with Visual Studio 15 2017 is selected by
635       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
636       the cmake(1) -T option, to specify another toolset.
637
638       New  in  version  3.8: For each toolset that comes with this version of
639       Visual Studio, there are variants  that  are  themselves  compiled  for
640       32-bit  (x86)  and  64-bit (x64) hosts (independent of the architecture
641       they target).  By default this generator uses the 32-bit  variant  even
642       on  a 64-bit host.  One may explicitly request use of either the 32-bit
643       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
644       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
645       details.
646
647
648       New in version 3.14: Added support for host=x86 option.
649
650
651   Visual Studio 16 2019
652       New in version 3.14.
653
654
655       Generates Visual Studio 16 (VS 2019) project files.
656
657   Project Types
658       Only Visual C++ and C# projects may be generated (and Fortran with  In‐
659       tel compiler integration).  Other types of projects (JavaScript, Power‐
660       shell, Python, etc.) are not supported.
661
662   Instance Selection
663       VS 2019 supports multiple  installations  on  the  same  machine.   The
664       CMAKE_GENERATOR_INSTANCE  variable may be set as a cache entry contain‐
665       ing the absolute path to a Visual Studio instance.  If the value is not
666       specified explicitly by the user or a toolchain file, CMake queries the
667       Visual Studio Installer to locate VS instances, chooses one,  and  sets
668       the variable as a cache entry to hold the value persistently.
669
670       When CMake first chooses an instance, if the VS160COMNTOOLS environment
671       variable is set and points to the Common7/Tools directory within one of
672       the instances, that instance will be used.  Otherwise, if more than one
673       instance is installed we do not define which one is chosen by default.
674
675   Platform Selection
676       The default target platform name (architecture) is that of the host and
677       is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
678
679       The  CMAKE_GENERATOR_PLATFORM  variable  may  be  set,  perhaps via the
680       cmake(1) -A option, to specify a target platform  name  (architecture).
681       For example:
682
683cmake -G "Visual Studio 16 2019" -A Win32
684
685cmake -G "Visual Studio 16 2019" -A x64
686
687cmake -G "Visual Studio 16 2019" -A ARM
688
689cmake -G "Visual Studio 16 2019" -A ARM64
690
691   Toolset Selection
692       The  v142  toolset that comes with Visual Studio 16 2019 is selected by
693       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
694       the cmake(1) -T option, to specify another toolset.
695
696       For  each  toolset that comes with this version of Visual Studio, there
697       are variants that are themselves compiled for 32-bit (x86)  and  64-bit
698       (x64)  hosts (independent of the architecture they target).  By default
699       this generator uses the 64-bit variant on  x64  hosts  and  the  32-bit
700       variant otherwise.  One may explicitly request use of either the 32-bit
701       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
702       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
703       details.
704
705   Visual Studio 17 2022
706       New in version 3.21.
707
708
709       Generates Visual Studio 17 (VS 2022) project files.
710
711   Project Types
712       Only Visual C++ and C# projects may be generated (and Fortran with  In‐
713       tel compiler integration).  Other types of projects (JavaScript, Power‐
714       shell, Python, etc.) are not supported.
715
716   Instance Selection
717       VS 2022 supports multiple  installations  on  the  same  machine.   The
718       CMAKE_GENERATOR_INSTANCE  variable may be set as a cache entry contain‐
719       ing the absolute path to a Visual Studio instance.  If the value is not
720       specified explicitly by the user or a toolchain file, CMake queries the
721       Visual Studio Installer to locate VS instances, chooses one,  and  sets
722       the variable as a cache entry to hold the value persistently.
723
724       When CMake first chooses an instance, if the VS170COMNTOOLS environment
725       variable is set and points to the Common7/Tools directory within one of
726       the instances, that instance will be used.  Otherwise, if more than one
727       instance is installed we do not define which one is chosen by default.
728
729   Platform Selection
730       The default target platform name (architecture) is that of the host and
731       is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
732
733       The  CMAKE_GENERATOR_PLATFORM  variable  may  be  set,  perhaps via the
734       cmake(1) -A option, to specify a target platform  name  (architecture).
735       For example:
736
737cmake -G "Visual Studio 17 2022" -A Win32
738
739cmake -G "Visual Studio 17 2022" -A x64
740
741cmake -G "Visual Studio 17 2022" -A ARM
742
743cmake -G "Visual Studio 17 2022" -A ARM64
744
745   Toolset Selection
746       The  v143  toolset  that  comes with VS 17 2022 is selected by default.
747       The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1)
748       -T option, to specify another toolset.
749
750       For  each  toolset that comes with this version of Visual Studio, there
751       are variants that are themselves compiled for 32-bit (x86)  and  64-bit
752       (x64)  hosts (independent of the architecture they target).  By default
753       this generator uses the 64-bit variant on  x64  hosts  and  the  32-bit
754       variant otherwise.  One may explicitly request use of either the 32-bit
755       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
756       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
757       details.
758
759   Other Generators
760   Green Hills MULTI
761       New in version 3.3.
762
763
764       New in version 3.15: Linux support.
765
766
767       Generates   Green   Hills   MULTI    project    files    (experimental,
768       work-in-progress).
769
770       Customizations are available through the following cache variables:
771
772GHS_CUSTOMIZATION
773
774GHS_GPJ_MACROS
775
776       New in version 3.14: The buildsystem has predetermined build-configura‐
777       tion settings that can be controlled via the CMAKE_BUILD_TYPE variable.
778
779
780   Toolset and Platform Selection
781       New in version 3.13.
782
783
784       Customizations that are used to pick toolset and target system:
785
786       • The -A <arch> can be supplied for setting  the  target  architecture.
787         <arch>  usually  is one of arm, ppc, 86, etcetera.  If the target ar‐
788         chitecture is not specified then the default architecture of arm will
789         be used.
790
791       • The  -T <toolset> option can be used to set the directory location of
792         the toolset.  Both absolute and relative paths  are  valid.  Relative
793         paths  use GHS_TOOLSET_ROOT as the root. If the toolset is not speci‐
794         fied then the latest toolset found in GHS_TOOLSET_ROOT will be used.
795
796       Cache variables that are used for toolset and target system  customiza‐
797       tion:
798
799GHS_TARGET_PLATFORM
800         Defaults to integrity.
801         Usual values are integrity, threadx, uvelosity, velosity,
802         vxworks, standalone.
803
804
805GHS_PRIMARY_TARGET
806         Sets primaryTarget entry in project file.
807         Defaults to <arch>_<GHS_TARGET_PLATFORM>.tgt.
808
809
810GHS_TOOLSET_ROOT
811         Root path for toolset searches.
812         Defaults to C:/ghs in Windows or /usr/ghs in Linux.
813
814
815GHS_OS_ROOT
816         Root path for RTOS searches.
817         Defaults to C:/ghs in Windows or /usr/ghs in Linux.
818
819
820GHS_OS_DIR and GHS_OS_DIR_OPTION
821         Sets -os_dir entry in project file.
822         Defaults to latest platform OS installation at GHS_OS_ROOT.  Set this value if
823         a specific RTOS is to be used.
824         GHS_OS_DIR_OPTION default value is -os_dir.
825
826
827         New in version 3.15: The GHS_OS_DIR_OPTION variable.
828
829
830GHS_BSP_NAME
831         Sets -bsp entry in project file.
832         Defaults to sim<arch> for integrity platforms.
833
834
835   Target Properties
836       New in version 3.14.
837
838
839       The following properties are available:
840
841GHS_INTEGRITY_APP
842
843GHS_NO_SOURCE_GROUP_FILE
844
845       NOTE:
846          This  generator  is  deemed  experimental  as of CMake 3.22.0 and is
847          still a work in progress.  Future versions of CMake may make  break‐
848          ing changes as the generator matures.
849
850   Xcode
851       Generate Xcode project files.
852
853       Changed in version 3.15: This generator supports Xcode 5.0 and above.
854
855
856   Toolset and Build System Selection
857       By  default  Xcode is allowed to select its own default toolchain.  The
858       CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1)  -T
859       option, to specify another toolset.
860
861       New  in version 3.19: This generator supports toolset specification us‐
862       ing one of these forms:
863
864
865toolset
866
867toolset[,key=value]*
868
869key=value[,key=value]*
870
871       The toolset specifies the toolset name.  The selected toolset  name  is
872       provided in the CMAKE_XCODE_PLATFORM_TOOLSET variable.
873
874       The  key=value  pairs form a comma-separated list of options to specify
875       generator-specific details of the toolset selection.   Supported  pairs
876       are:
877
878       buildsystem=<variant>
879              Specify    the    buildsystem   variant   to   use.    See   the
880              CMAKE_XCODE_BUILD_SYSTEM variable for allowed values.
881
882              For example, to select the original build system under Xcode 12,
883              run cmake(1) with the option -T buildsystem=1.
884
885   Swift Support
886       New in version 3.4.
887
888
889       When using the Xcode generator with Xcode 6.1 or higher, one may enable
890       the Swift language with the enable_language() command or the project().
891

EXTRA GENERATORS

893       Some of the CMake Generators listed in the cmake(1)  command-line  tool
894       --help  output may have variants that specify an extra generator for an
895       auxiliary IDE tool.  Such generator names have the form  <extra-genera‐
896       tor>  -  <main-generator>.  The following extra generators are known to
897       CMake.
898
899   CodeBlocks
900       Generates CodeBlocks project files.
901
902       Project files for CodeBlocks will be created in the top  directory  and
903       in every subdirectory which features a CMakeLists.txt file containing a
904       project() call.  Additionally a hierarchy  of  makefiles  is  generated
905       into  the  build  tree.   The  appropriate  make  program can build the
906       project through the default all target.  An install target is also pro‐
907       vided.
908
909       New  in version 3.10: The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES vari‐
910       able may be set to ON to exclude any files which are located outside of
911       the project root directory.
912
913
914       This "extra" generator may be specified as:
915
916       CodeBlocks - MinGW Makefiles
917              Generate with MinGW Makefiles.
918
919       CodeBlocks - NMake Makefiles
920              Generate with NMake Makefiles.
921
922       CodeBlocks - NMake Makefiles JOM
923              New in version 3.8: Generate with NMake Makefiles JOM.
924
925
926       CodeBlocks - Ninja
927              Generate with Ninja.
928
929       CodeBlocks - Unix Makefiles
930              Generate with Unix Makefiles.
931
932   CodeLite
933       Generates CodeLite project files.
934
935       Project  files for CodeLite will be created in the top directory and in
936       every subdirectory which features a CMakeLists.txt  file  containing  a
937       project()  call.   The  appropriate  make program can build the project
938       through the default all target.  An install target is also provided.
939
940       New in version 3.7: The CMAKE_CODELITE_USE_TARGETS variable may be  set
941       to  ON  to  change the default behavior from projects to targets as the
942       basis for project files.
943
944
945       This "extra" generator may be specified as:
946
947       CodeLite - MinGW Makefiles
948              Generate with MinGW Makefiles.
949
950       CodeLite - NMake Makefiles
951              Generate with NMake Makefiles.
952
953       CodeLite - Ninja
954              Generate with Ninja.
955
956       CodeLite - Unix Makefiles
957              Generate with Unix Makefiles.
958
959   Eclipse CDT4
960       Generates Eclipse CDT 4.0 project files.
961
962       Project files for Eclipse will be created in the top directory.  In out
963       of  source  builds, a linked resource to the top level source directory
964       will be created.  Additionally a hierarchy of  makefiles  is  generated
965       into  the  build  tree.   The  appropriate  make  program can build the
966       project through the default all target.  An install target is also pro‐
967       vided.
968
969       This "extra" generator may be specified as:
970
971       Eclipse CDT4 - MinGW Makefiles
972              Generate with MinGW Makefiles.
973
974       Eclipse CDT4 - NMake Makefiles
975              Generate with NMake Makefiles.
976
977       Eclipse CDT4 - Ninja
978              Generate with Ninja.
979
980       Eclipse CDT4 - Unix Makefiles
981              Generate with Unix Makefiles.
982
983   Kate
984       Generates Kate project files.
985
986       A project file for Kate will be created in the top directory in the top
987       level build directory.  To use it in Kate, the Project plugin  must  be
988       enabled.   The  project  file is loaded in Kate by opening the Project‐
989       Name.kateproject file in the editor.  If the Kate Build-plugin  is  en‐
990       abled, all targets generated by CMake are available for building.
991
992       This "extra" generator may be specified as:
993
994       Kate - MinGW Makefiles
995              Generate with MinGW Makefiles.
996
997       Kate - NMake Makefiles
998              Generate with NMake Makefiles.
999
1000       Kate - Ninja
1001              Generate with Ninja.
1002
1003       Kate - Unix Makefiles
1004              Generate with Unix Makefiles.
1005
1006   Sublime Text 2
1007       Generates Sublime Text 2 project files.
1008
1009       Project  files  for Sublime Text 2 will be created in the top directory
1010       and in every subdirectory which features a CMakeLists.txt file contain‐
1011       ing  a  project()  call.  Additionally Makefiles (or build.ninja files)
1012       are generated into the build tree.  The appropriate  make  program  can
1013       build the project through the default all target.  An install target is
1014       also provided.
1015
1016       This "extra" generator may be specified as:
1017
1018       Sublime Text 2 - MinGW Makefiles
1019              Generate with MinGW Makefiles.
1020
1021       Sublime Text 2 - NMake Makefiles
1022              Generate with NMake Makefiles.
1023
1024       Sublime Text 2 - Ninja
1025              Generate with Ninja.
1026
1027       Sublime Text 2 - Unix Makefiles
1028              Generate with Unix Makefiles.
1029
1031       2000-2021 Kitware, Inc. and Contributors
1032
1033
1034
1035
10363.22.0                           Dec 02, 2021              CMAKE-GENERATORS(7)
Impressum