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 in‐
20       teractive 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
239       add_custom_command() and add_custom_target() through  its  cross-config
240       mode.  The  COMMAND,  DEPENDS,  and  WORKING_DIRECTORY arguments can be
241       evaluated in the context of either the "command config"  (the  "native"
242       configuration  of  the build-<Config>.ninja file in use) or the "output
243       config" (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
264              generator "$<CONFIG>.txt"
265                        "$<OUTPUT_CONFIG:$<CONFIG>>"
266                        "$<COMMAND_CONFIG:$<CONFIG>>"
267            DEPENDS
268              tgt1
269              "$<TARGET_FILE:tgt2>"
270              "$<OUTPUT_CONFIG:$<TARGET_FILE:tgt3>>"
271              "$<COMMAND_CONFIG:$<TARGET_FILE:tgt4>>"
272            )
273
274       Assume that generator, tgt1, tgt2, tgt3, and tgt4  are  all  executable
275       targets,  and  assume  that  $<CONFIG>.txt is built in the Debug output
276       config using the Release command config. The Release build of the  gen‐
277       erator  target is called with Debug.txt Debug Release as arguments. The
278       command depends on the Release builds of tgt1 and tgt4, and  the  Debug
279       builds of tgt2 and tgt3.
280
281       PRE_BUILD,  PRE_LINK,  and  POST_BUILD custom commands for targets only
282       get run in their "native" configuration (the Release  configuration  in
283       the  build-Release.ninja  file) unless they have no BYPRODUCTS or their
284       BYPRODUCTS are unique per config. Consider the following example:
285
286          add_executable(exe main.c)
287          add_custom_command(
288            TARGET exe
289            POST_BUILD
290            COMMAND
291              ${CMAKE_COMMAND} -E echo "Running no-byproduct command"
292            )
293          add_custom_command(
294            TARGET exe
295            POST_BUILD
296            COMMAND
297              ${CMAKE_COMMAND} -E echo
298              "Running separate-byproduct command for $<CONFIG>"
299            BYPRODUCTS $<CONFIG>.txt
300            )
301          add_custom_command(
302            TARGET exe
303            POST_BUILD
304            COMMAND
305              ${CMAKE_COMMAND} -E echo
306              "Running common-byproduct command for $<CONFIG>"
307            BYPRODUCTS exe.txt
308            )
309
310       In this example, if you build  exe:Debug  in  build-Release.ninja,  the
311       first  and  second  custom commands get run, since their byproducts are
312       unique per-config, but the last custom command does  not.  However,  if
313       you build exe:Release in build-Release.ninja, all three custom commands
314       get run.
315
316   IDE Build Tool Generators
317       These  generators  support  Integrated  Development  Environment  (IDE)
318       project  files.  Since the IDEs configure their own environment one may
319       launch CMake from any environment.
320
321   Visual Studio Generators
322   Visual Studio 6
323       Removed.  This once generated Visual Studio 6 project  files,  but  the
324       generator  has  been  removed since CMake 3.6.  It is still possible to
325       build with VS 6 tools using the NMake Makefiles generator.
326
327   Visual Studio 7
328       Removed.  This once generated Visual Studio .NET  2002  project  files,
329       but the generator has been removed since CMake 3.6.  It is still possi‐
330       ble to build with VS 7.0 tools using the NMake Makefiles generator.
331
332   Visual Studio 7 .NET 2003
333       Removed.  This once generated Visual Studio .NET  2003  project  files,
334       but the generator has been removed since CMake 3.9.  It is still possi‐
335       ble to build with VS 7.1 tools using the NMake Makefiles generator.
336
337   Visual Studio 8 2005
338       Removed.  This once generated Visual Studio 8 2005 project  files,  but
339       the  generator has been removed since CMake 3.12.  It is still possible
340       to build with VS 2005 tools using the NMake Makefiles generator.
341
342   Visual Studio 9 2008
343       Deprecated.  Generates Visual Studio 9 2008 project files.
344
345       NOTE:
346          This generator is deprecated and will be removed in a future version
347          of  CMake.   It will still be possible to build with VS 9 2008 tools
348          using the Visual Studio 12 2013 generator (or above, and with VS  10
349          2010  also installed) with CMAKE_GENERATOR_TOOLSET set to v90, or by
350          using the NMake Makefiles generator.
351
352   Platform Selection
353       The default target platform name (architecture) is Win32.
354
355       New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may  be  set,
356       perhaps via the cmake -A option, to specify a target platform name (ar‐
357       chitecture).  For example:
358
359cmake -G "Visual Studio 9 2008" -A Win32
360
361cmake -G "Visual Studio 9 2008" -A x64
362
363cmake -G "Visual Studio 9 2008" -A Itanium
364
365cmake -G "Visual Studio 9 2008"  -A  <WinCE-SDK>  (Specify  a  target
366         platform matching a Windows CE SDK name.)
367
368
369       For  compatibility  with CMake versions prior to 3.1, one may specify a
370       target platform name optionally at the end of the generator name.  This
371       is supported only for:
372
373       Visual Studio 9 2008 Win64
374              Specify target platform x64.
375
376       Visual Studio 9 2008 IA64
377              Specify target platform Itanium.
378
379       Visual Studio 9 2008 <WinCE-SDK>
380              Specify target platform matching a Windows CE SDK name.
381
382   Visual Studio 10 2010
383       Removed.   This once generated Visual Studio 10 2010 project files, but
384       the generator has been removed since CMake 3.25.  It is still  possible
385       to  build  with  VS  10  2010 tools using the Visual Studio 12 2013 (or
386       above) generator with CMAKE_GENERATOR_TOOLSET set to v100, or by  using
387       the NMake Makefiles generator.
388
389   Visual Studio 11 2012
390       Deprecated.  Generates Visual Studio 11 (VS 2012) project files.
391
392       NOTE:
393          This generator is deprecated and will be removed in a future version
394          of CMake.  It will still be possible to build with VS 11 2012  tools
395          using   the   Visual  Studio  12  2013  (or  above)  generator  with
396          CMAKE_GENERATOR_TOOLSET set to v110, or by using the NMake Makefiles
397          generator.
398
399       For  compatibility  with  CMake  versions prior to 3.0, one may specify
400       this generator using the name "Visual Studio 11" without the year  com‐
401       ponent.
402
403   Project Types
404       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
405       tel compiler integration).  Other types of projects (JavaScript,  Data‐
406       base, Website, etc.) are not supported.
407
408   Platform Selection
409       The default target platform name (architecture) is Win32.
410
411       New  in  version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
412       perhaps via the cmake -A option, to specify a target platform name (ar‐
413       chitecture).  For example:
414
415cmake -G "Visual Studio 11 2012" -A Win32
416
417cmake -G "Visual Studio 11 2012" -A x64
418
419cmake -G "Visual Studio 11 2012" -A ARM
420
421cmake  -G  "Visual  Studio  11 2012" -A <WinCE-SDK> (Specify a target
422         platform matching a Windows CE SDK name.)
423
424
425       For compatibility with CMake versions prior to 3.1, one may  specify  a
426       target platform name optionally at the end of the generator name.  This
427       is supported only for:
428
429       Visual Studio 11 2012 Win64
430              Specify target platform x64.
431
432       Visual Studio 11 2012 ARM
433              Specify target platform ARM.
434
435       Visual Studio 11 2012 <WinCE-SDK>
436              Specify target platform matching a Windows CE SDK name.
437
438   Toolset Selection
439       The v110 toolset that comes with Visual Studio 11 2012 is  selected  by
440       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
441       the cmake -T option, to specify another toolset.
442
443   Visual Studio 12 2013
444       Generates Visual Studio 12 (VS 2013) project files.
445
446       For compatibility with CMake versions prior to  3.0,  one  may  specify
447       this  generator using the name "Visual Studio 12" without the year com‐
448       ponent.
449
450   Project Types
451       Only Visual C++ and C# projects may be generated (and Fortran with  In‐
452       tel compiler integration).  Other types of projects (JavaScript, Power‐
453       shell, Python, etc.) are not supported.
454
455   Platform Selection
456       The default target platform name (architecture) is Win32.
457
458       New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may  be  set,
459       perhaps via the cmake -A option, to specify a target platform name (ar‐
460       chitecture).  For example:
461
462cmake -G "Visual Studio 12 2013" -A Win32
463
464cmake -G "Visual Studio 12 2013" -A x64
465
466cmake -G "Visual Studio 12 2013" -A ARM
467
468
469       For compatibility with CMake versions prior to 3.1, one may  specify  a
470       target platform name optionally at the end of the generator name.  This
471       is supported only for:
472
473       Visual Studio 12 2013 Win64
474              Specify target platform x64.
475
476       Visual Studio 12 2013 ARM
477              Specify target platform ARM.
478
479   Toolset Selection
480       The v120 toolset that comes with Visual Studio 12 2013 is  selected  by
481       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
482       the cmake -T option, to specify another toolset.
483
484       New in version 3.8: For each toolset that comes with  this  version  of
485       Visual  Studio,  there  are  variants  that are themselves compiled for
486       32-bit (x86) and 64-bit (x64) hosts (independent  of  the  architecture
487       they  target).   By default this generator uses the 32-bit variant even
488       on a 64-bit host.  One may explicitly request use of either the  32-bit
489       or  64-bit  host  tools  by  adding  either host=x86 or host=x64 to the
490       toolset specification.  See the  CMAKE_GENERATOR_TOOLSET  variable  for
491       details.
492
493
494       New in version 3.14: Added support for host=x86 option.
495
496
497   Visual Studio 14 2015
498       New in version 3.1.
499
500
501       Generates Visual Studio 14 (VS 2015) project files.
502
503   Project Types
504       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
505       tel compiler integration).  Other types of projects (JavaScript, Power‐
506       shell, Python, etc.) are not supported.
507
508   Platform Selection
509       The default target platform name (architecture) is Win32.
510
511       The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake
512       -A option, to specify a target platform name (architecture).  For exam‐
513       ple:
514
515cmake -G "Visual Studio 14 2015" -A Win32
516
517cmake -G "Visual Studio 14 2015" -A x64
518
519cmake -G "Visual Studio 14 2015" -A ARM
520
521       For  compatibility  with CMake versions prior to 3.1, one may specify a
522       target platform name optionally at the end of the generator name.  This
523       is supported only for:
524
525       Visual Studio 14 2015 Win64
526              Specify target platform x64.
527
528       Visual Studio 14 2015 ARM
529              Specify target platform ARM.
530
531   Toolset Selection
532       The  v140  toolset that comes with Visual Studio 14 2015 is selected by
533       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
534       the cmake -T option, to specify another toolset.
535
536       New  in  version  3.8: For each toolset that comes with this version of
537       Visual Studio, there are variants  that  are  themselves  compiled  for
538       32-bit  (x86)  and  64-bit (x64) hosts (independent of the architecture
539       they target).  By default this generator uses the 32-bit  variant  even
540       on  a 64-bit host.  One may explicitly request use of either the 32-bit
541       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
542       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
543       details.
544
545
546       New in version 3.14: Added support for host=x86 option.
547
548
549   Windows 10 SDK Maximum Version for VS 2015
550       New in version 3.19.
551
552
553       Microsoft stated in a "Windows 10 October 2018 Update" blog  post  that
554       Windows  10 SDK versions (15063, 16299, 17134, 17763) are not supported
555       by VS 2015 and are only supported by VS 2017 and later.   Therefore  by
556       default   CMake   automatically   ignores   Windows   10   SDKs  beyond
557       10.0.14393.0.
558
559       However, there  are  other  recommendations  for  certain  driver/Win32
560       builds  that  indicate otherwise.  A user can override this behavior by
561       either setting the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM  to
562       a          false          value          or         setting         the
563       CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM to the string value of
564       the required maximum (e.g. 10.0.15063.0).
565
566   Visual Studio 15 2017
567       New in version 3.7.1.
568
569
570       Generates Visual Studio 15 (VS 2017) project files.
571
572   Project Types
573       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
574       tel compiler integration).  Other types of projects (JavaScript, Power‐
575       shell, Python, etc.) are not supported.
576
577   Instance Selection
578       New in version 3.11.
579
580
581       VS  2017  supports  multiple  installations  on  the same machine.  The
582       CMAKE_GENERATOR_INSTANCE variable may be used to select one.
583
584   Platform Selection
585       The default target platform name (architecture) is Win32.
586
587       The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake
588       -A option, to specify a target platform name (architecture).  For exam‐
589       ple:
590
591cmake -G "Visual Studio 15 2017" -A Win32
592
593cmake -G "Visual Studio 15 2017" -A x64
594
595cmake -G "Visual Studio 15 2017" -A ARM
596
597cmake -G "Visual Studio 15 2017" -A ARM64
598
599       For compatibility with CMake versions prior to 3.1, one may  specify  a
600       target platform name optionally at the end of the generator name.  This
601       is supported only for:
602
603       Visual Studio 15 2017 Win64
604              Specify target platform x64.
605
606       Visual Studio 15 2017 ARM
607              Specify target platform ARM.
608
609   Toolset Selection
610       The v141 toolset that comes with Visual Studio 15 2017 is  selected  by
611       default.   The  CMAKE_GENERATOR_TOOLSET  option may be set, perhaps via
612       the cmake -T option, to specify another toolset.
613
614       New in version 3.8: For each toolset that comes with  this  version  of
615       Visual  Studio,  there  are  variants  that are themselves compiled for
616       32-bit (x86) and 64-bit (x64) hosts (independent  of  the  architecture
617       they  target).   By default this generator uses the 32-bit variant even
618       on a 64-bit host.  One may explicitly request use of either the  32-bit
619       or  64-bit  host  tools  by  adding  either host=x86 or host=x64 to the
620       toolset specification.  See the  CMAKE_GENERATOR_TOOLSET  variable  for
621       details.
622
623
624       New in version 3.14: Added support for host=x86 option.
625
626
627   Visual Studio 16 2019
628       New in version 3.14.
629
630
631       Generates Visual Studio 16 (VS 2019) project files.
632
633   Project Types
634       Only  Visual C++ and C# projects may be generated (and Fortran with In‐
635       tel compiler integration).  Other types of projects (JavaScript, Power‐
636       shell, Python, etc.) are not supported.
637
638   Instance Selection
639       VS  2019  supports  multiple  installations  on  the same machine.  The
640       CMAKE_GENERATOR_INSTANCE variable may be used to select one.
641
642   Platform Selection
643       The default target platform name (architecture) is that of the host and
644       is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
645
646       The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake
647       -A option, to specify a target platform name (architecture).  For exam‐
648       ple:
649
650cmake -G "Visual Studio 16 2019" -A Win32
651
652cmake -G "Visual Studio 16 2019" -A x64
653
654cmake -G "Visual Studio 16 2019" -A ARM
655
656cmake -G "Visual Studio 16 2019" -A ARM64
657
658   Toolset Selection
659       The  v142  toolset that comes with Visual Studio 16 2019 is selected by
660       default.  The CMAKE_GENERATOR_TOOLSET option may be  set,  perhaps  via
661       the cmake -T option, to specify another toolset.
662
663       For  each  toolset that comes with this version of Visual Studio, there
664       are variants that are themselves compiled for 32-bit (x86)  and  64-bit
665       (x64)  hosts (independent of the architecture they target).  By default
666       this generator uses the 64-bit variant on  x64  hosts  and  the  32-bit
667       variant otherwise.  One may explicitly request use of either the 32-bit
668       or 64-bit host tools by adding  either  host=x86  or  host=x64  to  the
669       toolset  specification.   See  the CMAKE_GENERATOR_TOOLSET variable for
670       details.
671
672   Visual Studio 17 2022
673       New in version 3.21.
674
675
676       Generates Visual Studio 17 (VS 2022) project files.
677
678   Project Types
679       Only Visual C++ and C# projects may be generated (and Fortran with  In‐
680       tel compiler integration).  Other types of projects (JavaScript, Power‐
681       shell, Python, etc.) are not supported.
682
683   Instance Selection
684       VS 2022 supports multiple  installations  on  the  same  machine.   The
685       CMAKE_GENERATOR_INSTANCE variable may be used to select one.
686
687   Platform Selection
688       The default target platform name (architecture) is that of the host and
689       is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
690
691       The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake
692       -A option, to specify a target platform name (architecture).  For exam‐
693       ple:
694
695cmake -G "Visual Studio 17 2022" -A Win32
696
697cmake -G "Visual Studio 17 2022" -A x64
698
699cmake -G "Visual Studio 17 2022" -A ARM
700
701cmake -G "Visual Studio 17 2022" -A ARM64
702
703   Toolset Selection
704       The v143 toolset that comes with VS 17 2022  is  selected  by  default.
705       The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake -T
706       option, to specify another toolset.
707
708       For each toolset that comes with this version of Visual  Studio,  there
709       are  variants  that are themselves compiled for 32-bit (x86) and 64-bit
710       (x64) hosts (independent of the architecture they target).  By  default
711       this  generator  uses  the  64-bit  variant on x64 hosts and the 32-bit
712       variant otherwise.  One may explicitly request use of either the 32-bit
713       or  64-bit  host  tools  by  adding  either host=x86 or host=x64 to the
714       toolset specification.  See the  CMAKE_GENERATOR_TOOLSET  variable  for
715       details.
716
717   Other Generators
718   Green Hills MULTI
719       New in version 3.3.
720
721
722       New in version 3.15: Linux support.
723
724
725       Generates    Green    Hills    MULTI   project   files   (experimental,
726       work-in-progress).
727          The buildsystem has predetermined build-configuration settings  that
728          can be controlled via the CMAKE_BUILD_TYPE variable.
729
730   Platform Selection
731       New in version 3.13.
732
733
734       The  variable GHS_PRIMARY_TARGET can be used to select the target plat‐
735       form.
736          Sets primaryTarget entry in project file.
737
738
739       For example:
740
741cmake -G "Green Hills MULTI" -D GHS_PRIMARY_TARGET=ppc_integrity.tgt
742
743       Otherwise the  primaryTarget  will  be  composed  from  the  values  of
744       CMAKE_GENERATOR_PLATFORM  and  GHS_TARGET_PLATFORM.  Defaulting  to the
745       value of arm_integrity.tgt
746
747       • The CMAKE_GENERATOR_PLATFORM variable may be  set,  perhaps  via  the
748         cmake -A option.
749         Typical values of arm, ppc, 86, etcetera, are used.
750
751
752       • The variable GHS_TARGET_PLATFORM may be set, perhaps via the cmake -D
753         option.
754         Defaults to integrity.
755         Usual values are integrity, threadx, uvelosity, velosity,
756         vxworks, standalone.
757
758
759       For example:
760
761cmake -G "Green Hills MULTI" for arm_integrity.tgt.
762
763cmake -G "Green Hills MULTI" -A 86 for 86_integrity.tgt.
764
765cmake -G "Green Hills MULTI"  -D  GHS_TARGET_PLATFORM=standalone  for
766         arm_standalone.tgt.
767
768cmake -G "Green Hills MULTI" -A ppc -D GHS_TARGET_PLATFORM=standalone
769         for ppc_standalone.tgt.
770
771   Toolset Selection
772       New in version 3.13.
773
774
775       The generator searches for the latest compiler or can be given a  loca‐
776       tion to use.  GHS_TOOLSET_ROOT is the directory that is checked for the
777       latest compiler.
778
779       • The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the  cmake
780         -T option, to specify the location of the toolset.  Both absolute and
781         relative paths are valid. Paths are relative to GHS_TOOLSET_ROOT.
782
783       • The variable GHS_TOOLSET_ROOT may be set, perhaps via  the  cmake  -D
784         option.
785         Root path for toolset searches and relative paths.
786         Defaults to C:/ghs in Windows or /usr/ghs in Linux.
787
788
789       For example, setting a specific compiler:
790
791cmake -G "Green Hills MULTI" -T comp_201754 for /usr/ghs/comp_201754.
792
793cmake     -G     "Green    Hills    MULTI"    -T    comp_201754    -D
794         GHS_TOOLSET_ROOT=/opt/ghs for /opt/ghs/comp_201754.
795
796cmake -G "Green Hills MULTI" -T /usr/ghs/comp_201554
797
798cmake -G "Green Hills MULTI" -T C:/ghs/comp_201754
799
800       For example, searching for latest compiler:
801
802cmake -G "Green Hills MULTI" for searching /usr/ghs.
803
804cmake -G "Green Hills MULTI -D GHS_TOOLSET_ROOT=/opt/ghs" for search‐
805         ing /opt/ghs.
806
807       NOTE:
808          The CMAKE_GENERATOR_TOOLSET should use CMake style paths.
809
810   OS and BSP Selection
811       New in version 3.3.
812
813
814       Certain  target platforms, like Integrity, require an OS.  The RTOS di‐
815       rectory  path  can  be  explicitly  set  using  GHS_OS_DIR.   Otherwise
816       GHS_OS_ROOT will be searched for the latest Integrity RTOS.
817
818       If the target platform, like Integrity, requires a BSP name then it can
819       be set via the GHS_BSP_NAME variable.
820
821GHS_OS_DIR and GHS_OS_DIR_OPTION
822         Sets -os_dir entry in project file.
823
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
830         For example:
831
832cmake -G "Green Hills MULTI" -D GHS_OS_DIR=/usr/ghs/int1144
833
834GHS_OS_ROOT
835         Root path for RTOS searches.
836         Defaults to C:/ghs in Windows or /usr/ghs in Linux.
837
838
839         For example:
840
841cmake -G "Green Hills MULTI" -D GHS_OS_ROOT=/opt/ghs
842
843GHS_BSP_NAME
844         Sets -bsp entry in project file.
845         Defaults to sim<arch> for integrity platforms.
846
847
848         For example:
849
850cmake -G "Green Hills MULTI" for simarm on arm_integrity.tgt.
851
852cmake -G "Green Hills MULTI" -A 86 for sim86 on 86_integrity.tgt.
853
854cmake -G "Green Hills MULTI"  -A  ppc  -D  GHS_BSP_NAME=sim800  for
855           sim800 on ppc_integrity.tgt.
856
857cmake  -G  "Green  Hills  MULTI"  -D  GHS_PRIMARY_TARGET=ppc_integ‐
858           rity.tgt -D  GHS_BSP_NAME=fsl-t1040  for  fsl-t1040  on  ppc_integ‐
859           rity.tgt.
860
861   Target Properties
862       New in version 3.14.
863
864
865       The following properties are available:
866
867GHS_INTEGRITY_APP
868
869GHS_NO_SOURCE_GROUP_FILE
870
871   MULTI Project Variables
872       New in version 3.3.
873
874
875       Adding a Customization file and macros are available through the use of
876       the following variables:
877
878GHS_CUSTOMIZATION - CMake path name to Customization File.
879
880GHS_GPJ_MACROS - CMake list of Macros.
881
882       NOTE:
883          This generator is deemed experimental as  of  CMake  3.27.7  and  is
884          still  a work in progress.  Future versions of CMake may make break‐
885          ing changes as the generator matures.
886
887   Xcode
888       Generate Xcode project files.
889
890       Changed in version 3.15: This generator supports Xcode 5.0 and above.
891
892
893   Toolset and Build System Selection
894       By default Xcode is allowed to select its own default  toolchain.   The
895       CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake -T op‐
896       tion, to specify another toolset.
897
898       New in version 3.19: This generator supports toolset specification  us‐
899       ing one of these forms:
900
901
902toolset
903
904toolset[,key=value]*
905
906key=value[,key=value]*
907
908       The  toolset  specifies the toolset name.  The selected toolset name is
909       provided in the CMAKE_XCODE_PLATFORM_TOOLSET variable.
910
911       The key=value pairs form a comma-separated list of options  to  specify
912       generator-specific  details  of the toolset selection.  Supported pairs
913       are:
914
915       buildsystem=<variant>
916              Specify   the   buildsystem   variant   to   use.     See    the
917              CMAKE_XCODE_BUILD_SYSTEM variable for allowed values.
918
919              For example, to select the original build system under Xcode 12,
920              run cmake(1) with the option -T buildsystem=1.
921
922   Swift Support
923       New in version 3.4.
924
925
926       When using the Xcode generator with Xcode 6.1 or higher, one may enable
927       the Swift language with the enable_language() command or the project().
928
929   Limitations
930       The  Xcode  generator does not support per-configuration sources.  Code
931       like the following will result in a generation error:
932
933          add_executable(MyApp mymain-$<CONFIG>.cpp)
934

EXTRA GENERATORS

936       Deprecated since version 3.27: Support for "Extra Generators" is depre‐
937       cated and will be removed from a future version of CMake.  IDEs may use
938       the cmake-file-api(7) to view CMake-generated project build trees.
939
940
941       Some of the CMake Generators listed in the cmake(1)  command-line  tool
942       --help  output may have variants that specify an extra generator for an
943       auxiliary IDE tool.  Such generator names have the form  <extra-genera‐
944       tor>  -  <main-generator>.  The following extra generators are known to
945       CMake.
946
947   CodeBlocks
948       Deprecated since version 3.27: Support for Extra Generators  is  depre‐
949       cated and will be removed from a future version of CMake.  IDEs may use
950       the cmake-file-api(7) to view CMake-generated project build trees.
951
952
953       Generates CodeBlocks project files.
954
955       Project files for CodeBlocks will be created in the top  directory  and
956       in every subdirectory which features a CMakeLists.txt file containing a
957       project() call.  Additionally a hierarchy  of  makefiles  is  generated
958       into  the  build  tree.   The  appropriate  make  program can build the
959       project through the default all target.  An install target is also pro‐
960       vided.
961
962       New  in version 3.10: The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES vari‐
963       able may be set to ON to exclude any files which are located outside of
964       the project root directory.
965
966
967       This "extra" generator may be specified as:
968
969       CodeBlocks - MinGW Makefiles
970              Generate with MinGW Makefiles.
971
972       CodeBlocks - NMake Makefiles
973              Generate with NMake Makefiles.
974
975       CodeBlocks - NMake Makefiles JOM
976              New in version 3.8: Generate with NMake Makefiles JOM.
977
978
979       CodeBlocks - Ninja
980              Generate with Ninja.
981
982       CodeBlocks - Unix Makefiles
983              Generate with Unix Makefiles.
984
985   CodeLite
986       Deprecated  since  version 3.27: Support for Extra Generators is depre‐
987       cated and will be removed from a future version of CMake.  IDEs may use
988       the cmake-file-api(7) to view CMake-generated project build trees.
989
990
991       Generates CodeLite project files.
992
993       Project  files for CodeLite will be created in the top directory and in
994       every subdirectory which features a CMakeLists.txt  file  containing  a
995       project()  call.   The  appropriate  make program can build the project
996       through the default all target.  An install target is also provided.
997
998       New in version 3.7: The CMAKE_CODELITE_USE_TARGETS variable may be  set
999       to  ON  to  change the default behavior from projects to targets as the
1000       basis for project files.
1001
1002
1003       This "extra" generator may be specified as:
1004
1005       CodeLite - MinGW Makefiles
1006              Generate with MinGW Makefiles.
1007
1008       CodeLite - NMake Makefiles
1009              Generate with NMake Makefiles.
1010
1011       CodeLite - Ninja
1012              Generate with Ninja.
1013
1014       CodeLite - Unix Makefiles
1015              Generate with Unix Makefiles.
1016
1017   Eclipse CDT4
1018       Deprecated since version 3.27: Support for Extra Generators  is  depre‐
1019       cated and will be removed from a future version of CMake.  IDEs may use
1020       the cmake-file-api(7) to view CMake-generated project build trees.
1021
1022
1023       Generates Eclipse CDT 4.0 project files.
1024
1025       Project files for Eclipse will be created in the top directory.  In out
1026       of  source  builds, a linked resource to the top level source directory
1027       will be created.  Additionally a hierarchy of  makefiles  is  generated
1028       into  the  build  tree.   The  appropriate  make  program can build the
1029       project through the default all target.  An install target is also pro‐
1030       vided.
1031
1032       This "extra" generator may be specified as:
1033
1034       Eclipse CDT4 - MinGW Makefiles
1035              Generate with MinGW Makefiles.
1036
1037       Eclipse CDT4 - NMake Makefiles
1038              Generate with NMake Makefiles.
1039
1040       Eclipse CDT4 - Ninja
1041              Generate with Ninja.
1042
1043       Eclipse CDT4 - Unix Makefiles
1044              Generate with Unix Makefiles.
1045
1046   Kate
1047       Deprecated  since  version 3.27: Support for Extra Generators is depre‐
1048       cated and will be removed from a future version of CMake.  IDEs may use
1049       the cmake-file-api(7) to view CMake-generated project build trees.
1050
1051
1052       Generates Kate project files.
1053
1054       A project file for Kate will be created in the top directory in the top
1055       level build directory.  To use it in Kate, the Project plugin  must  be
1056       enabled.   The  project  file is loaded in Kate by opening the Project‐
1057       Name.kateproject file in the editor.  If the Kate Build-plugin  is  en‐
1058       abled, all targets generated by CMake are available for building.
1059
1060       This "extra" generator may be specified as:
1061
1062       Kate - MinGW Makefiles
1063              Generate with MinGW Makefiles.
1064
1065       Kate - NMake Makefiles
1066              Generate with NMake Makefiles.
1067
1068       Kate - Ninja
1069              Generate with Ninja.
1070
1071       Kate - Ninja Multi-Config
1072              Generate with Ninja Multi-Config.
1073
1074       Kate - Unix Makefiles
1075              Generate with Unix Makefiles.
1076
1077   Sublime Text 2
1078       Deprecated  since  version 3.27: Support for Extra Generators is depre‐
1079       cated and will be removed from a future version of CMake.  IDEs may use
1080       the cmake-file-api(7) to view CMake-generated project build trees.
1081
1082
1083       Generates Sublime Text 2 project files.
1084
1085       Project  files  for Sublime Text 2 will be created in the top directory
1086       and in every subdirectory which features a CMakeLists.txt file contain‐
1087       ing  a  project()  call.  Additionally Makefiles (or build.ninja files)
1088       are generated into the build tree.  The appropriate  make  program  can
1089       build the project through the default all target.  An install target is
1090       also provided.
1091
1092       This "extra" generator may be specified as:
1093
1094       Sublime Text 2 - MinGW Makefiles
1095              Generate with MinGW Makefiles.
1096
1097       Sublime Text 2 - NMake Makefiles
1098              Generate with NMake Makefiles.
1099
1100       Sublime Text 2 - Ninja
1101              Generate with Ninja.
1102
1103       Sublime Text 2 - Unix Makefiles
1104              Generate with Unix Makefiles.
1105
1107       2000-2023 Kitware, Inc. and Contributors
1108
1109
1110
1111
11123.27.7                           Oct 07, 2023              CMAKE-GENERATORS(7)
Impressum