CMAKE-GENERATORS(7) | CMake | CMAKE-GENERATORS(7) |
cmake-generators - CMake Generators Reference
A CMake Generator is responsible for writing the input files for a native build system. Exactly one of the CMake Generators must be selected for a build tree to determine what native build system is to be used. Optionally one of the Extra Generators may be selected as a variant of some of the Command-Line Build Tool Generators to produce project files for an auxiliary IDE.
CMake Generators are platform-specific so each may be available only on certain platforms. The cmake(1) command-line tool --help output lists available generators on the current platform. Use its -G option to specify the generator for a new build tree. The cmake-gui(1) offers interactive selection of a generator when creating a new build tree.
These generators support command-line build tools. In order to use them, one must launch CMake from a command-line prompt whose environment is already configured for the chosen compiler and build tool.
Generates Borland makefiles.
Generates makefiles for use with MSYS make under the MSYS shell.
Use this generator in a MSYS shell prompt and using make as the build tool. The generated makefiles use /bin/sh as the shell to launch build rules. They are not compatible with a Windows command prompt.
To build under a Windows command prompt, use the MinGW Makefiles generator.
Generates makefiles for use with mingw32-make under a Windows command prompt.
Use this generator under a Windows command prompt with MinGW in the PATH and using mingw32-make as the build tool. The generated makefiles use cmd.exe as the shell to launch build rules. They are not compatible with MSYS or a unix shell.
To build under the MSYS shell, use the MSYS Makefiles generator.
Generates NMake makefiles.
Generates JOM makefiles.
Generates standard UNIX makefiles.
A hierarchy of UNIX makefiles is generated into the build tree. Any standard UNIX-style make program can build the project through the default make target. A “make install” target is also provided.
Generates Watcom WMake makefiles.
Generates build.ninja files.
A build.ninja file is generated into the build tree. Recent versions of the ninja program can build the project through the “all” target. An “install” target is also provided.
For each subdirectory sub/dir of the project, additional targets are generated:
The Ninja generator conditionally supports Fortran when the ninja tool has the required features. As of this version of CMake the needed features have not been integrated into upstream Ninja. Kitware maintains a branch of Ninja with the required features on github.com/Kitware/ninja.
These generators support Integrated Development Environment (IDE) project files. Since the IDEs configure their own environment one may launch CMake from any environment.
Removed. This once generated Visual Studio 6 project files, but the generator has been removed since CMake 3.6. It is still possible to build with VS 6 tools using the NMake Makefiles generator.
Removed. This once generated Visual Studio .NET 2002 project files, but the generator has been removed since CMake 3.6. It is still possible to build with VS 7.0 tools using the NMake Makefiles generator.
Removed. This once generated Visual Studio .NET 2003 project files, but the generator has been removed since CMake 3.9. It is still possible to build with VS 7.1 tools using the NMake Makefiles generator.
Removed. This once generated Visual Studio 8 2005 project files, but the generator has been removed since CMake 3.12. It is still possible to build with VS 2005 tools using the NMake Makefiles generator.
Generates Visual Studio 9 2008 project files.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
Generates Visual Studio 10 (VS 2010) project files.
For compatibility with CMake versions prior to 3.0, one may specify this generator using the name Visual Studio 10 without the year component.
Only Visual C++ and C# projects may be generated. Other types of projects (Database, Website, etc.) are not supported.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
The v100 toolset that comes with Visual Studio 10 2010 is selected by default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
Generates Visual Studio 11 (VS 2012) project files.
For compatibility with CMake versions prior to 3.0, one may specify this generator using the name “Visual Studio 11” without the year component.
Only Visual C++ and C# projects may be generated. Other types of projects (JavaScript, Database, Website, etc.) are not supported.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
The v110 toolset that comes with Visual Studio 11 2012 is selected by default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
Generates Visual Studio 12 (VS 2013) project files.
For compatibility with CMake versions prior to 3.0, one may specify this generator using the name “Visual Studio 12” without the year component.
Only Visual C++ and C# projects may be generated. Other types of projects (JavaScript, Powershell, Python, etc.) are not supported.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
The v120 toolset that comes with Visual Studio 12 2013 is selected by default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
For each toolset that comes with this version of Visual Studio, there are variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture they target). By default Visual Studio chooses the 32-bit variant even on a 64-bit host. One may request use of the 64-bit host tools by adding a host=x64 option to the toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for details.
Generates Visual Studio 14 (VS 2015) project files.
Only Visual C++ and C# projects may be generated. Other types of projects (JavaScript, Powershell, Python, etc.) are not supported.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
The v140 toolset that comes with Visual Studio 14 2015 is selected by default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
For each toolset that comes with this version of Visual Studio, there are variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture they target). By default Visual Studio chooses the 32-bit variant even on a 64-bit host. One may request use of the 64-bit host tools by adding a host=x64 option to the toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for details.
Generates Visual Studio 15 (VS 2017) project files.
Only Visual C++ and C# projects may be generated. Other types of projects (JavaScript, Powershell, Python, etc.) are not supported.
VS 2017 supports multiple installations on the same machine. The CMAKE_GENERATOR_INSTANCE variable may be set as a cache entry containing the absolute path to a Visual Studio instance. If the value is not specified explicitly by the user or a toolchain file, CMake queries the Visual Studio Installer to locate VS instances, chooses one, and sets the variable as a cache entry to hold the value persistently.
When CMake first chooses an instance, if the VS150COMNTOOLS environment variable is set and points to the Common7/Tools directory within one of the instances, that instance will be used. Otherwise, if more than one instance is installed we do not define which one is chosen by default.
The CMAKE_GENERATOR_PLATFORM variable may be set, perhaps via the cmake(1) -A option, to specify a target platform name (architecture). For example:
For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. This is supported only for:
The v141 toolset that comes with Visual Studio 15 2017 is selected by default. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
For each toolset that comes with this version of Visual Studio, there are variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts (independent of the architecture they target). By default Visual Studio chooses the 32-bit variant even on a 64-bit host. One may request use of the 64-bit host tools by adding a host=x64 option to the toolset specification. See the CMAKE_GENERATOR_TOOLSET variable for details.
Generates Green Hills MULTI project files (experimental, work-in-progress).
Customizations that are used to pick toolset and target system:
The -A <arch> can be supplied for setting the target architecture. <arch> usually is one of “arm”, “ppc”, “86”, etcetera. If the target architecture is not specified then the default architecture of “arm” will be used.
The -T <toolset> can be supplied for setting the toolset to be used. All toolsets are expected to be located at GHS_TOOLSET_ROOT. If the toolset is not specified then the latest toolset will be used.
Default to integrity. Usual values are integrity, threadx, uvelosity, velosity, vxworks, standalone.
Sets primaryTarget field in project file. Defaults to <arch>_<GHS_TARGET_PLATFORM>.tgt.
Default to C:/ghs. Root path for toolset.
Default to C:/ghs. Root path for RTOS searches.
Default to latest platform OS installation at GHS_OS_ROOT. Set this value if a specific RTOS is to be used.
Defaults to sim<arch> if not set by user.
Customizations are available through the following cache variables:
NOTE:
Generate Xcode project files.
This supports Xcode 3.0 and above.
By default Xcode is allowed to select its own default toolchain. The CMAKE_GENERATOR_TOOLSET option may be set, perhaps via the cmake(1) -T option, to specify another toolset.
Some of the CMake Generators listed in the cmake(1) command-line tool --help output may have variants that specify an extra generator for an auxiliary IDE tool. Such generator names have the form <extra-generator> - <main-generator>. The following extra generators are known to CMake.
Generates CodeBlocks project files.
Project files for CodeBlocks will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a PROJECT() call. Additionally a hierarchy of makefiles is generated into the build tree. The CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable may be set to ON to exclude any files which are located outside of the project root directory. The appropriate make program can build the project through the default make target. A “make install” target is also provided.
This “extra” generator may be specified as:
Generates CodeLite project files.
Project files for CodeLite will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a project() call. The CMAKE_CODELITE_USE_TARGETS variable may be set to ON to change the default behaviour from projects to targets as the basis for project files. The appropriate make program can build the project through the default make target. A “make install” target is also provided.
This “extra” generator may be specified as:
Generates Eclipse CDT 4.0 project files.
Project files for Eclipse will be created in the top directory. In out of source builds, a linked resource to the top level source directory will be created. Additionally a hierarchy of makefiles is generated into the build tree. The appropriate make program can build the project through the default make target. A “make install” target is also provided.
This “extra” generator may be specified as:
Generates Kate project files.
A project file for Kate will be created in the top directory in the top level build directory. To use it in kate, the Project plugin must be enabled. The project file is loaded in kate simply by opening the ProjectName.kateproject file in the editor. If the kate Build-plugin is enabled, all targets generated by CMake are available for building.
This “extra” generator may be specified as:
Generates Sublime Text 2 project files.
Project files for Sublime Text 2 will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a PROJECT() call. Additionally Makefiles (or build.ninja files) are generated into the build tree. The appropriate make program can build the project through the default make target. A “make install” target is also provided.
This “extra” generator may be specified as:
2000-2019 Kitware, Inc. and Contributors
February 10, 2019 | 3.13.4 |