CMake: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
(23 intermediate revisions by 13 users not shown)
Line 1: Line 1:
http://www.cmake.org/cmake/img/CMake-logo-download.jpg
{{CMake/Template/Header}}
 
https://cmake.org/cmake/img/CMake-logo-download.jpg


<!-- documentation manual man information help tutorial -->
<!-- documentation manual man information help tutorial -->
Line 9: Line 11:


==Primary Resources - Look here first! ==
==Primary Resources - Look here first! ==
* Where can I [http://www.cmake.org/HTML/Download.html download CMake]?
* Where can I [https://cmake.org/HTML/Download.html download CMake]?
* [http://www.cmake.org/HTML/Documentation.html CMake Documentation]
* [https://cmake.org/documentation/ CMake Documentation]
* [[CMake Useful Variables|Useful CMake Variables]]
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]
* [https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html Structure of a CMake Build System]
* [[CMake FAQ| FAQ (Frequently asked questions)]]
* [[CMake FAQ| FAQ (Frequently asked questions)]]
* [http://www.cmake.org/mailman/listinfo/cmake CMake Mailing List] (for searchable archives see [[CMake_FAQ#Where_can_I_find_searchable_CMake_Mailing_Archives | CMake FAQ ]])
* [https://cmake.org/mailman/listinfo/cmake CMake Mailing List] (for searchable archives see [[CMake_FAQ#Where_can_I_find_searchable_CMake_Mailing_Archives | CMake FAQ ]])
* [[CMake_2.6_Notes|CMake 2.6 Notes]]
* [[https://cmake.org/cmake/help/latest/release/index.html|CMake Release Notes]]
* ''Getting Started With CMake'' Screencasts @[http://playcontrol.net/ewing/screencasts/getting_started_with_cmake_.html PlayControl.net]
 
==Reference Material==
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]
* [https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html?highlight=properties List of CMake Properties]
====The CMake Language====
* [https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#syntax A quick introduction to CMake syntax]
* [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]
* [[CMake/Language Syntax | Language syntax]]


==Development Topics==
==Guides==
====General====
* [[CMake Cross Compiling| Cross compiling]]
* [[CMake Cross Compiling| Cross compiling]]
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]
* [[CMake:How_To_Find_Libraries | How to find libraries]]
* [[CMake:Install Commands| How to install things]]
====Specific====
* [[CMake RPATH handling|RPATH handling]]
* [[CMake RPATH handling|RPATH handling]]
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]
* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]
* [[RecipeAddSoVersionToDLLs|Appending the SO version to DLLs]]
* [[CMake_Build_Rules | Advanced Usage of CMake Build Rules]]
* [[CMake_Checking_Platform | How to Check the Current Platform]]
==Development Topics==
* [[CMake/Assembler|Assembler Support]]
* [[CMake/Assembler|Assembler Support]]
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)
* [[CMake User Contributed Macros| Contributed macros]]
* [[CMake User Contributed Macros| Contributed macros]]
* [[CMake:Module Maintainers|Module Maintainers]]
* [[CMake:Module Maintainers|Module Maintainers]]
* [[CMake Platform Dependent Issues|Platform Dependent Information]]
* [[CMake Platform Dependent Issues|Platform Dependent Information]]
* [[CMake/ChangeLog|Current CMake Version ChangeLog]]
* [[CMake Released Versions|Documentation for previous releases]]
* [[CMake Released Versions|Documentation for previous releases]]
* [[CMake Life Cycle Considerations]]
* [[CMake Version Compatibility Matrix|Matrix for checking backwards-compatibility of current features]]
* [[CMake Version Compatibility Matrix|Matrix for checking backwards-compatibility of current features]]
* [[CMake builtin documentation handling]]
* [http://www.aosabook.org/en/cmake.html The architecture of Open Source Applications - CMake]


==Tutorials==
==Tutorials==


===Basic Introductions===
===Basic Introductions===
* [http://www.cmake.org/HTML/Examples.html A Simple CMake Example]
* [https://cmake.org/HTML/Examples.html A Simple CMake Example]
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop, including CPack, CTest and CDash
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop, including CPack, CTest and CDash
* [https://github.com/TheErk/CMake-tutorial "CMake tutorial"] - Slides (with LaTeX bearmer source) of a CMake tutorial including CPack, CTest.
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides (with LaTeX bearmer source) of a CMake tutorial including CPack, CTest.
* [http://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf "CMake: Behind the Scenes of Code Development"] - Slides of an introductory talk/tutorial about CMake and its benefits
* [http://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf "CMake: Behind the Scenes of Code Development"] - Slides of an introductory talk/tutorial about CMake and its benefits
* [http://snikt.net/index.php/2010/04/01/howto-use-cmake-with-cc-projects Howto use cmake with C/C++ projects] A simple walk-through about creating a cmake C project including integration of subversion, doxygen and how-to add optional project parts as configurables
* [http://hackerwithin.org/thw/plugin_wiki/page/buildsystems The Hacker Within: Build Systems] Explains why and how to use build systems with a CMake example.
* [http://hackerwithin.org/thw/plugin_wiki/page/buildsystems The Hacker Within: Build Systems] Explains why and how to use build systems with a CMake example.
* Syntax of the CMake language
 
** [http://www.cmake.org/HTML/syntax.html A quick introduction to CMake syntax]
** [[CMake/Language Syntax | Language syntax]] (wiki page)
** [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]
* How CMake simplifies the build process by Bruno Abinader
* How CMake simplifies the build process by Bruno Abinader
** [http://www.abinader.com.br/bruno/how-cmake-simplifies-the-build-process-part-1-basic-build-system/ Part 1 - Basic build system]
** [https://brunoabinader.com/how-cmake-simplifies-the-build-process-part-1-basic-build-system Part 1 - Basic 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/ 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/ Part 2 - Advanced build system]
* [http://rachid.koucha.free.fr/tech_corner/cmake_manual.html Empirical approach to CMAKE] by Rachid Koucha
* [http://rachid.koucha.free.fr/tech_corner/cmake_manual.html Empirical approach to CMAKE] by Rachid Koucha
* [[CMake/MinimalExamples | Minimal examples]] (wiki page)


===Finding stuff and platform checking===
===Finding stuff and platform checking===
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]<br>Describes how to implement platform or configure checks with CMake.


* [[CMake/Tutorials#CMake_Packages|How to package your project for use by others]], create FooConfig.cmake files, and exporting and importing targets.
* [[CMake/Tutorials#CMake_Packages|How to package your project for use by others]], create FooConfig.cmake files, and exporting and importing targets.
* [[CMake:How_To_Find_Libraries | How to find libraries]] <br>Describes how to use external libraries in a CMake project and how to write your own find modules for libraries that don't already have one.


* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.
* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.
Line 85: Line 104:
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]


* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]


* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]
* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]
Line 105: Line 123:
* [[RecipeAddUninstallTarget|Adding an uninstall target to your project]]
* [[RecipeAddUninstallTarget|Adding an uninstall target to your project]]


* [[RecipeAddSoVersionToDLLs|Appending the SO version to DLLs]]


==Converters from other buildsystems to CMake==
==Converters from other buildsystems to CMake==
Line 112: Line 129:


====automake/autotools/autoconf====
====automake/autotools/autoconf====
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ am2cmake (requires Ruby) ] 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.
* [https://projects.kde.org/projects/kde/kdesdk/kde-dev-scripts/repository/revisions/master/changes/cmake-utils/scripts/am2cmake am2cmake (requires Ruby) ] 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.


* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.
* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.
Line 122: Line 139:


====Visual Studio====
====Visual Studio====
* [http://vcproj2cmake.sf.net vcproj2cmake.rb (requires Ruby) SourceForge project] Creates '''and maintains''' CMakeLists.txt files by extracting info from Visual Studio project files. Elaborate script for development side-by-side the updated original static .vcproj files, supports script hooks and powerful definition mappings. Patches and new project members very welcome. Older script versions below:
* [http://vcproj2cmake.sf.net vcproj2cmake.rb (requires Ruby) SourceForge project] 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:
** [http://www.eskilson.se/vcproj2cmake.rb Original vcproj2cmake.rb version (requires Ruby)]  
** [http://www.eskilson.se/vcproj2cmake.rb Original vcproj2cmake.rb version (requires Ruby)]  
** Slightly newer version here [http://dgwarp.hd.free.fr/vcproj2cmake.rb vcproj2cmake.rb], see:[[User_talk:Dweeves]] for details
** Slightly newer version here [http://dgwarp.hd.free.fr/vcproj2cmake.rb vcproj2cmake.rb], see:[[User_talk:Dweeves]] for details
Line 145: Line 162:
* [[CMake:Experiments With Lua|Experiments With Lua]]
* [[CMake:Experiments With Lua|Experiments With Lua]]
* [[CMake Performance Tips|Performance Tips]]
* [[CMake Performance Tips|Performance Tips]]
* [[CMake:Install Commands| Replacing deprecated INSTALL_FILES, INSTALL_PROGRAMS and INSTALL_TARGETS commands]]
* [[CMake:GNU style example | GNU style directory layout with CMake]]
* [[CMake:GNU style example | GNU style directory layout with CMake]]
* [[CMake:OpenTasks| CMake TODO]]
* [[CMake:OpenTasks| CMake TODO]]
Line 185: Line 201:
===Tutorials===
===Tutorials===
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.
* [[https://github.com/TheErk/CMake-tutorial | "CMake tutorial]] - Slides from a CMake tutorial (including LaTeX beamer source) including CPack.
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides from a CMake tutorial (including LaTeX beamer source) including CPack.
* [[CMake:CPackConfiguration|CPack Variables]]<br>
* [[CMake:CPackConfiguration|CPack Variables]]<br>
* [[CMake:CPackPackageGenerators|Supported package formats]]<br>
* [[CMake:CPackPackageGenerators|Supported package formats]]<br>
Line 195: Line 211:
* [[RecipeAddShortcutToStartMenu|Add an application shortcut to the Start Menu]]
* [[RecipeAddShortcutToStartMenu|Add an application shortcut to the Start Menu]]


=Old(deprecated) kept for reference only=
* [[CMake_2.6_Notes|CMake 2.6 Notes]]
* [[CMake Useful Variables|Useful CMake Variables]]


{{CMake/Template/Footer}}
{{CMake/Template/Footer}}

Revision as of 10:01, 13 January 2018

You are now on the CMake wiki.
Many pages are now DEPRECATED and sometimes even considered bad practice. Those are only kept as reference for previous CMake versions.
The documentations for the latest versions are available here : CMake Documentation.


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!

Reference Material

The CMake Language

Guides

General

Specific

Development Topics

Tutorials

Basic Introductions

Finding stuff and platform checking

How to use CMake with specific Libraries

  • Qt with CMake
    Explains how to use CMake to build software with Qt4, Qt3 and KDE3.

Recipes



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) 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.

qmake

Visual Studio

Basic CMakeLists.txt from-scratch-generator

  • gencmake (requires Ruby) Creates basic CMakeLists.txt files from looking at the existing files.
  • CMakeListGenerator (Win32) Creates complete CMakeLists.txt files as described in the README using a combination of file and directory structure analysis. Supports resolving dependencies between multiple archives.

Success Stories


More Topics

CTest

Tutorials

  • Testing With CTest
    Introduces to testing with CTest, submitting dashboards, and using CMake to add tests to the test system.
  • CTest Scripting
    Describes the scripting with CTest which can significantly simplify and automate testing and submitting dashboards.

More Information

More Topics

CDash


CPack

Tutorials

Recipes


Old(deprecated) kept for reference only



CMake: [Welcome | Site Map]