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 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
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.
186
187 CMAKE_CROSS_CONFIGS
188 Specifies a semicolon-separated list of configurations available
189 from all build-<Config>.ninja files.
190
191 CMAKE_DEFAULT_BUILD_TYPE
192 Specifies the configuration to use by default in a build.ninja
193 file.
194
195 CMAKE_DEFAULT_CONFIGS
196 Specifies a semicolon-separated list of configurations to build
197 for a target in build.ninja if no :<Config> suffix is specified.
198
199 Consider the following example:
200
201 cmake_minimum_required(VERSION 3.16)
202 project(MultiConfigNinja C)
203
204 add_executable(generator generator.c)
205 add_custom_command(OUTPUT generated.c COMMAND generator generated.c)
206 add_library(generated ${CMAKE_BINARY_DIR}/generated.c)
207
208 Now assume you configure the project with Ninja Multi-Config and run
209 one of the following commands:
210
211 ninja -f build-Debug.ninja generated
212 # OR
213 cmake --build . --config Debug --target generated
214
215 This would build the Debug configuration of generator, which would be
216 used to generate generated.c, which would be used to build the Debug
217 configuration of generated.
218
219 But if CMAKE_CROSS_CONFIGS is set to all, and you run the following in‐
220 stead:
221
222 ninja -f build-Release.ninja generated:Debug
223 # OR
224 cmake --build . --config Release --target generated:Debug
225
226 This would build the Release configuration of generator, which would be
227 used to generate generated.c, which would be used to build the Debug
228 configuration of generated. This is useful for running a release-opti‐
229 mized version of a generator utility while still building the debug
230 version of the targets built with the generated code.
231
232 Custom Commands
233 New in version 3.20.
234
235
236 The Ninja Multi-Config generator adds extra capabilities to add_cus‐
237 tom_command() and add_custom_target() through its cross-config mode.
238 The COMMAND, DEPENDS, and WORKING_DIRECTORY arguments can be evaluated
239 in the context of either the "command config" (the "native" configura‐
240 tion of the build-<Config>.ninja file in use) or the "output config"
241 (the configuration used to evaluate the OUTPUT and BYPRODUCTS).
242
243 If either OUTPUT or BYPRODUCTS names a path that is common to more than
244 one configuration (e.g. it does not use any generator expressions), all
245 arguments are evaluated in the command config by default. If all OUT‐
246 PUT and BYPRODUCTS paths are unique to each configuration (e.g. by us‐
247 ing the $<CONFIG> generator expression), the first argument of COMMAND
248 is still evaluated in the command config by default, while all subse‐
249 quent arguments, as well as the arguments to DEPENDS and WORKING_DIREC‐
250 TORY, are evaluated in the output config. These defaults can be over‐
251 ridden with the $<OUTPUT_CONFIG:...> and $<COMMAND_CONFIG:...> genera‐
252 tor-expressions. Note that if a target is specified by its name in DE‐
253 PENDS, or as the first argument of COMMAND, it is always evaluated in
254 the command config, even if it is wrapped in $<OUTPUT_CONFIG:...> (be‐
255 cause its plain name is not a generator expression).
256
257 As an example, consider the following:
258
259 add_custom_command(
260 OUTPUT "$<CONFIG>.txt"
261 COMMAND generator "$<CONFIG>.txt" "$<OUTPUT_CONFIG:$<CONFIG>>" "$<COMMAND_CONFIG:$<CONFIG>>"
262 DEPENDS tgt1 "$<TARGET_FILE:tgt2>" "$<OUTPUT_CONFIG:$<TARGET_FILE:tgt3>>" "$<COMMAND_CONFIG:$<TARGET_FILE:tgt4>>"
263 )
264
265 Assume that generator, tgt1, tgt2, tgt3, and tgt4 are all executable
266 targets, and assume that $<CONFIG>.txt is built in the Debug output
267 config using the Release command config. The Release build of the gen‐
268 erator target is called with Debug.txt Debug Release as arguments. The
269 command depends on the Release builds of tgt1 and tgt4, and the Debug
270 builds of tgt2 and tgt3.
271
272 PRE_BUILD, PRE_LINK, and POST_BUILD custom commands for targets only
273 get run in their "native" configuration (the Release configuration in
274 the build-Release.ninja file) unless they have no BYPRODUCTS or their
275 BYPRODUCTS are unique per config. Consider the following example:
276
277 add_executable(exe main.c)
278 add_custom_command(
279 TARGET exe
280 POST_BUILD
281 COMMAND ${CMAKE_COMMAND} -E echo "Running no-byproduct command"
282 )
283 add_custom_command(
284 TARGET exe
285 POST_BUILD
286 COMMAND ${CMAKE_COMMAND} -E echo "Running separate-byproduct command for $<CONFIG>"
287 BYPRODUCTS $<CONFIG>.txt
288 )
289 add_custom_command(
290 TARGET exe
291 POST_BUILD
292 COMMAND ${CMAKE_COMMAND} -E echo "Running common-byproduct command for $<CONFIG>"
293 BYPRODUCTS exe.txt
294 )
295
296 In this example, if you build exe:Debug in build-Release.ninja, the
297 first and second custom commands get run, since their byproducts are
298 unique per-config, but the last custom command does not. However, if
299 you build exe:Release in build-Release.ninja, all three custom commands
300 get run.
301
302 IDE Build Tool Generators
303 These generators support Integrated Development Environment (IDE)
304 project files. Since the IDEs configure their own environment one may
305 launch CMake from any environment.
306
307 Visual Studio Generators
308 Visual Studio 6
309 Removed. This once generated Visual Studio 6 project files, but the
310 generator has been removed since CMake 3.6. It is still possible to
311 build with VS 6 tools using the NMake Makefiles generator.
312
313 Visual Studio 7
314 Removed. This once generated Visual Studio .NET 2002 project files,
315 but the generator has been removed since CMake 3.6. It is still possi‐
316 ble to build with VS 7.0 tools using the NMake Makefiles generator.
317
318 Visual Studio 7 .NET 2003
319 Removed. This once generated Visual Studio .NET 2003 project files,
320 but the generator has been removed since CMake 3.9. It is still possi‐
321 ble to build with VS 7.1 tools using the NMake Makefiles generator.
322
323 Visual Studio 8 2005
324 Removed. This once generated Visual Studio 8 2005 project files, but
325 the generator has been removed since CMake 3.12. It is still possible
326 to build with VS 2005 tools using the NMake Makefiles generator.
327
328 Visual Studio 9 2008
329 Generates Visual Studio 9 2008 project files.
330
331 Platform Selection
332 The default target platform name (architecture) is Win32.
333
334 New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
335 perhaps via the cmake(1) -A option, to specify a target platform name
336 (architecture). For example:
337
338 • cmake -G "Visual Studio 9 2008" -A Win32
339
340 • cmake -G "Visual Studio 9 2008" -A x64
341
342 • cmake -G "Visual Studio 9 2008" -A Itanium
343
344 • cmake -G "Visual Studio 9 2008" -A <WinCE-SDK> (Specify a target
345 platform matching a Windows CE SDK name.)
346
347
348 For compatibility with CMake versions prior to 3.1, one may specify a
349 target platform name optionally at the end of the generator name. This
350 is supported only for:
351
352 Visual Studio 9 2008 Win64
353 Specify target platform x64.
354
355 Visual Studio 9 2008 IA64
356 Specify target platform Itanium.
357
358 Visual Studio 9 2008 <WinCE-SDK>
359 Specify target platform matching a Windows CE SDK name.
360
361 Visual Studio 10 2010
362 Generates Visual Studio 10 (VS 2010) project files.
363
364 For compatibility with CMake versions prior to 3.0, one may specify
365 this generator using the name Visual Studio 10 without the year compo‐
366 nent.
367
368 Project Types
369 Only Visual C++ and C# projects may be generated. Other types of
370 projects (Database, Website, etc.) are not supported.
371
372 Platform Selection
373 The default target platform name (architecture) is Win32.
374
375 New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
376 perhaps via the cmake(1) -A option, to specify a target platform name
377 (architecture). For example:
378
379 • cmake -G "Visual Studio 10 2010" -A Win32
380
381 • cmake -G "Visual Studio 10 2010" -A x64
382
383 • cmake -G "Visual Studio 10 2010" -A Itanium
384
385
386 For compatibility with CMake versions prior to 3.1, one may specify a
387 target platform name optionally at the end of the generator name. This
388 is supported only for:
389
390 Visual Studio 10 2010 Win64
391 Specify target platform x64.
392
393 Visual Studio 10 2010 IA64
394 Specify target platform Itanium.
395
396 Toolset Selection
397 The v100 toolset that comes with Visual Studio 10 2010 is selected by
398 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
399 the cmake(1) -T option, to specify another toolset.
400
401 Visual Studio 11 2012
402 Generates Visual Studio 11 (VS 2012) project files.
403
404 For compatibility with CMake versions prior to 3.0, one may specify
405 this generator using the name "Visual Studio 11" without the year com‐
406 ponent.
407
408 Project Types
409 Only Visual C++ and C# projects may be generated. Other types of
410 projects (JavaScript, Database, Website, etc.) are not supported.
411
412 Platform Selection
413 The default target platform name (architecture) is Win32.
414
415 New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
416 perhaps via the cmake(1) -A option, to specify a target platform name
417 (architecture). For example:
418
419 • cmake -G "Visual Studio 11 2012" -A Win32
420
421 • cmake -G "Visual Studio 11 2012" -A x64
422
423 • cmake -G "Visual Studio 11 2012" -A ARM
424
425 • cmake -G "Visual Studio 11 2012" -A <WinCE-SDK> (Specify a target
426 platform matching a Windows CE SDK name.)
427
428
429 For compatibility with CMake versions prior to 3.1, one may specify a
430 target platform name optionally at the end of the generator name. This
431 is supported only for:
432
433 Visual Studio 11 2012 Win64
434 Specify target platform x64.
435
436 Visual Studio 11 2012 ARM
437 Specify target platform ARM.
438
439 Visual Studio 11 2012 <WinCE-SDK>
440 Specify target platform matching a Windows CE SDK name.
441
442 Toolset Selection
443 The v110 toolset that comes with Visual Studio 11 2012 is selected by
444 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
445 the cmake(1) -T option, to specify another toolset.
446
447 Visual Studio 12 2013
448 Generates Visual Studio 12 (VS 2013) project files.
449
450 For compatibility with CMake versions prior to 3.0, one may specify
451 this generator using the name "Visual Studio 12" without the year com‐
452 ponent.
453
454 Project Types
455 Only Visual C++ and C# projects may be generated. Other types of
456 projects (JavaScript, Powershell, Python, etc.) are not supported.
457
458 Platform Selection
459 The default target platform name (architecture) is Win32.
460
461 New in version 3.1: The CMAKE_GENERATOR_PLATFORM variable may be set,
462 perhaps via the cmake(1) -A option, to specify a target platform name
463 (architecture). For example:
464
465 • cmake -G "Visual Studio 12 2013" -A Win32
466
467 • cmake -G "Visual Studio 12 2013" -A x64
468
469 • cmake -G "Visual Studio 12 2013" -A ARM
470
471
472 For compatibility with CMake versions prior to 3.1, one may specify a
473 target platform name optionally at the end of the generator name. This
474 is supported only for:
475
476 Visual Studio 12 2013 Win64
477 Specify target platform x64.
478
479 Visual Studio 12 2013 ARM
480 Specify target platform ARM.
481
482 Toolset Selection
483 The v120 toolset that comes with Visual Studio 12 2013 is selected by
484 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
485 the cmake(1) -T option, to specify another toolset.
486
487 New in version 3.8: For each toolset that comes with this version of
488 Visual Studio, there are variants that are themselves compiled for
489 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture
490 they target). By default this generator uses the 32-bit variant even
491 on a 64-bit host. One may explicitly request use of either the 32-bit
492 or 64-bit host tools by adding either host=x86 or host=x64 to the
493 toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for
494 details.
495
496
497 New in version 3.14: Added suport for host=x86 option.
498
499
500 Visual Studio 14 2015
501 New in version 3.1.
502
503
504 Generates Visual Studio 14 (VS 2015) project files.
505
506 Project Types
507 Only Visual C++ and C# projects may be generated. Other types of
508 projects (JavaScript, Powershell, Python, etc.) are not supported.
509
510 Platform Selection
511 The default target platform name (architecture) is Win32.
512
513 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
514 cmake(1) -A option, to specify a target platform name (architecture).
515 For example:
516
517 • cmake -G "Visual Studio 14 2015" -A Win32
518
519 • cmake -G "Visual Studio 14 2015" -A x64
520
521 • cmake -G "Visual Studio 14 2015" -A ARM
522
523 For compatibility with CMake versions prior to 3.1, one may specify a
524 target platform name optionally at the end of the generator name. This
525 is supported only for:
526
527 Visual Studio 14 2015 Win64
528 Specify target platform x64.
529
530 Visual Studio 14 2015 ARM
531 Specify target platform ARM.
532
533 Toolset Selection
534 The v140 toolset that comes with Visual Studio 14 2015 is selected by
535 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
536 the cmake(1) -T option, to specify another toolset.
537
538 New in version 3.8: For each toolset that comes with this version of
539 Visual Studio, there are variants that are themselves compiled for
540 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture
541 they target). By default this generator uses the 32-bit variant even
542 on a 64-bit host. One may explicitly request use of either the 32-bit
543 or 64-bit host tools by adding either host=x86 or host=x64 to the
544 toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for
545 details.
546
547
548 New in version 3.14: Added suport for host=x86 option.
549
550
551 Windows 10 SDK Maximum Version for VS 2015
552 New in version 3.19.
553
554
555 Microsoft stated in a "Windows 10 October 2018 Update" blog post that
556 Windows 10 SDK versions (15063, 16299, 17134, 17763) are not supported
557 by VS 2015 and are only supported by VS 2017 and later. Therefore by
558 default CMake automatically ignores Windows 10 SDKs beyond
559 10.0.14393.0.
560
561 However, there are other recommendations for certain driver/Win32
562 builds that indicate otherwise. A user can override this behavior by
563 either setting the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM to
564 a false value or setting the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VER‐
565 SION_MAXIMUM to the string value of the required maximum (e.g.
566 10.0.15063.0).
567
568 Visual Studio 15 2017
569 New in version 3.7.1.
570
571
572 Generates Visual Studio 15 (VS 2017) project files.
573
574 Project Types
575 Only Visual C++ and C# projects may be generated. Other types of
576 projects (JavaScript, Powershell, Python, etc.) are not supported.
577
578 Instance Selection
579 New in version 3.9: VS 2017 supports multiple installations on the same
580 machine. The CMAKE_GENERATOR_INSTANCE variable may be set as a cache
581 entry containing the absolute path to a Visual Studio instance. If the
582 value is not specified explicitly by the user or a toolchain file,
583 CMake queries the Visual Studio Installer to locate VS instances,
584 chooses one, and sets the variable as a cache entry to hold the value
585 persistently.
586
587
588 New in version 3.11: When CMake first chooses an instance, if the
589 VS150COMNTOOLS environment variable is set and points to the Com‐
590 mon7/Tools directory within one of the instances, that instance will be
591 used. Otherwise, if more than one instance is installed we do not de‐
592 fine which one is chosen by default.
593
594
595 Platform Selection
596 The default target platform name (architecture) is Win32.
597
598 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
599 cmake(1) -A option, to specify a target platform name (architecture).
600 For example:
601
602 • cmake -G "Visual Studio 15 2017" -A Win32
603
604 • cmake -G "Visual Studio 15 2017" -A x64
605
606 • cmake -G "Visual Studio 15 2017" -A ARM
607
608 • cmake -G "Visual Studio 15 2017" -A ARM64
609
610 For compatibility with CMake versions prior to 3.1, one may specify a
611 target platform name optionally at the end of the generator name. This
612 is supported only for:
613
614 Visual Studio 15 2017 Win64
615 Specify target platform x64.
616
617 Visual Studio 15 2017 ARM
618 Specify target platform ARM.
619
620 Toolset Selection
621 The v141 toolset that comes with Visual Studio 15 2017 is selected by
622 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
623 the cmake(1) -T option, to specify another toolset.
624
625 New in version 3.8: For each toolset that comes with this version of
626 Visual Studio, there are variants that are themselves compiled for
627 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture
628 they target). By default this generator uses the 32-bit variant even
629 on a 64-bit host. One may explicitly request use of either the 32-bit
630 or 64-bit host tools by adding either host=x86 or host=x64 to the
631 toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for
632 details.
633
634
635 New in version 3.14: Added suport for host=x86 option.
636
637
638 Visual Studio 16 2019
639 New in version 3.14.
640
641
642 Generates Visual Studio 16 (VS 2019) project files.
643
644 Project Types
645 Only Visual C++ and C# projects may be generated. Other types of
646 projects (JavaScript, Powershell, Python, etc.) are not supported.
647
648 Instance Selection
649 VS 2019 supports multiple installations on the same machine. The
650 CMAKE_GENERATOR_INSTANCE variable may be set as a cache entry contain‐
651 ing the absolute path to a Visual Studio instance. If the value is not
652 specified explicitly by the user or a toolchain file, CMake queries the
653 Visual Studio Installer to locate VS instances, chooses one, and sets
654 the variable as a cache entry to hold the value persistently.
655
656 When CMake first chooses an instance, if the VS160COMNTOOLS environment
657 variable is set and points to the Common7/Tools directory within one of
658 the instances, that instance will be used. Otherwise, if more than one
659 instance is installed we do not define which one is chosen by default.
660
661 Platform Selection
662 The default target platform name (architecture) is that of the host and
663 is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.
664
665 The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the
666 cmake(1) -A option, to specify a target platform name (architecture).
667 For example:
668
669 • cmake -G "Visual Studio 16 2019" -A Win32
670
671 • cmake -G "Visual Studio 16 2019" -A x64
672
673 • cmake -G "Visual Studio 16 2019" -A ARM
674
675 • cmake -G "Visual Studio 16 2019" -A ARM64
676
677 Toolset Selection
678 The v142 toolset that comes with Visual Studio 16 2019 is selected by
679 default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via
680 the cmake(1) -T option, to specify another toolset.
681
682 New in version 3.8: For each toolset that comes with this version of
683 Visual Studio, there are variants that are themselves compiled for
684 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture
685 they target). By default this generator uses the 64-bit variant on x64
686 hosts and the 32-bit variant otherwise. One may explicitly request use
687 of either the 32-bit or 64-bit host tools by adding either host=x86 or
688 host=x64 to the toolset specification. See the CMAKE_GENERATOR_TOOLSET
689 variable for details.
690
691
692 New in version 3.14: Added suport for host=x86 option.
693
694
695 Other Generators
696 Green Hills MULTI
697 New in version 3.3.
698
699
700 New in version 3.15: Linux support.
701
702
703 Generates Green Hills MULTI project files (experimental,
704 work-in-progress).
705
706 Customizations are available through the following cache variables:
707
708 • GHS_CUSTOMIZATION
709
710 • GHS_GPJ_MACROS
711
712 New in version 3.14: The buildsystem has predetermined build-configura‐
713 tion settings that can be controlled via the CMAKE_BUILD_TYPE variable.
714
715
716 Toolset and Platform Selection
717 New in version 3.13.
718
719
720 Customizations that are used to pick toolset and target system:
721
722 • The -A <arch> can be supplied for setting the target architecture.
723 <arch> usually is one of arm, ppc, 86, etcetera. If the target ar‐
724 chitecture is not specified then the default architecture of arm will
725 be used.
726
727 • The -T <toolset> option can be used to set the directory location of
728 the toolset. Both absolute and relative paths are valid. Relative
729 paths use GHS_TOOLSET_ROOT as the root. If the toolset is not speci‐
730 fied then the latest toolset found in GHS_TOOLSET_ROOT will be used.
731
732 Cache variables that are used for toolset and target system customiza‐
733 tion:
734
735 • GHS_TARGET_PLATFORM
736 Defaults to integrity.
737 Usual values are integrity, threadx, uvelosity, velosity,
738 vxworks, standalone.
739
740
741 • GHS_PRIMARY_TARGET
742 Sets primaryTarget entry in project file.
743 Defaults to <arch>_<GHS_TARGET_PLATFORM>.tgt.
744
745
746 • GHS_TOOLSET_ROOT
747 Root path for toolset searches.
748 Defaults to C:/ghs in Windows or /usr/ghs in Linux.
749
750
751 • GHS_OS_ROOT
752 Root path for RTOS searches.
753 Defaults to C:/ghs in Windows or /usr/ghs in Linux.
754
755
756 • GHS_OS_DIR and GHS_OS_DIR_OPTION
757 Sets -os_dir entry in project file.
758 Defaults to latest platform OS installation at GHS_OS_ROOT. Set this value if
759 a specific RTOS is to be used.
760 GHS_OS_DIR_OPTION default value is -os_dir.
761
762
763 New in version 3.15: The GHS_OS_DIR_OPTION variable.
764
765
766 • GHS_BSP_NAME
767 Sets -bsp entry in project file.
768 Defaults to sim<arch> for integrity platforms.
769
770
771 Target Properties
772 New in version 3.14.
773
774
775 The following properties are available:
776
777 • GHS_INTEGRITY_APP
778
779 • GHS_NO_SOURCE_GROUP_FILE
780
781 NOTE:
782 This generator is deemed experimental as of CMake 3.20.3 and is
783 still a work in progress. Future versions of CMake may make break‐
784 ing changes as the generator matures.
785
786 Xcode
787 Generate Xcode project files.
788
789 Changed in version 3.15: This generator supports Xcode 5.0 and above.
790
791
792 Toolset and Build System Selection
793 By default Xcode is allowed to select its own default toolchain. The
794 CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T
795 option, to specify another toolset.
796
797 New in version 3.19: This generator supports toolset specification us‐
798 ing one of these forms:
799
800
801 • toolset
802
803 • toolset[,key=value]*
804
805 • key=value[,key=value]*
806
807 The toolset specifies the toolset name. The selected toolset name is
808 provided in the CMAKE_XCODE_PLATFORM_TOOLSET variable.
809
810 The key=value pairs form a comma-separated list of options to specify
811 generator-specific details of the toolset selection. Supported pairs
812 are:
813
814 buildsystem=<variant>
815 Specify the buildsystem variant to use. See the
816 CMAKE_XCODE_BUILD_SYSTEM variable for allowed values.
817
818 For example, to select the original build system under Xcode 12,
819 run cmake(1) with the option -T buildsystem=1.
820
821 Swift Support
822 New in version 3.4.
823
824
825 When using the Xcode generator with Xcode 6.1 or higher, one may enable
826 the Swift language with the enable_language() command or the project().
827
829 Some of the CMake Generators listed in the cmake(1) command-line tool
830 --help output may have variants that specify an extra generator for an
831 auxiliary IDE tool. Such generator names have the form <extra-genera‐
832 tor> - <main-generator>. The following extra generators are known to
833 CMake.
834
835 CodeBlocks
836 Generates CodeBlocks project files.
837
838 Project files for CodeBlocks will be created in the top directory and
839 in every subdirectory which features a CMakeLists.txt file containing a
840 project() call. Additionally a hierarchy of makefiles is generated
841 into the build tree. The appropriate make program can build the
842 project through the default all target. An install target is also pro‐
843 vided.
844
845 New in version 3.10: The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES vari‐
846 able may be set to ON to exclude any files which are located outside of
847 the project root directory.
848
849
850 This "extra" generator may be specified as:
851
852 CodeBlocks - MinGW Makefiles
853 Generate with MinGW Makefiles.
854
855 CodeBlocks - NMake Makefiles
856 Generate with NMake Makefiles.
857
858 CodeBlocks - NMake Makefiles JOM
859 New in version 3.8: Generate with NMake Makefiles JOM.
860
861
862 CodeBlocks - Ninja
863 Generate with Ninja.
864
865 CodeBlocks - Unix Makefiles
866 Generate with Unix Makefiles.
867
868 CodeLite
869 Generates CodeLite project files.
870
871 Project files for CodeLite will be created in the top directory and in
872 every subdirectory which features a CMakeLists.txt file containing a
873 project() call. The appropriate make program can build the project
874 through the default all target. An install target is also provided.
875
876 New in version 3.7: The CMAKE_CODELITE_USE_TARGETS variable may be set
877 to ON to change the default behavior from projects to targets as the
878 basis for project files.
879
880
881 This "extra" generator may be specified as:
882
883 CodeLite - MinGW Makefiles
884 Generate with MinGW Makefiles.
885
886 CodeLite - NMake Makefiles
887 Generate with NMake Makefiles.
888
889 CodeLite - Ninja
890 Generate with Ninja.
891
892 CodeLite - Unix Makefiles
893 Generate with Unix Makefiles.
894
895 Eclipse CDT4
896 Generates Eclipse CDT 4.0 project files.
897
898 Project files for Eclipse will be created in the top directory. In out
899 of source builds, a linked resource to the top level source directory
900 will be created. Additionally a hierarchy of makefiles is generated
901 into the build tree. The appropriate make program can build the
902 project through the default all target. An install target is also pro‐
903 vided.
904
905 This "extra" generator may be specified as:
906
907 Eclipse CDT4 - MinGW Makefiles
908 Generate with MinGW Makefiles.
909
910 Eclipse CDT4 - NMake Makefiles
911 Generate with NMake Makefiles.
912
913 Eclipse CDT4 - Ninja
914 Generate with Ninja.
915
916 Eclipse CDT4 - Unix Makefiles
917 Generate with Unix Makefiles.
918
919 Kate
920 Generates Kate project files.
921
922 A project file for Kate will be created in the top directory in the top
923 level build directory. To use it in Kate, the Project plugin must be
924 enabled. The project file is loaded in Kate by opening the Project‐
925 Name.kateproject file in the editor. If the Kate Build-plugin is en‐
926 abled, all targets generated by CMake are available for building.
927
928 This "extra" generator may be specified as:
929
930 Kate - MinGW Makefiles
931 Generate with MinGW Makefiles.
932
933 Kate - NMake Makefiles
934 Generate with NMake Makefiles.
935
936 Kate - Ninja
937 Generate with Ninja.
938
939 Kate - Unix Makefiles
940 Generate with Unix Makefiles.
941
942 Sublime Text 2
943 Generates Sublime Text 2 project files.
944
945 Project files for Sublime Text 2 will be created in the top directory
946 and in every subdirectory which features a CMakeLists.txt file contain‐
947 ing a project() call. Additionally Makefiles (or build.ninja files)
948 are generated into the build tree. The appropriate make program can
949 build the project through the default all target. An install target is
950 also provided.
951
952 This "extra" generator may be specified as:
953
954 Sublime Text 2 - MinGW Makefiles
955 Generate with MinGW Makefiles.
956
957 Sublime Text 2 - NMake Makefiles
958 Generate with NMake Makefiles.
959
960 Sublime Text 2 - Ninja
961 Generate with Ninja.
962
963 Sublime Text 2 - Unix Makefiles
964 Generate with Unix Makefiles.
965
967 2000-2021 Kitware, Inc. and Contributors
968
969
970
971
9723.20.3 May 30, 2021 CMAKE-GENERATORS(7)