Qt < 4.5 had a bug in the layout of QAbstractScrollArea's scrollbars,
[kdelibs.git] / CMakeLists.txt
blobb044eb1255834778de78bf34b4ed3202091929e3
1 project(kdelibs)
3 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
4 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
7 ################# set KDE specific information #################
9 set (KDE_VERSION_MAJOR 4)
10 set (KDE_VERSION_MINOR 2)
11 set (KDE_VERSION_RELEASE 66)
12 set (KDE_VERSION "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}" )
13 set (KDE_VERSION_STRING "${KDE_VERSION} (KDE 4.2.66 (KDE 4.3 >= 20090310))")
15 set (KDE_DISTRIBUTION_TEXT "compiled sources" CACHE STRING "Indicate the distribution in bug reports" )
17 # win32: give kde home in debug mode a different name as the  release home dir because the settings and caches are different
18 if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
19     set (_KDE_DEFAULT_HOME_POSTFIX "-debug" CACHE STRING "default KDE home directory postfix" )
20 endif (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
21 set (KDE_DEFAULT_HOME ".kde${_KDE_DEFAULT_HOME_POSTFIX}" CACHE STRING "The default KDE home directory" )
23 # this must be before FindKDE4Internal in order to preset the result of the visibility test, so that it will be skipped
24 option(KHTML_BUILD_TESTREGRESSION "Build KHTML's testregression. Note: this disables hidden visibility")
25 # Disable visibility if testregression is built, because the symbols are needed then
26 if (KHTML_BUILD_TESTREGRESSION)
27    set (__KDE_HAVE_GCC_VISIBILITY 0)
28 endif (KHTML_BUILD_TESTREGRESSION)
31 ################# now find all used packages #################
33 find_package(KDE4Internal REQUIRED)
34 include(KDE4Defaults)
35 include (MacroLibrary)
36 if (APPLE)
37    find_package(Carbon REQUIRED)
38 endif (APPLE)
40 if(UNIX AND Q_WS_X11)
41   #X11 Session Management (SM) is required
42   #X11_SM_FOUND is set in FindX11, which is required by KDE4Internal
43   if(NOT X11_SM_FOUND)
44     message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
45   endif(NOT X11_SM_FOUND)
46 endif(UNIX AND Q_WS_X11)
48 #required features
49 find_package(ZLIB REQUIRED)
50 set(STRIGI_MIN_VERSION 0.6.3)
51 find_package(Strigi REQUIRED)
53 #optional features
54 if(X11_FOUND)
55   #X11_Xrender discovery is done by FindX11
56   macro_log_feature(X11_Xrender_FOUND "X Rendering extension" "an X Window System extension for image compositing" "http://www.x.org" FALSE "" "STRONGLY RECOMMENDED: For compositing, rendering operations, and alpha-blending.")
57 endif(X11_FOUND)
59 macro_optional_find_package(BZip2)
60 macro_log_feature(BZIP2_FOUND "BZip2" "A high-quality data compressor" "http://www.bzip.org" FALSE "" "STRONGLY RECOMMENDED: Provides the ability to read and write bzip2 compressed data files.")
62 macro_optional_find_package(OpenSSL)
63 macro_log_feature(OPENSSL_FOUND "OpenSSL" "A toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols" "http://openssl.org" FALSE "" "STRONGLY RECOMMENDED: KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS.")
65 macro_optional_find_package(Libintl)
66 macro_log_feature(LIBINTL_FOUND "Libintl" "Library for message translation" "http://www.gnu.org/software/gettext" FALSE "" "STRONGLY RECOMMENDED: Enables KDE to be available in many different languages.")
68 macro_optional_find_package(OpenGL)
69 macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3D graphics applications" "http://mesa3d.sourceforge.net" FALSE "" "STRONGLY RECOMMENDED: The 3D hardware acceleration available through the OpenGL API is used in applications ranging from graphics and modellers to screensavers and video players.")
71 set(SOPRANO_MIN_VERSION "2.1.68")
72 macro_optional_find_package(Soprano)
73 macro_log_feature(Soprano_FOUND "Soprano" "Soprano Libraries" "kdesupport" FALSE "${SOPRANO_MIN_VERSION}" "Provide metadata support (for semantic desktop).")
76 ################# Disallow in-source build #################
78 macro_ensure_out_of_source_build("kdelibs requires an out of source build. Please create a separate build directory and run 'cmake path_to_kdelibs [options]' there.")
80 # ... and warn in case of an earlier in-source build
81 set(generatedFileInSourceDir EXISTS ${kdelibs_SOURCE_DIR}/kdemacros.h OR EXISTS ${kdelibs_SOURCE_DIR}/config.h)
82 if(${generatedFileInSourceDir})
83    message(STATUS "kdemacros.h or config.h exists in your source directory.")
84    message(FATAL_ERROR "Please run svn-clean, it would seem that your source directory has generated files in it.")
85 endif(${generatedFileInSourceDir})
86 #########################################################################
88 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
89 remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT)
92 ################# setup the include directories #################
94 # for including config.h and for includes like <kparts/foo.h>
95 include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces)
97 # Those variables for  are only valid inside of kdelibs, of course.
98 # Use the one variable for the lib you depend upon.
99 # E.g. kdeui uses ${KDE4_KDECORE_INCLUDES}. Something that depends on kparts uses ${KDE4_KPARTS_INCLUDES}.
101 set(KDE4_KJS_INCLUDES ${CMAKE_SOURCE_DIR}/kjs
102                       ${CMAKE_BINARY_DIR}/kjs)
104 # kdecore depends on Qt (need only headers from kjs)
105 set(KDE4_KDECORE_INCLUDES ${KDE4_KJS_INCLUDES}
106                           ${CMAKE_SOURCE_DIR}/kdecore
107                           ${CMAKE_BINARY_DIR}/kdecore
108                           ${CMAKE_SOURCE_DIR}/kdecore/compression
109                           ${CMAKE_SOURCE_DIR}/kdecore/config
110                           ${CMAKE_SOURCE_DIR}/kdecore/date
111                           ${CMAKE_SOURCE_DIR}/kdecore/io
112                           ${CMAKE_SOURCE_DIR}/kdecore/jobs
113                           ${CMAKE_SOURCE_DIR}/kdecore/kernel
114                           ${CMAKE_SOURCE_DIR}/kdecore/network
115                           ${CMAKE_SOURCE_DIR}/kdecore/services
116                           ${CMAKE_SOURCE_DIR}/kdecore/localization
117                           ${CMAKE_SOURCE_DIR}/kdecore/sycoca
118                           ${CMAKE_SOURCE_DIR}/kdecore/text
119                           ${CMAKE_SOURCE_DIR}/kdecore/util
120                           ${CMAKE_SOURCE_DIR}/kdecore/sonnet
121                           ${QT_INCLUDES}
122                           ${_KDE4_PLATFORM_INCLUDE_DIRS})
123 # kdeui depends on kdecore
124 set(KDE4_KDEUI_INCLUDES ${CMAKE_SOURCE_DIR}/kdeui
125                         ${CMAKE_SOURCE_DIR}/kdeui/actions
126                         ${CMAKE_SOURCE_DIR}/kdeui/colors
127                         ${CMAKE_SOURCE_DIR}/kdeui/config
128                         ${CMAKE_SOURCE_DIR}/kdeui/dialogs
129                         ${CMAKE_SOURCE_DIR}/kdeui/findreplace
130                         ${CMAKE_SOURCE_DIR}/kdeui/fonts
131                         ${CMAKE_SOURCE_DIR}/kdeui/icons
132                         ${CMAKE_SOURCE_DIR}/kdeui/itemviews
133                         ${CMAKE_SOURCE_DIR}/kdeui/jobs
134                         ${CMAKE_SOURCE_DIR}/kdeui/kernel
135                         ${CMAKE_SOURCE_DIR}/kdeui/paged
136                         ${CMAKE_SOURCE_DIR}/kdeui/plotting
137                         ${CMAKE_SOURCE_DIR}/kdeui/shortcuts
138                         ${CMAKE_SOURCE_DIR}/kdeui/sonnet
139                         ${CMAKE_SOURCE_DIR}/kdeui/util
140                         ${CMAKE_SOURCE_DIR}/kdeui/widgets
141                         ${CMAKE_SOURCE_DIR}/kdeui/windowmanagement
142                         ${CMAKE_SOURCE_DIR}/kdeui/xmlgui
143                         ${KDE4_KDECORE_INCLUDES})
145 # kio depends on kdeui
146 set(KDE4_KIO_INCLUDES ${CMAKE_SOURCE_DIR}/kio
147                       ${CMAKE_SOURCE_DIR}/kio/bookmarks
148                       ${CMAKE_SOURCE_DIR}/kio/kio
149                       ${CMAKE_SOURCE_DIR}/kio/kfile
150                       ${KDE4_KDEUI_INCLUDES})
152 # kpty 
153 set(KDE4_KPTY_INCLUDES ${CMAKE_SOURCE_DIR}/kpty ${KDE4_KIO_INCLUDES} )
155 # kparts depends on kio
156 set(KDE4_KPARTS_INCLUDES ${CMAKE_SOURCE_DIR}/kparts
157                          ${KDE4_KIO_INCLUDES})
159 # kde3support depends on kparts
160 set(KDE4_KDE3SUPPORT_INCLUDES ${CMAKE_SOURCE_DIR}/kde3support
161                               ${CMAKE_SOURCE_DIR}/kde3support/kdecore
162                               ${CMAKE_SOURCE_DIR}/kde3support/kdeui
163                               ${CMAKE_SOURCE_DIR}/kde3support/kio
164                               ${KDE4_KPARTS_INCLUDES})
166 set(KDE4_KHTML_INCLUDES ${CMAKE_SOURCE_DIR}/khtml)
169 ################# configure checks and create the configured files #################
171 # ACL stuff (used in kio/ and kioslaves/)
172 find_package(ACL)
173 macro_bool_to_01(ACL_FOUND HAVE_LIBACL HAVE_POSIX_ACL)
174 configure_file(config-acl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-acl.h )
176 include(ConfigureChecks.cmake)
178 # now create config headers
179 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
180 configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
181 configure_file(config-compiler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-compiler.h )
182 configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h )
183 configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h )
185 # these two calls here should go somewhere else, Alex
186 check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
187 check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
190 if(Soprano_FOUND)
191   set(HAVE_NEPOMUK true)
192   macro_optional_add_subdirectory(nepomuk)
193 endif(Soprano_FOUND)
195 ################# list the subdirectories #################
197 add_subdirectory( cmake )
198 add_subdirectory( kdecore )
199 add_subdirectory( kdeui )
200 if (UNIX)
201    add_subdirectory( kpty )
202    add_subdirectory( kdesu )
203 endif (UNIX)
204 add_subdirectory( kjs )
205 add_subdirectory( kjsembed )
206 add_subdirectory( kio )
207 add_subdirectory( solid )
208 add_subdirectory( kded       )
209 if (QT_QT3SUPPORT_FOUND)
210    add_subdirectory( kde3support  )
211 endif (QT_QT3SUPPORT_FOUND)
212 add_subdirectory( kfile )
213 add_subdirectory( kconf_update )
214 add_subdirectory( kdoctools  )
215 add_subdirectory( kioslave   )
216 add_subdirectory( knewstuff  )
217 add_subdirectory( kparts     )
218 add_subdirectory( kutils     )
219 add_subdirectory( licenses   )
220 add_subdirectory( mimetypes  )
221 add_subdirectory( kinit  )
222 add_subdirectory( threadweaver )
223 add_subdirectory( sonnet  )
224 add_subdirectory( khtml  )
225 add_subdirectory( interfaces  )
226 add_subdirectory( kdewidgets  )
227 add_subdirectory( kate  )
228 add_subdirectory( knotify )
229 add_subdirectory( kimgio )
230 add_subdirectory( dnssd )
231 add_subdirectory( kross )
232 add_subdirectory( security )
233 add_subdirectory( plasma )
234 add_subdirectory( includes )
236 macro_optional_add_subdirectory( doc  )
238 ################# write dependency file which will be installed #################
240 # Used in configure_file() and install(EXPORT)
241 set(KDE4_TARGET_PREFIX KDE4__)
242 include(CreateKDELibsDependenciesFile.cmake)
244 ################# install files #################
246 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h  DESTINATION  ${INCLUDE_INSTALL_DIR} )
247 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
250 # run a script before installing the exports files which deletes previously installed
251 # configuration specific export files KDELibs4(Library|Tools)Targets-<config>.cmake
252 # if the main exports file KDELibs4(Library|Tools)Targets.cmake has changed. This makes sure
253 # that this main file doesn't include older and different configuration specific exports files,
254 # which might have a different set of targets or targets with different names. 
255 # The code for installing the exports files will soon go into a macro. Alex
256 install(CODE "set(EXPORT_FILES KDELibs4LibraryTargets.cmake KDELibs4ToolsTargets.cmake)"
257         CODE "set(EXPORT_INSTALL_DIR \"${DATA_INSTALL_DIR}/cmake/modules\")"
258         SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/check_installed_exports_file.cmake" )
259 install( EXPORT kdelibsLibraryTargets DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4LibraryTargets.cmake )
260 install( EXPORT kdelibsToolsTargets   DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4ToolsTargets.cmake )
261 # the following will be the correct locations once cmake has the improved FIND_PACKAGE() 
262 # install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${PLUGIN_INSTALL_DIR}/cmake RENAME KDE4Config.cmake)
265 macro_display_feature_log()