extra-cmake-modules - Reference of available CMake custom modules.
The "cmake" executable is the CMake command-line interface. It may be used to configure projects in scripts. Project configuration settings may be specified on the command line with the -D option. The -i option will cause cmake to interactively prompt for such settings.
CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists.txt. Users build a project by using CMake to generate a build system for a native tool on their platform.
The following modules are also available for CMake. They can be used with INCLUDE(ModuleName).
Custom CMake Modules - Additional Modules for CMake.
This is the documentation for additional modules and scripts for CMake. Using these modules you can check the computer system for installed software packages, features of the compiler and the existance of headers to name just a few.
ECMOptionalAddSubdirectory
: ECM_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()ECM_OPTIONAL_ADD_SUBDIRECTORY(<dir>) If you use ECM_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(), this will have two effects 1 - CMake will not complain if the directory doesn't exist
This makes sense if you want to distribute just one of the subdirs
in a source package, e.g. just one of the subdirs in kdeextragear.
2 - If the directory exists, it will offer an option to skip the
subdirectory.
This is useful if you want to compile only a subset of all
directories.
If the CMake variable DISABLE_ALL_OPTIONAL_SUBDIRECTORIES is set to TRUE for the first CMake run on the project, all optional subdirectories will be disabled by default (but can of course be enabled via the respective options). E.g. the following will disable all optional subdirectories except the one named "kcalc":
$ cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_kcalc=TRUE <srcdir>
ECMQtFramework
: - Automatic configuration of a project as a Qt framework.
This module can be used to simplify creation of quality frameworks written in Qt. It sets compiler flags, Qt definitions and CMake options which make sense to use when creating A Qt based framework.
project(myspeciallib)
ecm_framework_version(5 0 0)
include(ECMQtFramework)
This will set myspeciallib to be a Qt framework, that is, the name of the project is relevant and used (see below). The version of the project is 5.0.0. It is important to include ECMQtFramework before finding Qt itself.
Specifically being an ECM Qt framework means:
1) The compiler is configured with export flags. With GCC and clang, this means enabling the -hidden-visibility flags. See the GenerateExportHeader module for more on generating and installing export headers.
2) A Coverage build type is created and made available in the cmake-gui. This means that running
cmake $SRCDIR -DCMAKE_BUILD_TYPE=Coverage
Will enable the use of the -fprofile-arcs -ftest-coverage flags on GCC. The Coverage type is also available through the cmake-gui program.
3) Sensible compiler warnings are enabled. These are the flags determined to be useful through a history in KDE buildsystem.
4) Qt build flags are defined. These include
* Disabling automatic ascii casts provided by Qt (so for example QLatin1String must be used). This is relevant to prevent encoding errors, and makes conversion to QString potentially faster or avoidable.
* Disabling Qt keywords such as signals and slots so that Q_SIGNALS and Q_SLOTS must be used instead. This is relevant if using the framework together with boost signals.
* Enabling the use of fast concatenation. This makes it possible to create strings from multiple pieces with one memory allocation.
5) CMake will use imported targets for Qt. This is relevant on windows because it is easier to build both debug and release versions of the framework.
6) CMake will include the current source and binary directories automatically while preprocessing. The source and binary directories of the current project will be used before others.
7) CMake will use built in automatic moc support.
8) A LIB_SUFFIX variable is made available. This is used to install libraries optionally to for example /lib64 instead of /lib
9) The ECM_TARGET_DEFAULT_ARGS variable is made available for use by targets in the framework. This is used in install(TARGETS) calls to install components of targets to the configured binary and library directories, to create an export target for the framework, and to put them in a component for use with CPack. The name of the component is the same as the argument to the project call (myspeciallib above).
10) The use of RPATH is enabled. (TODO RUNPATH?)
11) A CMake config file and config version are created and installed. The config file uses the project name so that:
* The file is called myspeciallibConfig.cmake. A companion file myspeciallibVersionConfig is also created.
* The variables myspeciallib_VERSION_MAJOR, myspeciallib_VERSION_MINOR, myspeciallib_VERSION_PATCH are defined as specified by the use of ecm_framework_version.
* Standard variables are set for linking to the library and including the directories of its headers.
12) The targets file is installed. This means that myspeciallib can be used as an imported target.
13) A USE file is installed. This means that consumers of myspeciallib can
include(${myspeciallib_USE_FILE})
which will include the Qt USE file, and add the header directories for myspeciallib to include_directories()
14) A version file is created called myspeciallib_version.h, which contains version information usable by the preprocessor. The version file must be installed by the user.
15) The FeatureSummary module is included.
FindBlueZ
: Try to find BlueZ bluetooth library.Once done this will define
BLUEZ_FOUND - system has BlueZ
BLUEZ_INCLUDE_DIR - the BlueZ include directory
BLUEZ_LIBRARIES - Link these to use BlueZ
BLUEZ_DEFINITIONS - Compiler switches required for using BlueZ
Redistribution and use is allowed according to the terms of the BSD license. For details see the accompanying COPYING-CMAKE-SCRIPTS file.
.B ccmake(1), cpack(1), ctest(1), cmakecommands(1), cmakecompat(1), cmakemodules(1), cmakeprops(1), cmakevars(1)
The following resources are available to get help using CMake:
Home Page
: http://www.cmake.orgThe primary starting point for learning about CMake.
Frequently Asked Questions
: http://www.cmake.org/Wiki/CMake_FAQA Wiki is provided containing answers to frequently asked questions.
Online Documentation
: http://www.cmake.org/HTML/Documentation.htmlLinks to available documentation may be found on this web page.
Mailing List
: http://www.cmake.org/HTML/MailingLists.htmlFor help and discussion about using cmake, a mailing list is provided at cmake@cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at http://www.cmake.org before posting questions to the list.
Summary of helpful links:
Home: http://www.cmake.org
Docs: http://www.cmake.org/HTML/Documentation.html
Mail: http://www.cmake.org/HTML/MailingLists.html
FAQ: http://www.cmake.org/Wiki/CMake_FAQ