|
|
You are now on the CMake community wiki.
|
|
|
Many pages are now **DEPRECATED** and sometimes even considered bad
|
|
|
practice. Those are only kept as reference for previous CMake versions.
|
|
|
The documentation for the latest version is available here:
|
|
|
[CMake Documentation](https://cmake.org/documentation/).
|
|
|
|
|
|
-----
|
|
|
|
|
|
<https://cmake.org/cmake/img/CMake-logo-download.jpg>
|
|
|
|
|
|
Welcome to CMake, the cross-platform, open-source make system. CMake is
|
|
|
used to control the software compilation process using simple platform
|
|
|
and compiler independent configuration files. CMake generates native
|
|
|
makefiles and workspaces that can be used in the compiler environment of
|
|
|
your choice. CMake is quite sophisticated: it is possible to support
|
|
|
complex environments requiring system configuration, pre-processor
|
|
|
generation, code generation, and template instantiation.
|
|
|
|
|
|
You will find here not only documentation for CMake, but also for CPack
|
|
|
and CTest.
|
|
|
|
|
|
# CMake
|
|
|
|
|
|
## Primary Resources - Look here first\!
|
|
|
|
|
|
- Where can I [download CMake](https://cmake.org/HTML/Download.html)?
|
|
|
- [CMake Documentation](https://cmake.org/documentation/)
|
|
|
- [CMake
|
|
|
Variables](https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html)
|
|
|
- [Structure of a CMake Build
|
|
|
System](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html)
|
|
|
- [FAQ (Frequently asked questions)](CMake_FAQ "wikilink")
|
|
|
- [CMake Mailing List](https://cmake.org/mailman/listinfo/cmake) (for
|
|
|
searchable archives see [CMake
|
|
|
FAQ](CMake_FAQ#Where_can_I_find_searchable_CMake_Mailing_Archives "wikilink"))
|
|
|
- [Release
|
|
|
Notes](https://cmake.org/cmake/help/latest/release/index.html%7CCMake)
|
|
|
|
|
|
## Reference Material
|
|
|
|
|
|
- [CMake
|
|
|
Variables](https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html)
|
|
|
- [List of CMake
|
|
|
Properties](https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html?highlight=properties)
|
|
|
|
|
|
#### The CMake Language
|
|
|
|
|
|
- [A quick introduction to CMake
|
|
|
syntax](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#syntax)
|
|
|
- [On variables, lists, strings, maps, regexps,
|
|
|
etc.](CMake%3AVariablesListsStrings "wikilink")
|
|
|
- [Language syntax](CMake/Language_Syntax "wikilink")
|
|
|
|
|
|
## Guides
|
|
|
|
|
|
#### General
|
|
|
|
|
|
- [Cross compiling](CMake_Cross_Compiling "wikilink")
|
|
|
- [How to write platform checks with
|
|
|
CMake](CMake%3AHow_To_Write_Platform_Checks "wikilink")
|
|
|
- [How to find libraries](CMake%3AHow_To_Find_Libraries "wikilink")
|
|
|
- [How to install things](CMake%3AInstall_Commands "wikilink")
|
|
|
|
|
|
#### Specific
|
|
|
|
|
|
- [RPATH handling](CMake_RPATH_handling "wikilink")
|
|
|
- [Editors/IDEs with CMake syntax
|
|
|
support](CMake_Editors_Support "wikilink")
|
|
|
- [How to export symbols from a Windows DLL for the non-Windows
|
|
|
Developer](BuildingWinDLL "wikilink")
|
|
|
- [Appending the SO version to
|
|
|
DLLs](RecipeAddSoVersionToDLLs "wikilink")
|
|
|
- [Advanced Usage of CMake Build Rules](CMake_Build_Rules "wikilink")
|
|
|
- [How to Check the Current
|
|
|
Platform](CMake_Checking_Platform "wikilink")
|
|
|
|
|
|
## Development Topics
|
|
|
|
|
|
- [Assembler Support](CMake/Assembler "wikilink")
|
|
|
- [Docs for Specific Project
|
|
|
Generators](CMake_Generator_Specific_Information "wikilink")
|
|
|
(Eclipse, KDevelop3, CodeBlocks, Makefile)
|
|
|
- [Contributed macros](CMake_User_Contributed_Macros "wikilink")
|
|
|
- [Module Maintainers](CMake%3AModule_Maintainers "wikilink")
|
|
|
- [Platform Dependent
|
|
|
Information](CMake_Platform_Dependent_Issues "wikilink")
|
|
|
- [Documentation for previous
|
|
|
releases](CMake_Released_Versions "wikilink")
|
|
|
- [CMake Life Cycle
|
|
|
Considerations](CMake_Life_Cycle_Considerations "wikilink")
|
|
|
- [Matrix for checking backwards-compatibility of current
|
|
|
features](CMake_Version_Compatibility_Matrix "wikilink")
|
|
|
- [CMake builtin documentation
|
|
|
handling](CMake_builtin_documentation_handling "wikilink")
|
|
|
- [The architecture of Open Source Applications -
|
|
|
CMake](http://www.aosabook.org/en/cmake.html)
|
|
|
|
|
|
## Tutorials
|
|
|
|
|
|
### Basic Introductions
|
|
|
|
|
|
- [A Simple CMake Example](https://cmake.org/HTML/Examples.html)
|
|
|
- [Cross-Platform Software Development Using
|
|
|
CMake](http://www.linuxjournal.com/article/6700)
|
|
|
- [CMake: The Cross Platform Build
|
|
|
System](http://clubjuggler.livejournal.com/138364.html)
|
|
|
- ["Learning CMake"](http://www.elpauer.org/stuff/learning_cmake.pdf)
|
|
|
- Slides of a CMake workshop, including CPack, CTest and CDash
|
|
|
- [CMake tutorial](https://github.com/TheErk/CMake-tutorial) - Slides
|
|
|
(with LaTeX bearmer source) of a CMake tutorial including CPack,
|
|
|
CTest.
|
|
|
- ["CMake: Behind the Scenes of Code
|
|
|
Development"](http://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf)
|
|
|
- Slides of an introductory talk/tutorial about CMake and its
|
|
|
benefits
|
|
|
- [The Hacker Within: Build
|
|
|
Systems](http://hackerwithin.org/thw/plugin_wiki/page/buildsystems)
|
|
|
Explains why and how to use build systems with a CMake example.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- How CMake simplifies the build process by Bruno Abinader
|
|
|
- [Part 1 - Basic build
|
|
|
system](https://brunoabinader.com/how-cmake-simplifies-the-build-process-part-1-basic-build-system)
|
|
|
- [Part 2 - Advanced build
|
|
|
system](http://web.archive.org/web/20101030232202/http://cabledogs.org/abinader/2009/12/09/how-cmake-simplifies-the-build-process-part-2-advanced-build-system/)
|
|
|
- [Empirical approach to
|
|
|
CMAKE](http://rachid.koucha.free.fr/tech_corner/cmake_manual.html)
|
|
|
by Rachid Koucha
|
|
|
- [Minimal examples](CMake/MinimalExamples "wikilink") (wiki page)
|
|
|
|
|
|
### Finding stuff and platform checking
|
|
|
|
|
|
- [How to package your project for use by
|
|
|
others](CMake/Tutorials#CMake_Packages "wikilink"), create
|
|
|
FooConfig.cmake files, and exporting and importing targets.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to find and use existing frameworks on OS
|
|
|
X](CMake%3AHowToUseExistingOSXFrameworks "wikilink")
|
|
|
A quick example to help OS X users find frameworks automatically.
|
|
|
|
|
|
### How to use CMake with specific Libraries
|
|
|
|
|
|
- [How to build Qt4 software with
|
|
|
CMake](CMake%3AHow_To_Build_Qt4_Software "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Qt with CMake](http://qtnode.net/wiki?title=Qt_with_cmake)
|
|
|
Explains how to use CMake to build software with Qt4, Qt3 and KDE3.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Deploying Qt4 applications with
|
|
|
CMake](http://mikemcquaid.com/2012/01/deploying-qt-applications-with-deployqt4/)
|
|
|
Explains how to use the DeployQt4.cmake module coming with CMake
|
|
|
2.8.7.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to build KDE4 software with
|
|
|
CMake](CMake%3AHow_To_Build_KDE4_Software "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to use CMake to create Matlab MEX
|
|
|
files](CMake/MatlabMex "wikilink")
|
|
|
Describes how to use CMake when developing Matlab Executable (MEX)
|
|
|
files for use with The Mathworks Matlab scripting language.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to use CMake for building software with
|
|
|
wxWidgets](http://www.wxwidgets.org/wiki/index.php/CMake)
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Building eCos applications with
|
|
|
CMake](http://www.linuxdevices.com/articles/AT6762290643.html)
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Building Sms applications with CMake](http://www.smslana.eu)
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Cross compiling from Windows to ARM
|
|
|
Linux](http://blog.quickforge.co.uk/2011/10/exploration-of-cross-compiling-on-windows-for-arm-linux-distributions/)
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Using CMake to build an FLTK application](CMakeForFLTK "wikilink")
|
|
|
|
|
|
### Recipes
|
|
|
|
|
|
- [How to process lots of input files with a processor built by
|
|
|
CMake](CMake%3AHow_To_Process_Lots_Of_Input_Files "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Configuration Specific Settings for Visual Studio Generated Project
|
|
|
Files](VSConfigSpecificSettings "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to use the 'BundleUtilities' to deploy your OS X Application.
|
|
|
Example uses Qt 4.](BundleUtilitiesExample "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to write a simple CMakeLists.txt for Fortran
|
|
|
code](CMakeForFortranExample "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [How to emulate GNU Autotools 'make
|
|
|
check'](CMakeEmulateMakeCheck "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [A toy model for add_custom_command and
|
|
|
add_custom_target](CustomCommandCustomTargetInstall "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Working with OS X Interface Builder
|
|
|
Files](CMake%3AOSX_InterfaceBuilderFiles "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Append the Version Number to the Install
|
|
|
path](RecipeAppendVersionNumberToInstallpath "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Install to a local folder in the build dir for
|
|
|
testing](RecipeInstallToALocalFolderForTesting "wikilink")
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Adding an uninstall target to your
|
|
|
project](RecipeAddUninstallTarget "wikilink")
|
|
|
|
|
|
## Converters from other buildsystems to CMake
|
|
|
|
|
|
All converters listed here are not "complete", i.e. the generated CMake
|
|
|
files are not 100% finished, in all cases some work is left for the
|
|
|
developer.
|
|
|
|
|
|
#### automake/autotools/autoconf
|
|
|
|
|
|
- [am2cmake (requires
|
|
|
Ruby)](https://projects.kde.org/projects/kde/kdesdk/kde-dev-scripts/repository/revisions/master/changes/cmake-utils/scripts/am2cmake)
|
|
|
Converts automake/autotools/libtool based projects to CMake,
|
|
|
specialized in converting from KDE 3 to KDE 4, should also work for
|
|
|
others. This one has been used for converting the KDE buildsystem to
|
|
|
CMake.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Alternative Automake2CMake (requires
|
|
|
PHP)](http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz)
|
|
|
Converts KDevelop projects that use automake to CMake.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Converting autoconf tests](GccXmlAutoConfHints "wikilink")
|
|
|
|
|
|
#### qmake
|
|
|
|
|
|
- [qmake converter (requires Ruby)](CMake%3AConvertFromQmake "wikilink")
|
|
|
Converts projects that use Qt's qmake.
|
|
|
|
|
|
#### Visual Studio
|
|
|
|
|
|
- [vcproj2cmake.rb (requires Ruby) SourceForge
|
|
|
project](http://vcproj2cmake.sf.net) Creates **and maintains**
|
|
|
CMakeLists.txt files by extracting info from Visual Studio project
|
|
|
files (.vcproj/.vcxproj). Elaborate script for development
|
|
|
side-by-side the updated original static .vc\[x\]proj files,
|
|
|
supports script hooks and powerful definition mappings. Patches and
|
|
|
new project members very welcome. Older script versions below:
|
|
|
- [Original vcproj2cmake.rb version (requires
|
|
|
Ruby)](http://www.eskilson.se/vcproj2cmake.rb)
|
|
|
- Slightly newer version here
|
|
|
[vcproj2cmake.rb](http://dgwarp.hd.free.fr/vcproj2cmake.rb),
|
|
|
see:[User_talk:Dweeves](User_talk%3ADweeves "wikilink") for
|
|
|
details
|
|
|
- [vcproj2cmake.ps1(PowerShell
|
|
|
version)](http://nberserk.blogspot.com/2010/11/converting-vc-projectsvcproj-to.html)
|
|
|
Creates CMakeLists.txt. it supports vcproj configuration and detect
|
|
|
'exclude from build' option
|
|
|
- [folders4cmake (requires
|
|
|
Java)](http://sourceforge.net/projects/folders4cmake/) Use Visual
|
|
|
Studio project files to generate corresponding "source_group"
|
|
|
information that you can use inside your own CMake scripts. Supports
|
|
|
Visual Studio 9/10 project files (full round-trip possible).
|
|
|
|
|
|
#### Basic CMakeLists.txt from-scratch-generator
|
|
|
|
|
|
- [gencmake (requires
|
|
|
Ruby)](http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/)
|
|
|
Creates basic CMakeLists.txt files from looking at the existing
|
|
|
files.
|
|
|
- [CMakeListGenerator
|
|
|
(Win32)](http://www.vanvelzensoftware.com/postnuke/index.php?name=Downloads&req=viewdownload&cid=7)
|
|
|
Creates complete CMakeLists.txt files as described in the
|
|
|
[README](https://gucef.svn.sourceforge.net/svnroot/gucef/trunk/tools/CMakeListGenerator/docs/README.txt)
|
|
|
using a combination of file and directory structure analysis.
|
|
|
Supports resolving dependencies between multiple archives.
|
|
|
|
|
|
## Success Stories
|
|
|
|
|
|
- What are some [projects using CMake](CMake/Projects "wikilink")?
|
|
|
- [Articles about CMake](CMake%3AArticles "wikilink")
|
|
|
- [Really Cool CMake Features](Really_Cool_CMake_Features "wikilink")
|
|
|
|
|
|
## More Topics
|
|
|
|
|
|
- [Fortran Issues](CMake_Fortran_Issues "wikilink")
|
|
|
- [Generating dependency graphs with
|
|
|
CMake](CMake%3AFor_CMake_Hackers "wikilink")
|
|
|
- [Experiments With Lua](CMake%3AExperiments_With_Lua "wikilink")
|
|
|
- [Performance Tips](CMake_Performance_Tips "wikilink")
|
|
|
- [GNU style directory layout with
|
|
|
CMake](CMake%3AGNU_style_example "wikilink")
|
|
|
- [CMake TODO](CMake%3AOpenTasks "wikilink")
|
|
|
- [Creating Qt Assistant Docs](CMake%3ACreateQtAssistantDocs "wikilink")
|
|
|
- [Writing FindXXX.cmake modules that work with static
|
|
|
libraries](CMake%3AStatic_libraries "wikilink")
|
|
|
- [Writing FindXXX.cmake modules that work when multiple versions of
|
|
|
packages are
|
|
|
installed](CMake%3AMultiple_versions "wikilink")
|
|
|
- [CMake:Improving_Find\*_Modules](CMake%3AImproving_Find*_Modules "wikilink")
|
|
|
- [CMake/C_Plugins_for_Loadable_Commands](CMake/C_Plugins_for_Loadable_Commands "wikilink")
|
|
|
For anyone who wonders what the `load_command` command is for.
|
|
|
- [PC-Lint](PC-Lint "wikilink") support for CMake
|
|
|
|
|
|
# CTest
|
|
|
|
|
|
### Tutorials
|
|
|
|
|
|
- [Testing With CTest](CMake/Testing_With_CTest "wikilink")
|
|
|
Introduces to testing with CTest, submitting dashboards, and using
|
|
|
CMake to add tests to the test system.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [CTest Scripting](CMake_Scripting_Of_CTest "wikilink")
|
|
|
Describes the scripting with CTest which can significantly simplify
|
|
|
and automate testing and submitting dashboards.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Generating Input Files For
|
|
|
CTest](CMake_Generating_Testing_Files "wikilink")
|
|
|
Describe more in details the concepts behind testing with CTest and
|
|
|
also explans how to use CTest without using CMake.
|
|
|
|
|
|
<!-- end list -->
|
|
|
|
|
|
- [Buildmanagement With CTest](CTest%3ABuildserver "wikilink")
|
|
|
Describes how to setup a central configuration for all CTest
|
|
|
scripts.
|
|
|
|
|
|
### More Information
|
|
|
|
|
|
- [Configuring CTest Submission
|
|
|
Methods](CTest%3ASubmission_Issues "wikilink")
|
|
|
- [CTest Nightly, Experimental, Continuous,
|
|
|
...](CTest%3ANightly,_Experimental,_Continuous "wikilink")
|
|
|
- [CTest/Coverage](CTest/Coverage "wikilink")
|
|
|
- [CTest\_Running\_Modes.pdf](/uploads/b60e91d1b1723f590e6541392fbaf472/CTest_Running_Modes.pdf)
|
|
|
- [CTest Frequently asked questions](CTest%3AFAQ "wikilink")
|
|
|
|
|
|
### More Topics
|
|
|
|
|
|
- [CTest TODO](CTest%3AOpenTasks "wikilink")
|
|
|
- [Run tests on machines without building
|
|
|
first](CTest%3ATestWithoutBuild "wikilink")
|
|
|
|
|
|
# CDash
|
|
|
|
|
|
- [CDash Wiki](http://public.kitware.com/Wiki/CDash).
|
|
|
- [CDash FAQ](http://public.kitware.com/Wiki/CDash:FAQ).
|
|
|
|
|
|
# CPack
|
|
|
|
|
|
### Tutorials
|
|
|
|
|
|
- [Packaging with CPack](CMake%3APackaging_With_CPack "wikilink")
|
|
|
Introduction to CPack, installing and packaging of software.
|
|
|
- [CMake tutorial](https://github.com/TheErk/CMake-tutorial) - Slides
|
|
|
from a CMake tutorial (including LaTeX beamer source) including
|
|
|
CPack.
|
|
|
- [CPack Variables](CMake%3ACPackConfiguration "wikilink")
|
|
|
- [Supported package formats](CMake%3ACPackPackageGenerators "wikilink")
|
|
|
- [CPack Win32 Newbie
|
|
|
Checklist](CMake%3ACPackWin32NewbiesChecklist "wikilink")
|
|
|
- [Component Install With
|
|
|
CPack](CMake%3AComponent_Install_With_CPack "wikilink")
|
|
|
|
|
|
### Recipes
|
|
|
|
|
|
- [Add an application shortcut to the Start
|
|
|
Menu](RecipeAddShortcutToStartMenu "wikilink")
|
|
|
|
|
|
# Old(deprecated) kept for reference only
|
|
|
|
|
|
- [CMake 2.6 Notes](CMake_2.6_Notes "wikilink")
|
|
|
- [Useful CMake Variables](CMake_Useful_Variables "wikilink")
|
|
|
|
|
|
----
|
|
|
This page was initially populated by conversion from its [original location](https://public.kitware.com/Wiki/CMake) in another wiki. |