CMake Generator Specific Information: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
Line 39: Line 39:
The following targets are available:
The following targets are available:


* all
; all :
* preinstall
 
* install
; preinstall :
* install/fast
 
; install :
 
; install/fast :
 
; rebuild_cache : just runs the cmake configure and generate steps, but don't actually start building
; rebuild_cache : just runs the cmake configure and generate steps, but don't actually start building
; edit_cache : run the user interface for working with cmake/modifying the cache contents. This is either cmake-gui or ccmake.
; edit_cache : run the user interface for working with cmake/modifying the cache contents. This is either cmake-gui or ccmake.
* <target>
 
* <target>/fast
; <target> :
* file.o
 
* file.i
; <target>/fast :
* file.s
 
; file.o :
 
; file.i :
 
; file.s :
 
The following variants of the generator are available:


; "Unix Makefiles" : This generator generates Makefiles for make under Unix and also for '''cygwin''' (i.e. with Unix paths)
; "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 [http://www.mingw.org MinGW project], the makefiles work also with other "native" GNU make versions for Windows. You can get this e.g. from http://unxutils.sourceforge.net, the  download location is http://sourceforge.net/project/showfiles.php?group_id=9328&package_id=9393 . From that zip file only /usr/wbin/make.exe is needed. The GNU make from www.steve.org.uk 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.
; "MinGW Makefiles" : Windows only, generates Makefiles for GNU make from the [http://www.mingw.org MinGW project], the makefiles work also with other "native" GNU make versions for Windows. You can get this e.g. from http://unxutils.sourceforge.net, the  download location is http://sourceforge.net/project/showfiles.php?group_id=9328&package_id=9393 . From that zip file only /usr/wbin/make.exe is needed. The GNU make from www.steve.org.uk 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 [http://www.mingw.org/msys.shtml MSYS]. It uses Unix-like paths and sh.exe from MSYS as shell.
; "MSYS Makefiles" : Windows only, generates Makefiles to be used under [http://www.mingw.org/msys.shtml 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": 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. jom.zip should point to the newest release. [ftp://ftp.qt.nokia.com/jom/ Get jom through ftp] - 0.9.4 has been confirmed to work. Make sure the containing folder is in the PATH.
; "NMake Makefiles JOM" : Like "NMake Makefiles", but generates Makefiles for jom instead of nmake. jom is like nmake, but supports the -j flag. jom.zip should point to the newest release. [ftp://ftp.qt.nokia.com/jom/ 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.
; "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.
; "Watcom WMake": Windows only, generates Makefiles for Borland make. The makefiles use DOS/Windows paths and care for Watcom wmake specific issues.



Revision as of 12:42, 23 April 2018

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.

Internals

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
rebuild_cache
just runs the cmake configure and generate steps, but don't actually start building
edit_cache
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

The following variants of the generator are available:

"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 http://unxutils.sourceforge.net, the download location is http://sourceforge.net/project/showfiles.php?group_id=9328&package_id=9393 . From that zip file only /usr/wbin/make.exe is needed. The GNU make from www.steve.org.uk 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. jom.zip 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.

Goal

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.

Rationale

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.

Instructions

Download VC Express *and* Platform SDK from http://www.microsoft.com. 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

 :missing
 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:

nmake

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]