fix logic
[personal-kdelibs.git] / CMakeLists.txt
blob04a3b584580d4ff0a3eac6157a5af8c878dae35f
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 60)
12 set (KDE_VERSION "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}" )
13 set (KDE_VERSION_STRING "${KDE_VERSION} (KDE 4.2.60 (KDE 4.3 >= 20090116))")
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 macro_optional_find_package(BZip2)
55 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.")
57 macro_optional_find_package(OpenSSL)
58 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.")
60 macro_optional_find_package(Libintl)
61 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.")
63 macro_optional_find_package(OpenGL)
64 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.")
66 set(SOPRANO_MIN_VERSION "2.1.67")
67 macro_optional_find_package(Soprano)
68 macro_log_feature(Soprano_FOUND "Soprano" "Soprano Libraries" "kdesupport" FALSE "${SOPRANO_MIN_VERSION}" "Provide metadata support (for semantic desktop).")
71 ################# Disallow in-source build #################
73 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.")
75 # ... and warn in case of an earlier in-source build
76 set(generatedFileInSourceDir EXISTS ${kdelibs_SOURCE_DIR}/kdemacros.h OR EXISTS ${kdelibs_SOURCE_DIR}/config.h)
77 if(${generatedFileInSourceDir})
78    message(STATUS "kdemacros.h or config.h exists in your source directory.")
79    message(FATAL_ERROR "Please run svn-clean, it would seem that your source directory has generated files in it.")
80 endif(${generatedFileInSourceDir})
81 #########################################################################
83 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
84 remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT)
87 ################# setup the include directories #################
89 # for including config.h and for includes like <kparts/foo.h>
90 include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces)
92 # Those variables for  are only valid inside of kdelibs, of course.
93 # Use the one variable for the lib you depend upon.
94 # E.g. kdeui uses ${KDE4_KDECORE_INCLUDES}. Something that depends on kparts uses ${KDE4_KPARTS_INCLUDES}.
96 set(KDE4_KJS_INCLUDES ${CMAKE_SOURCE_DIR}/kjs
97                       ${CMAKE_BINARY_DIR}/kjs)
99 # kdecore depends on Qt (need only headers from kjs)
100 set(KDE4_KDECORE_INCLUDES ${KDE4_KJS_INCLUDES}
101                           ${CMAKE_SOURCE_DIR}/kdecore
102                           ${CMAKE_BINARY_DIR}/kdecore
103                           ${CMAKE_SOURCE_DIR}/kdecore/compression
104                           ${CMAKE_SOURCE_DIR}/kdecore/config
105                           ${CMAKE_SOURCE_DIR}/kdecore/date
106                           ${CMAKE_SOURCE_DIR}/kdecore/io
107                           ${CMAKE_SOURCE_DIR}/kdecore/jobs
108                           ${CMAKE_SOURCE_DIR}/kdecore/kernel
109                           ${CMAKE_SOURCE_DIR}/kdecore/network
110                           ${CMAKE_SOURCE_DIR}/kdecore/services
111                           ${CMAKE_SOURCE_DIR}/kdecore/localization
112                           ${CMAKE_SOURCE_DIR}/kdecore/sycoca
113                           ${CMAKE_SOURCE_DIR}/kdecore/text
114                           ${CMAKE_SOURCE_DIR}/kdecore/util
115                           ${CMAKE_SOURCE_DIR}/kdecore/sonnet
116                           ${QT_INCLUDES}
117                           ${_KDE4_PLATFORM_INCLUDE_DIRS})
118 # kdeui depends on kdecore
119 set(KDE4_KDEUI_INCLUDES ${CMAKE_SOURCE_DIR}/kdeui
120                         ${CMAKE_SOURCE_DIR}/kdeui/actions
121                         ${CMAKE_SOURCE_DIR}/kdeui/colors
122                         ${CMAKE_SOURCE_DIR}/kdeui/config
123                         ${CMAKE_SOURCE_DIR}/kdeui/dialogs
124                         ${CMAKE_SOURCE_DIR}/kdeui/findreplace
125                         ${CMAKE_SOURCE_DIR}/kdeui/fonts
126                         ${CMAKE_SOURCE_DIR}/kdeui/icons
127                         ${CMAKE_SOURCE_DIR}/kdeui/itemviews
128                         ${CMAKE_SOURCE_DIR}/kdeui/jobs
129                         ${CMAKE_SOURCE_DIR}/kdeui/kernel
130                         ${CMAKE_SOURCE_DIR}/kdeui/paged
131                         ${CMAKE_SOURCE_DIR}/kdeui/plotting
132                         ${CMAKE_SOURCE_DIR}/kdeui/shortcuts
133                         ${CMAKE_SOURCE_DIR}/kdeui/sonnet
134                         ${CMAKE_SOURCE_DIR}/kdeui/util
135                         ${CMAKE_SOURCE_DIR}/kdeui/widgets
136                         ${CMAKE_SOURCE_DIR}/kdeui/windowmanagement
137                         ${CMAKE_SOURCE_DIR}/kdeui/xmlgui
138                         ${KDE4_KDECORE_INCLUDES})
140 # kio depends on kdeui
141 set(KDE4_KIO_INCLUDES ${CMAKE_SOURCE_DIR}/kio
142                       ${CMAKE_SOURCE_DIR}/kio/bookmarks
143                       ${CMAKE_SOURCE_DIR}/kio/kio
144                       ${CMAKE_SOURCE_DIR}/kio/kfile
145                       ${KDE4_KDEUI_INCLUDES})
147 # kpty 
148 set(KDE4_KPTY_INCLUDES ${CMAKE_SOURCE_DIR}/kpty ${KDE4_KIO_INCLUDES} )
150 # kparts depends on kio
151 set(KDE4_KPARTS_INCLUDES ${CMAKE_SOURCE_DIR}/kparts
152                          ${KDE4_KIO_INCLUDES})
154 # kde3support depends on kparts
155 set(KDE4_KDE3SUPPORT_INCLUDES ${CMAKE_SOURCE_DIR}/kde3support
156                               ${CMAKE_SOURCE_DIR}/kde3support/kdecore
157                               ${CMAKE_SOURCE_DIR}/kde3support/kdeui
158                               ${CMAKE_SOURCE_DIR}/kde3support/kio
159                               ${KDE4_KPARTS_INCLUDES})
161 set(KDE4_KHTML_INCLUDES ${CMAKE_SOURCE_DIR}/khtml)
164 ################# configure checks and create the configured files #################
166 # ACL stuff (used in kio/ and kioslaves/)
167 find_package(ACL)
168 macro_bool_to_01(ACL_FOUND HAVE_LIBACL HAVE_POSIX_ACL)
169 configure_file(config-acl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-acl.h )
171 include(ConfigureChecks.cmake)
173 # now create config headers
174 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
175 configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
176 configure_file(config-compiler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-compiler.h )
177 configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h )
178 configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h )
180 # these two calls here should go somewhere else, Alex
181 check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
182 check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
185 if(Soprano_FOUND)
186   set(HAVE_NEPOMUK true)
187   macro_optional_add_subdirectory(nepomuk)
188 endif(Soprano_FOUND)
190 ################# list the subdirectories #################
192 add_subdirectory( cmake )
193 add_subdirectory( kdecore )
194 add_subdirectory( kdeui )
195 if (UNIX)
196    add_subdirectory( kpty )
197    add_subdirectory( kdesu )
198 endif (UNIX)
199 add_subdirectory( kjs )
200 add_subdirectory( kjsembed )
201 add_subdirectory( kio )
202 add_subdirectory( solid )
203 add_subdirectory( kded       )
204 if (QT_QT3SUPPORT_FOUND)
205    add_subdirectory( kde3support  )
206 endif (QT_QT3SUPPORT_FOUND)
207 add_subdirectory( kfile )
208 add_subdirectory( kconf_update )
209 add_subdirectory( kdoctools  )
210 add_subdirectory( kioslave   )
211 add_subdirectory( knewstuff  )
212 add_subdirectory( kparts     )
213 add_subdirectory( kutils     )
214 add_subdirectory( licenses   )
215 add_subdirectory( mimetypes  )
216 add_subdirectory( kinit  )
217 add_subdirectory( threadweaver )
218 add_subdirectory( sonnet  )
219 add_subdirectory( khtml  )
220 add_subdirectory( interfaces  )
221 add_subdirectory( kdewidgets  )
222 add_subdirectory( kate  )
223 add_subdirectory( knotify )
224 add_subdirectory( kimgio )
225 add_subdirectory( dnssd )
226 add_subdirectory( kross )
227 add_subdirectory( security )
228 add_subdirectory( plasma )
229 add_subdirectory( includes )
231 macro_optional_add_subdirectory( doc  )
233 ################# write dependency file which will be installed #################
235 # Used in configure_file() and install(EXPORT)
236 set(KDE4_TARGET_PREFIX KDE4__)
237 include(CreateKDELibsDependenciesFile.cmake)
239 ################# install files #################
241 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h  DESTINATION  ${INCLUDE_INSTALL_DIR} )
242 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
245 # run a script before installing the exports files which deletes previously installed
246 # configuration specific export files KDELibs4(Library|Tools)Targets-<config>.cmake
247 # if the main exports file KDELibs4(Library|Tools)Targets.cmake has changed. This makes sure
248 # that this main file doesn't include older and different configuration specific exports files,
249 # which might have a different set of targets or targets with different names. 
250 # The code for installing the exports files will soon go into a macro. Alex
251 install(CODE "set(EXPORT_FILES KDELibs4LibraryTargets.cmake KDELibs4ToolsTargets.cmake)"
252         CODE "set(EXPORT_INSTALL_DIR \"${DATA_INSTALL_DIR}/cmake/modules\")"
253         SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/check_installed_exports_file.cmake" )
254 install( EXPORT kdelibsLibraryTargets DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4LibraryTargets.cmake )
255 install( EXPORT kdelibsToolsTargets   DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4ToolsTargets.cmake )
256 # the following will be the correct locations once cmake has the improved FIND_PACKAGE() 
257 # install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${PLUGIN_INSTALL_DIR}/cmake RENAME KDE4Config.cmake)
260 macro_display_feature_log()