(notice about the need for an 128'er icon for KDE4_ADD_APP_ICON to work on Mac OS X) |
m (→Implementation Notes: link to the file in question) |
||
| (10 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
A page to document the variables, macros and other useful stuff we have to use CMake as the KDE4 buildsystem. | A page to document the variables, macros and other useful stuff we have to use CMake as the KDE4 buildsystem. | ||
| + | |||
| + | You may also want to visit the automatically generated documentation for [http://api.kde.org/cmake/modules.html#module_FindKDE4Internal FindKDE4Internal.cmake], which is generated directly from the current FindKDE4Internal.cmake and may be more up-to-date. | ||
| + | |||
| + | == Buildtypes== | ||
| + | CMake supports different build types for compiling the source code. | ||
| + | The following built-in build types are available to the CMake buildsystem: | ||
| + | |||
| + | ;Release: optimized for speed, no debug symbols or qDebug/kDebug messages, no asserts | ||
| + | ;RelWithDebInfo: similiar to ''release'', but with debug symbols for backtraces (-g). This is the default if none other is chosen. | ||
| + | ;Debug: optimized for speed, but debuggable (you can still single-step through functions and set most breakpoints) and with debug symbols for backtraces (-g) | ||
| + | ;DebugFull: no optimizations, full debug support and information (-g3). Note that some compiler warnings rely on the optimizer being available. | ||
| + | ;Profile: adds coverage flags (-ftest-coverage -fprofile-arcs) to DebugFull. | ||
| + | ;None: the build flags are manually set using the CMAKE_CXX_FLAGS option. | ||
| + | |||
| + | You can tell CMake the desired build type by passing the relevant type as command line option, for instance: | ||
| + | cmake /path/to/source -DCMAKE_BUILD_TYPE=Debug | ||
| + | |||
| + | === Debugging Features in Detail === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border: gray solid 1px; border-collapse: collapse; text-align: left; width: 100%;" | ||
| + | |- style="background: #ececec; white-space:nowrap;" | ||
| + | ! CMAKE_BUILD_TYPE !! Optimized !! Symbols !! qDebug || kDebug !! Asserts | ||
| + | |- | ||
| + | | Release||yes||no||no||no||no | ||
| + | |- | ||
| + | | RelWithDebInfo||yes||yes||no||no||no | ||
| + | |- | ||
| + | | Debug||yes||yes||yes||yes||yes | ||
| + | |- | ||
| + | | DebugFull||no||yes||yes||yes||yes | ||
| + | |- | ||
| + | | Profile||no||yes||yes||yes||yes | ||
| + | |} | ||
| + | |||
| + | === Implementation Notes === | ||
| + | Please refer to the source for further details and the actual flags used.<br /> | ||
| + | [http://quickgit.kde.org/?p=kdelibs.git&a=blob&f=cmake/modules/FindKDE4Internal.cmake kdelibs.git/cmake/modules/FindKDE4Internal.cmake] | ||
== Variables == | == Variables == | ||
| Line 57: | Line 93: | ||
* '''WALLPAPER_INSTALL_DIR''' - the install dir for wallpapers | * '''WALLPAPER_INSTALL_DIR''' - the install dir for wallpapers | ||
* '''KCONF_UPDATE_INSTALL_DIR''' - the kconf_update install dir | * '''KCONF_UPDATE_INSTALL_DIR''' - the kconf_update install dir | ||
| − | * '''XDG_APPS_INSTALL_DIR''' - the | + | * '''XDG_APPS_INSTALL_DIR''' - the application install directory from [http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html the definition] by X Development Group which is the former name for [http://FreeDeskTop.org FreeDeskTop.org]. |
* '''XDG_DIRECTORY_INSTALL_DIR''' - the XDG directory | * '''XDG_DIRECTORY_INSTALL_DIR''' - the XDG directory | ||
* '''XDG_MIME_INSTALL_DIR''' - the XDG mimetypes install dir | * '''XDG_MIME_INSTALL_DIR''' - the XDG mimetypes install dir | ||
| Line 147: | Line 183: | ||
Notifies the icon cache that new icons have been installed by updating mtime of ${ICON_INSTALL_DIR}/hicolor directory. | Notifies the icon cache that new icons have been installed by updating mtime of ${ICON_INSTALL_DIR}/hicolor directory. | ||
| − | * '''KDE4_INSTALL_ICONS(path theme)''' | + | * '''[http://quickgit.kde.org/?p=kdelibs.git&a=blob&f=cmake/modules/KDE4Macros.cmake KDE4_INSTALL_ICONS(path theme)]''' |
| − | Installs all png and svgz files in the current directory to the icon directory given in path, in the subdirectory for the given icon theme. | + | Installs all png and svgz files in the current directory that comply to the [[Development/Tutorials/Icons#The_icon_naming_scheme|icon naming scheme]] to the icon directory given in path, in the subdirectory for the given icon theme. |
* '''KDE4_ADD_APP_ICON(appsources pattern)''' | * '''KDE4_ADD_APP_ICON(appsources pattern)''' | ||
| Line 172: | Line 208: | ||
* '''KDE4_REMOVE_OBSOLETE_CMAKE_FILES''' | * '''KDE4_REMOVE_OBSOLETE_CMAKE_FILES''' | ||
* '''KDE4_NO_ENABLE_FINAL''' | * '''KDE4_NO_ENABLE_FINAL''' | ||
| − | |||
| − | |||
| − | |||
| − | |||
A page to document the variables, macros and other useful stuff we have to use CMake as the KDE4 buildsystem.
You may also want to visit the automatically generated documentation for FindKDE4Internal.cmake, which is generated directly from the current FindKDE4Internal.cmake and may be more up-to-date.
Contents |
CMake supports different build types for compiling the source code. The following built-in build types are available to the CMake buildsystem:
You can tell CMake the desired build type by passing the relevant type as command line option, for instance:
cmake /path/to/source -DCMAKE_BUILD_TYPE=Debug
| CMAKE_BUILD_TYPE | Optimized | Symbols | qDebug | kDebug | Asserts |
|---|---|---|---|---|---|
| Release | yes | no | no | no | no |
| RelWithDebInfo | yes | yes | no | no | no |
| Debug | yes | yes | yes | yes | yes |
| DebugFull | no | yes | yes | yes | yes |
| Profile | no | yes | yes | yes | yes |
Please refer to the source for further details and the actual flags used.
kdelibs.git/cmake/modules/FindKDE4Internal.cmake
They are all interpreted relative to CMAKE_INSTALL_PREFIX
Lots of useful macros: (Question: Is there a URL to download these macros?)
Use this to add Qt designer ui files to your application/library.
Use this to add Qt designer ui files from Qt version 3 to your application/library.
Use this to add KDE config compiler files to your application/library.
Use optional GENERATE_MOC to generate moc if you use signals in your kcfg files.
Use this to add widget description files for the makekdewidgets code generator for Qt Designer plugins.
Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
It supports KDE4_ENABLE_FINAL.
If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
It creates and installs an appropriate libtool la-file.
Create a KDE application in the form of a module loadable via kdeinit.
A library named kdeinit_<name> will be created and a small executable which links to it.
It supports KDE4_ENABLE_FINAL
If the executable has to be run from the buildtree (e.g. unit tests and code generators used later on when compiling), set the option RUN_UNINSTALLED.
If the executable doesn't have a GUI, use the option NOGUI. By default on OS X application bundles are created, with the NOGUI option no bundles but simple executables are created. Currently it doesn't have any effect on other platforms.
Equivalent to ADD_EXECUTABLE(), but additionally adds some more features:
** support for KDE4_ENABLE_FINAL ** support for automoc ** automatic RPATH handling
If the executable has to be run from the buildtree (e.g. unit tests and code generators used later on when compiling), set the option RUN_UNINSTALLED.
If the executable doesn't have a GUI, use the option NOGUI. By default on OS X application bundles are created, with the NOGUI option no bundles but simple executables are created. Currently it doesn't have any effect on other platforms.
Equivalent to ADD_LIBRARY(), but additionally it supports KDE4_ENABLE_FINAL and under Windows it adds a -DMAKE_<name>_LIB definition to the compilation.
Add a unit test, which is executed when running make test
It will be built with RPATH pointing to the build dir
The targets are always created, but only built for the "all" target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target are created but not built by default. You can build them by manually building the target.
The name of the target can be specified using TESTNAME <targetname>, if it is not given the macro will default to the <testname>
Add a test executable
It will be built with RPATH pointing to the build dir
The targets are always created, but only built for the "all" target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target are created but not built by default. You can build them by manually building the target.
KDESRCDIR is set to the source directory of the test, this can be used with KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); to be able to use xmlgui and other things in the test, that normally require installation
Notifies the icon cache that new icons have been installed by updating mtime of ${ICON_INSTALL_DIR}/hicolor directory.
Installs all png and svgz files in the current directory that comply to the icon naming scheme to the icon directory given in path, in the subdirectory for the given icon theme.
Mac OS X and Windows only: Adds application icon to target source list. This macro adds an application icon to the specified target. Mac OS X notes: the application icon is added to a Mac OS X bundle so that Finder and friends show the right thing. You need to provide a 128x128 version of the icon for this to work. Windows notes: the application icon(s) are compiled into the application binary.
Parameters:
Examples: KDE4_ADD_APP_ICON(myapp_sources "pics/cr*-myapp.png") or KDE4_ADD_APP_ICON(myapp_sources "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/myapp.png")
Create the handbook from the docbookfile (using meinproc)