CMake:How To Build KDE4 Software

From KitwarePublic
Revision as of 21:04, 30 March 2006 by Alex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Let's just start with a simple example for an application, let's name it, well, kFoo:

  1. give the project a name, so that the project files
  2. for KDevelop/XCode/MSVC will have a good name

project(kfoo)

  1. find the KDE 4 installation

find_package(KDE4 REQUIRED)

  1. setup the required include dirs

include_directories( ${KDE4_INCLUDES} )

  1. the source files of your project

set(mySources main.cpp mywidget.cpp mypart.cpp)

  1. automoc handling

kde4_automoc( ${mySources} )

  1. create an executable named kfoo from the sources

kde4_add_executable(kfoo ${mySources})

  1. link kfoo to the kdeui and the kparts libraries

target_link_libraries(kfoo ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} )

  1. install kfoo, its desktop file and its icons

install_targets( /bin kfoo) install_files( ${XDG_APPS_DIR} FILES kfoo.desktop) kde4_install_icons( ${ICON_INSTALL_DIR} hicolor)