Difference between revisions of "Guidelines and HOWTOs/CMake"

Jump to: navigation, search
(Building with CMake in short)
 
(35 intermediate revisions by 10 users not shown)
Line 1: Line 1:
This is the central directory of all [http://www.cmake.org CMake]-related pages on TechBase.
+
Most KDE software uses [http://www.cmake.org CMake] as a buildsystem. This page is the starting point for CMake-related documentation for KDE software.
  
== KDE4 Specific CMake Documentation==
+
You should be aware that there are two main development platforms that KDE software is based on: the older kdelibs4, and its replacement, the [http://api.kde.org/frameworks-api/frameworks5-apidocs/ KDE Frameworks]. Quite a bit of KDE software is in the process of transitioning from kdelibs4 to KDE Frameworks, and the way CMake is used is slightly different between the two.
  
;[[Development/Tutorials/CMake|CMake tutorial]]
 
:''An introduction to using CMake for KDE4''
 
  
;[[Guidelines HOWTOs/CMake_FAQ|KDE's CMake FAQ]]
+
This page contains some tutorials to help you get started on building a CMake-based buildsystem. This is the recommended way of building your software if you use KDE technologies, such as KDE Frameworks.
:''Some Frequently Asked Questions''
 
  
;[[Guidelines HOWTOs/CMake_KDE_4_2 |Changes im the buildsystem with KDE 4.2]]
+
==Beginners==
:''What has changed in KDE 4.2 compared to KDE 4.0/4.1''
 
  
;[[Policies/CMake_and_Source_Compatibility|Source compatiblity with CMake]]
+
* [[/FirstProject|A first CMake project]]: if you've never even looked at CMake code before, start here.
:''This page discusses what has to be taken care of in order to stay source compatible on the CMake level.''
+
* [[/Frameworks|Using a framework]]: introduces you to using a KDE Framework - finding the package and linking your program against it.
  
;[[Policies/CMake_Coding_Style|Coding style for CMake files]]
+
==Intermediate==
:''Some guidelines how to write CMake scripts in KDE.''
 
  
;[[Development/Tools/Automoc4|Automoc4]]
+
* [[/Library|Creating a library]]: demonstrates best practices when creating a library with a CMake-based buildsystem (such as a KDE Framework).
:''Automoc4 documentation.''
 
  
;[http://api.kde.org/cmake/modules.html KDE CMake modules API]
+
== Building with CMake in short ==
:''Documentation for all CMake modules in kdelibs (generated from kdelibs svn)''
 
  
;[[Guidelines HOWTOs/CMake/Addons for KDE|KDE4 CMake macros and variables]]
+
If you just want to build a CMake-based project on a UNIX system, the following recipe will do that:
:''Documentation for the macros and variables for building KDE4 software, provided by FindKDE4Internal.cmake (manually written)''
 
  
==More Places to learn about CMake==
+
<syntaxhighlight lang="bash">
 +
cd /path/to/project/source
 +
mkdir build
 +
cd build
 +
cmake -DCMAKE_INSTALL_PREFIX=/where/to/install/to ..
 +
make
 +
make install
 +
</syntaxhighlight>
  
Here are some good places to learn about CMake in general:
+
Don't forget to replace both paths. If you want an explanation of what this command does and how to make CMake behave differently, or you want to build on Windows or OS/X, see [[/Building | the building with CMake]] chapter.
* [http://www.cmake.org/HTML/Documentation.html CMake Manual]
 
* [http://www.cmake.org/Wiki/CMake CMake Wiki]
 
* [http://www.cmake.org/Wiki/CMake_HowToDoPlatformChecks CMake System Checks ]
 
* [http://www.cmake.org/Wiki/CMake_HowToFindInstalledSoftware Finding Optional Packages ]
 
* [http://www.cmake.org/Wiki/HowToBuildKDE4Software KDE 4 Tutorial at the CMake Wiki ]
 
* [http://www.cmake.org/Wiki/CMake_FAQ CMake FAQ]
 
* [http://www.elpauer.org/stuff/learning_cmake.pdf Slides for the "Learning CMake" seminar]
 
* [http://mail.kde.org/pipermail/kde-buildsystem/ The kde-buildsystem Mailing List Archive]
 
  
Also, consider joining the [http://www.cmake.org/mailman/listinfo/cmake CMake mailing list].
+
==Useful resources==
 +
 
 +
You may want to check out the [http://www.cmake.org/Wiki/CMake CMake wiki], although beware that it contains quite a bit of out-of-date information.
 +
 
 +
===Reference documentation===
 +
* [http://www.cmake.org/HTML/Documentation.html CMake's own documentation]
 +
* [http://api.kde.org/ecm Extra CMake Modules documentation]
 +
 
 +
===Upgrading from KDELibs4===
 +
See https://techbase.kde.org/ECM5/IncompatibleChangesKDELibs4ToECM.
 +
 
 +
===FAQs===
 +
 
 +
* [[/FAQs|KDE's CMake FAQs]]
 +
* [http://www.cmake.org/Wiki/CMake_FAQ CMake FAQ on the CMake wiki]
 +
 
 +
===Mailing lists===
 +
 
 +
;[http://mail.kde.org/pipermail/kde-buildsystem/ The kde-buildsystem mailing list]
 +
:Discussion of CMake in the KDE community, as well as development of Extra CMake Modules.
 +
;[http://www.cmake.org/mailman/listinfo/cmake CMake mailing list]
 +
:For users of CMake.
 +
;[http://www.cmake.org/mailman/listinfo/cmake-developers CMake mailing list]
 +
:For anyone wanting to contribute to CMake.

Latest revision as of 17:18, 10 March 2016

Most KDE software uses CMake as a buildsystem. This page is the starting point for CMake-related documentation for KDE software.

You should be aware that there are two main development platforms that KDE software is based on: the older kdelibs4, and its replacement, the KDE Frameworks. Quite a bit of KDE software is in the process of transitioning from kdelibs4 to KDE Frameworks, and the way CMake is used is slightly different between the two.


This page contains some tutorials to help you get started on building a CMake-based buildsystem. This is the recommended way of building your software if you use KDE technologies, such as KDE Frameworks.

Beginners

  • A first CMake project: if you've never even looked at CMake code before, start here.
  • Using a framework: introduces you to using a KDE Framework - finding the package and linking your program against it.

Intermediate

  • Creating a library: demonstrates best practices when creating a library with a CMake-based buildsystem (such as a KDE Framework).

Building with CMake in short

If you just want to build a CMake-based project on a UNIX system, the following recipe will do that:

cd /path/to/project/source
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/where/to/install/to ..
make
make install

Don't forget to replace both paths. If you want an explanation of what this command does and how to make CMake behave differently, or you want to build on Windows or OS/X, see the building with CMake chapter.

Useful resources

You may want to check out the CMake wiki, although beware that it contains quite a bit of out-of-date information.

Reference documentation

Upgrading from KDELibs4

See https://techbase.kde.org/ECM5/IncompatibleChangesKDELibs4ToECM.

FAQs

Mailing lists

The kde-buildsystem mailing list
Discussion of CMake in the KDE community, as well as development of Extra CMake Modules.
CMake mailing list
For users of CMake.
CMake mailing list
For anyone wanting to contribute to CMake.

This page was last edited on 10 March 2016, at 17:18. Content is available under Creative Commons License SA 4.0 unless otherwise noted.