1 # Find KDE4 and provide all necessary variables and macros to compile software for it.
2 # It looks for KDE 4 in the following directories in the given order:
7 # Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more information.
8 # They are installed with the KDE 4 libraries in $KDEDIRS/share/apps/cmake/modules/.
10 # Author: Alexander Neundorf <neundorf@kde.org>
12 # If Qt3 has already been found, fail.
14 IF(KDE4_FIND_REQUIRED)
15 MESSAGE( FATAL_ERROR "KDE4/Qt4 and Qt3 cannot be used together in one project.")
16 ELSE(KDE4_FIND_REQUIRED)
17 IF(NOT KDE4_FIND_QUIETLY)
18 MESSAGE( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.")
19 ENDIF(NOT KDE4_FIND_QUIETLY)
21 ENDIF(KDE4_FIND_REQUIRED)
24 FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
26 # when cross compiling, searching kde4-config in order to run it later on
27 # doesn't make a lot of sense. We'll have to do something about this.
28 # Searching always in the target environment ? Then we get at least the correct one,
29 # still it can't be used to run it. Alex
31 # For KDE4 kde-config has been renamed to kde4-config
32 FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
33 # the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended
36 ${CMAKE_INSTALL_PREFIX}
39 ONLY_CMAKE_FIND_ROOT_PATH
42 IF (NOT KDE4_KDECONFIG_EXECUTABLE)
43 IF (KDE4_FIND_REQUIRED)
44 MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
45 ENDIF (KDE4_FIND_REQUIRED)
46 ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
49 # when cross compiling, KDE4_DATA_DIR may be already preset
51 IF(CMAKE_CROSSCOMPILING)
52 # when cross compiling, don't run kde4-config but use its location as install dir
53 GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH)
54 GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH)
55 ELSE(CMAKE_CROSSCOMPILING)
56 # then ask kde4-config for the kde data dirs
58 IF(KDE4_KDECONFIG_EXECUTABLE)
59 EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
60 FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
61 # then check the data dirs for FindKDE4Internal.cmake
62 FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake ${_data_DIR})
63 ENDIF(KDE4_KDECONFIG_EXECUTABLE)
64 ENDIF(CMAKE_CROSSCOMPILING)
65 ENDIF(NOT KDE4_DATA_DIR)
67 # if it has been found...
70 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules)
72 IF (KDE4_FIND_QUIETLY)
74 ENDIF (KDE4_FIND_QUIETLY)
76 IF (KDE4_FIND_REQUIRED)
78 ENDIF (KDE4_FIND_REQUIRED)
80 # use FindKDE4Internal.cmake to do the rest
81 FIND_PACKAGE(KDE4Internal ${_req} ${_quiet})
83 IF (KDE4_FIND_REQUIRED)
84 MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
85 ENDIF (KDE4_FIND_REQUIRED)