CMake Generator Specific Information

From KitwarePublic
Jump to: navigation, search

See also: CMake Platform Dependent Issues

Eclipse CDT support

Starting with version 2.6.0 CMake supports generating projects for CDT 4.0 or newer. Here you can find information how to use this.

If you are using an older version of CDT or CMake without the Eclipse generator, you can configure Eclipse also manually to work with CMake based projects. This is described here.

Here you find information about plugins which offer syntax highlighting and more for CMake in Eclipse.

KDevelop3 Generator

(cmake . -G KDevelop3)

KDevelop opens CMake project file

The KDevelop project generator is available in CMake since version 2.2.0. It works with KDevelop 3.1.1 and newer. Out-of-source builds are fully supported. As with all other project generators, adding files to the project has to be done by editing the CMakeLists.txt.


Beside creating all the same files as UNIX Makefile generator, it creates in the toplevel binary directory files:

  • Project.kdevelop
  • Project.kdevelop.filelist

The first one is XML describing the project, while the second one is a list of relative paths to the source files. The source files are grouped based on globbing expression in the XML file.

Code::Blocks Generator

(cmake . -G "CodeBlocks - Unix Makefiles")

CodeBlocks opens CMake project file

Starting with version 2.6.0 CMake also comes with a project file generator for the [CodeBlocks IDE]. This support is still in beta and needs feedback in order to mature.

Known issues:

  • "Build file" doesn't work
  • Sometimes cancelling the build doesn't work

Makefile generators

The following targets are available:

  • all
  • preinstall
  • install
  • install/fast
just runs the cmake configure and generate steps, but don't actually start building
run the user interface for working with cmake/modifying the cache contents. This is either cmake-gui or ccmake.
  • <target>
  • <target>/fast
  • file.o
  • file.i
  • file.s
"Unix Makefiles" 
This generator generates Makefiles for make under Unix and also for cygwin (i.e. with Unix paths)
"MinGW Makefiles" 
Windows only, generates Makefiles for GNU make from the MinGW project, the makefiles work also with other "native" GNU make versions for Windows. You can get this e.g. from, the download location is . From that zip file only /usr/wbin/make.exe is needed. The GNU make from is version 3.75, this version has a bug, it does not work. The generated Makefiles use DOS/Windows paths and use cmd.exe as shell. GNU make supports parallel builds and can also be used with cl.exe as compiler. This can be done by setting the environment variables CC and CXX to cl.exe before running CMake.
"MSYS Makefiles" 
Windows only, generates Makefiles to be used under MSYS. It uses Unix-like paths and sh.exe from MSYS as shell.
"NMake Makefiles"
Windows only, generates Makefiles for MS nmake. The makefiles use DOS/Windows paths and care for nmake specific issues. The environment has to be setup correctly, e.g. by running vcvars32.bat. This can be done by running from the "Visual Studio Command prompt".
"NMake Makefiles JOM" 
Like "NMake Makefiles", but generates Makefiles for jom instead of nmake. jom is like nmake, but supports the -j flag. should point to the newest release. Get jom through ftp - 0.9.4 has been confirmed to work. Make sure the containing folder is in the PATH.
"Borland Makefiles"
Windows only, generates Makefiles for Borland make. The makefiles use DOS/Windows paths and care for Borland make specific issues.
"Watcom WMake"
Windows only, generates Makefiles for Borland make. The makefiles use DOS/Windows paths and care for Watcom wmake specific issues.

How to generate NMake Makefiles using Visual C++ Express Edition (free Visual Studio 8)

These instructions are largely obsolete with the release of Visual Studio 2008 Express Edition, which bundles the win32 SDK with the Visual C++ component.


To compile your project on the command line using the one-year free Visual C++ 2005 Express Edition, you can generate NMake Makefiles with CMake, and then use nmake.


To use the free compiler, 'Visual C++ Express Edition' and 'Microsoft Platform Software development Kit (SDK)' have to be downloaded and installed separately. The batch file for the 'Visual Studio 2005 Command Prompt' must be update to include the path, the include directory, and the libraries for Microsoft Platform SDK.


Download VC Express *and* Platform SDK from Install them in C:\Program Files. The license expires one year after your start using it.

Create a batch file called 'VS8_Command_Prompt.bat' in your home directory (for example in C:\cygwin\home\my_username\Bin). Edit this file and type:

 @echo off

 if not exist "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" goto missing
 echo call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
 call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"

 @set PATH=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;%PATH%
 @set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;%INCLUDE%
 @set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
 goto :eof

 echo Missing file
 echo "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
 goto :eof

Create a Windows shortcut called "VS8_Command_Prompt" in your Desktop. Right click and go to Properties. Edit the shortcut tab (replace x86 with amd64, x64, ia64, x86_amd64, or x86_ia64 depending on your processor type):

Target: %comspec% /k ""C:\cygwin\home\Sylvain\Bin\VS8_Command_Prompt.bat"" x86
Start in: C:\cygwin\home\my_username\Bin

Double-click on your VS8_Command_Prompt shortcut. Go to your build directory.

cd my_build_directory

Use CMakeSetup.exe (replace 2.2 with your CMake version number)

\Program Files\CMake 2.2\bin\CMakeSetup.exe <my_source_directory>

Click 'Configure' in the CMake Window

Select 'Build for: NMake Makefiles'

Set the CMake variables, click 'Configure', and then 'Ok'.

Check you have a Makefile in your build directory. In the VS8_Command_Prompt, and type:


Your project should compile now.

Symbian Carbide.c++ Generator

We are working on adding CMake support for generating Symbian Carbide.c++ projects. Here you can find more information about this work.

CMake: [Welcome | Site Map]