add more spacing
[personal-kdebase.git] / workspace / CMakeLists.txt
blob2c9bc8f9a4ba24c2104ff8a9637106d1ebf75ac8
1 project(KDEBASE_WORKSPACE)
3 # Used e.g. in KDE4WorkspaceConfig.cmake, Alex
4 set(KDE4WORKSPACE_VERSION_MAJOR 4)
5 set(KDE4WORKSPACE_VERSION_MINOR 2)
6 set(KDE4WORKSPACE_VERSION_PATCH 0)
7 set(KDE4WORKSPACE_VERSION ${KDE4WORKSPACE_VERSION_MAJOR}.${KDE4WORKSPACE_VERSION_MINOR}.${KDE4WORKSPACE_VERSION_PATCH} )
10 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
11 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
13 if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
14   set(BUILDING_WORKSPACE_SEPARATELY true)
15 endif(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
18 #search packages used by KDE
19 find_package(KDE4 REQUIRED)
20 find_package(Strigi REQUIRED)
21 find_package(QImageBlitz REQUIRED)
22 find_package(ZLIB REQUIRED)
24 if(Q_WS_X11)
25   if(NOT X11_XTest_FOUND)
26     macro_log_feature(X11_XTest_FOUND "libXtst" "X11 Testing Resource extension library" "http://xorg.freedesktop.org" FALSE "" "useful for automated testing of X clients.")
27   endif(NOT X11_XTest_FOUND)
28 endif(Q_WS_X11)
30 macro_optional_find_package(GLIB2)
31 macro_log_feature(GLIB2_FOUND "glib2" "Low-level core library for data structure handling, portability wrappers, etc." "http://www.gtk.org" FALSE "2.x" "Needed to build the kxkb keyboard map control program and provide XMMS support in the Now Playing Plasma data engine")
33 macro_optional_find_package(Fontconfig)
35 macro_optional_find_package(Googlegadgets)
36 macro_log_feature(GOOGLEGADGETS_FOUND "GoogleGadgets" "Google Gadgets library" "http://code.google.com/p/google-gadgets-for-linux/" FALSE "" "Needed to build plasma scriptengine for google gadgets")
38 macro_optional_find_package(QEdje)
39 macro_log_feature(QEDJE_FOUND "QEdje" "QEdje library" "http://dev.openbossa.org/trac/qedje/" FALSE "" "Needed to build plasma scriptengine for edje files")
41 macro_optional_find_package(OpenGL)
43 #### Python support ####
44 macro_optional_find_package(PythonLibrary)
46 macro_optional_find_package(SIP)
47 if(SIP_FOUND AND SIP_VERSION STRLESS "040701")
48   message(STATUS "The version of SIP found is too old. 4.7.1 or later is needed.")
49   set(SIP_FOUND)
50 endif(SIP_FOUND AND SIP_VERSION STRLESS "040701")
52 include(SIPMacros)
54 macro_optional_find_package(PyQt4)
55 if(PYQT4_FOUND AND PYQT4_VERSION STRLESS "040400")
56   message(STATUS "The version of PyQt found is too old. 4.4.0 or later is required.")
57   set(PYQT4_FOUND)
58 endif(PYQT4_FOUND AND PYQT4_VERSION STRLESS "040400")
60 macro_optional_find_package(PyKDE4)
61 set(PythonSupport_FOUND FALSE)
62 if(PYTHONLIBRARY_FOUND AND SIP_FOUND AND PYQT4_FOUND AND PYKDE4_FOUND)
63   set(PythonSupport_FOUND TRUE)
64 endif(PYTHONLIBRARY_FOUND AND SIP_FOUND AND PYQT4_FOUND AND PYKDE4_FOUND)
66 macro_log_feature(PythonSupport_FOUND "Python" "KDE Python support" "http://techbase.kde.org/Development/Languages/Python" FALSE "" "Needed to build plasma scriptengine for Python")
67 #### End Python support ####
69 include(MacroLibrary)
70 include(KDE4Defaults)
72 macro_optional_find_package(Nepomuk)
73 macro_log_feature(Nepomuk_FOUND "Nepomuk" "Nepomuk Libraries" "kdelibs" FALSE "" "Required to build Nepomuk features.")
75 include(ConfigureChecks.cmake)
76 if(NOT WIN32)
77   configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h )
78   configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h )
79   if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
80     set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${CMAKE_INSTALL_PREFIX}/share/icons:$XCURSOR_PATH\":~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"; export XCURSOR_PATH")
81   endif(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
82   configure_file(startkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/startkde  @ONLY)
83   configure_file(safestartkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/safestartkde  @ONLY)
84 endif(NOT WIN32)
85 configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h )
87 macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER)
88 macro_log_feature(HAVE_XSCREENSAVER "libxss" "XScreenSaver Library" "http://www.x.org/" FALSE "" "Needed to enable fallback query methods in PowerDevil power manager")
89 macro_log_feature(HAVE_XSYNC "libxext" "XSync Extension" "http://www.x.org/" FALSE "" "Needed to enable high efficency query in PowerDevil power manager. Strongly recommended.")
91 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
92 include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
94 set( backgroundlib_SRCS
95     ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgrender.cpp
96     ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgsettings.cpp
99 set( kcmbackgroundlib_SRCS
100   ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgdialog.cpp
101   ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgadvanced.cpp
102   ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgmonitor.cpp
103   ${CMAKE_CURRENT_SOURCE_DIR}/kcontrol/kdm/background/bgwallpaper.cpp
106 include_directories(
107   ${CMAKE_CURRENT_BINARY_DIR}
108   ${CMAKE_CURRENT_SOURCE_DIR}/kdm
109   ${CMAKE_CURRENT_SOURCE_DIR}/libs
110   ${CMAKE_CURRENT_SOURCE_DIR}/libs/kworkspace
112 # libs
113 add_subdirectory(cmake)
114 add_subdirectory(libs)
116 # system settings (kcontrol replacement)
117 macro_optional_add_subdirectory( systemsettings )
119 # core apps
120 if(NOT WIN32)
121   macro_optional_add_subdirectory( kcheckpass )
122   macro_optional_add_subdirectory( kscreensaver )
123   macro_optional_add_subdirectory( kwin )
124   macro_optional_add_subdirectory( ksmserver )
125   macro_optional_add_subdirectory( kcminit )
126   macro_optional_add_subdirectory( ksplash )
127   macro_optional_add_subdirectory( khotkeys )
128   macro_optional_add_subdirectory( klipper )
129   macro_optional_add_subdirectory( ksysguard )
130   macro_optional_add_subdirectory( powerdevil )
131   macro_optional_add_subdirectory( kwrited )
132 endif(NOT WIN32)
133 macro_optional_add_subdirectory( krunner )
134 macro_optional_add_subdirectory( solid )
135 macro_optional_add_subdirectory( kmenuedit )
136 macro_optional_add_subdirectory( plasma )
137 macro_optional_add_subdirectory( kstartupconfig )
140 # apps we need to figure out what to do with
141 macro_optional_add_subdirectory( kcontrol )
142 if(NOT WIN32)
143   macro_optional_add_subdirectory( ksystraycmd )
144 endif(NOT WIN32)
145 # data
146 if(NOT WIN32)
147   macro_optional_add_subdirectory( cursors )
148 endif(NOT WIN32)
149 macro_optional_add_subdirectory( doc )
150 macro_optional_add_subdirectory( wallpapers )
152 if(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
153   add_subdirectory( kdm )
154 else(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
155   message(STATUS "Xau lib or Xdmcp lib was missing. kdm will not compile")
156 endif(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
159 ########### install files ###############
160 if(NOT WIN32)
161   install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startkde DESTINATION ${BIN_INSTALL_DIR})
162   install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/safestartkde DESTINATION ${BIN_INSTALL_DIR})
163 endif(NOT WIN32)
165 if(BUILDING_WORKSPACE_SEPARATELY)
166   macro_display_feature_log()
167 endif(BUILDING_WORKSPACE_SEPARATELY)
169 # make the libraries installed from kdebase/workspace available to other projects
170 # by creating and installing a KDE4WorkspaceConfig.cmake file, which will
171 # be searched and found by kdelibs/cmake/modules/FindKDE4Workspace.cmake. Alex
173 # now create the KDE4WorkspaceConfig.cmake file, which will be loaded by 
174 # kdelibs/cmake/modules/FindKDE4Workspace.cmake and which has to contain all information
175 # about the libraries installed from kdebase/workspace/libs/ anybody would like to have. Alex
177 # we need the absolute directories where stuff will be installed too
178 # but since the variables which contain the destinations can be relative
179 # or absolute paths, we need this macro to make them all absoulte, Alex
180 macro(MAKE_INSTALL_PATH_ABSOLUTE out in)
181    if (IS_ABSOLUTE "${in}")    # IS_ABSOLUTE is new since cmake 2.4.8
182       set(${out} "${in}")
183    else (IS_ABSOLUTE "${in}")
184       set(${out} "\${KDE4WORKSPACE_INSTALL_DIR}/${in}")
185    endif (IS_ABSOLUTE "${in}")
186 endmacro(MAKE_INSTALL_PATH_ABSOLUTE out in)
188 make_install_path_absolute(KDE4WORKSPACE_LIB_DIR     ${LIB_INSTALL_DIR})
189 make_install_path_absolute(KDE4WORKSPACE_LIBEXEC_DIR ${LIBEXEC_INSTALL_DIR})
190 make_install_path_absolute(KDE4WORKSPACE_INCLUDE_DIR ${INCLUDE_INSTALL_DIR})
191 make_install_path_absolute(KDE4WORKSPACE_BIN_DIR     ${BIN_INSTALL_DIR})
192 make_install_path_absolute(KDE4WORKSPACE_SBIN_DIR    ${SBIN_INSTALL_DIR})
193 make_install_path_absolute(KDE4WORKSPACE_DATA_DIR    ${DATA_INSTALL_DIR})
194 make_install_path_absolute(KDE4WORKSPACE_HTML_DIR    ${HTML_INSTALL_DIR})
195 make_install_path_absolute(KDE4WORKSPACE_CONFIG_DIR  ${CONFIG_INSTALL_DIR})
196 make_install_path_absolute(KDE4WORKSPACE_ICON_DIR    ${ICON_INSTALL_DIR})
197 make_install_path_absolute(KDE4WORKSPACE_KCFG_DIR    ${KCFG_INSTALL_DIR})
198 make_install_path_absolute(KDE4WORKSPACE_LOCALE_DIR  ${LOCALE_INSTALL_DIR})
199 make_install_path_absolute(KDE4WORKSPACE_MIME_DIR    ${MIME_INSTALL_DIR})
200 make_install_path_absolute(KDE4WORKSPACE_SOUND_DIR   ${SOUND_INSTALL_DIR})
201 make_install_path_absolute(KDE4WORKSPACE_TEMPLATES_DIR    ${TEMPLATES_INSTALL_DIR})
202 make_install_path_absolute(KDE4WORKSPACE_WALLPAPER_DIR    ${WALLPAPER_INSTALL_DIR})
203 make_install_path_absolute(KDE4WORKSPACE_KCONF_UPDATE_DIR    ${KCONF_UPDATE_INSTALL_DIR})
204 make_install_path_absolute(KDE4WORKSPACE_AUTOSTART_DIR    ${AUTOSTART_INSTALL_DIR})
205 make_install_path_absolute(KDE4WORKSPACE_XDG_APPS_DIR        ${XDG_APPS_INSTALL_DIR})
206 make_install_path_absolute(KDE4WORKSPACE_XDG_DIRECTORY_DIR   ${XDG_DIRECTORY_INSTALL_DIR})
207 make_install_path_absolute(KDE4WORKSPACE_SYSCONF_DIR ${SYSCONF_INSTALL_DIR})
208 make_install_path_absolute(KDE4WORKSPACE_MAN_DIR     ${MAN_INSTALL_DIR})
209 make_install_path_absolute(KDE4WORKSPACE_INFO_DIR    ${INFO_INSTALL_DIR})
210 make_install_path_absolute(KDE4WORKSPACE_DBUS_INTERFACES_DIR ${DBUS_INTERFACES_INSTALL_DIR})
211 make_install_path_absolute(KDE4WORKSPACE_DBUS_SERVICES_DIR   ${DBUS_SERVICES_INSTALL_DIR})
212 make_install_path_absolute(KDE4WORKSPACE_SERVICES_DIR ${SERVICES_INSTALL_DIR})
213 make_install_path_absolute(KDE4WORKSPACE_SERVICETYPES_DIR ${SERVICETYPES_INSTALL_DIR})
215 set(KDE4WORKSPACE_TARGET_PREFIX KDE4Workspace__)
217 configure_file(KDE4WorkspaceConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake" @ONLY)
219 # this file will be installed too and will be used by cmake when searching for the Config.cmake file to check the version of kdepimlibs, Alex
220 macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake 
221                                      ${KDE4WORKSPACE_VERSION_MAJOR} ${KDE4WORKSPACE_VERSION_MINOR} ${KDE4WORKSPACE_VERSION_PATCH})
223 set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/KDE4Workspace-${KDE4WORKSPACE_VERSION}/cmake)
224 # places where find_package() looks for FooConfig.cmake files:
225 # CMake >= 2.6.0 looks in lib/Foo*/cmake/, CMake >= 2.6.3 also looks in
226 # lib/cmake/Foo*/, which packagers prefer. So they can set the KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR
227 # option to have kdepimlibs install its Config file there. Alex
228 if(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
229    set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/KDE4Workspace-${KDE4WORKSPACE_VERSION} )
230 endif(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
232 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake
233               ${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake
234         DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR})
236 install(EXPORT kdeworkspaceLibraryTargets 
237         NAMESPACE ${KDE4WORKSPACE_TARGET_PREFIX}
238         DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR}
239         FILE KDE4WorkspaceLibraryTargets.cmake )