FindKDE4.cmake 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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:
  3. # - CMAKE_INSTALL_PREFIX
  4. # - KDEDIR
  5. # - /opt/kde4
  6. # - /opt/kde
  7. #
  8. # Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more information.
  9. # They are installed with the KDE 4 libraries in $KDEDIR/share/apps/cmake/modules/.
  10. #
  11. # Author: Alexander Neundorf <[email protected]>
  12. FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
  13. # First try to find kde-config, for KDE4 soon to be renamed to kde4-config
  14. FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config kde-config
  15. PATHS
  16. ${CMAKE_INSTALL_PREFIX}/bin
  17. ${_KDEDIRS}
  18. /opt/kde4/bin
  19. NO_DEFAULT_PATH
  20. )
  21. IF (NOT KDE4_KDECONFIG_EXECUTABLE)
  22. FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config kde-config )
  23. ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
  24. IF (KDE4_KDECONFIG_EXECUTABLE)
  25. # then ask kde-config for the kde data dirs
  26. EXEC_PROGRAM(${KDE4_KDECONFIG_EXECUTABLE} ARGS --path data OUTPUT_VARIABLE _data_DIR )
  27. FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
  28. # then check the data dirs for FindKDE4Internal.cmake
  29. FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake ${_data_DIR})
  30. # if it has been found...
  31. IF (KDE4_DATA_DIR)
  32. SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules)
  33. IF (KDE4_FIND_QUIETLY)
  34. SET(_quiet QUIET)
  35. ENDIF (KDE4_FIND_QUIETLY)
  36. IF (KDE4_FIND_REQUIRED)
  37. SET(_req REQUIRED)
  38. ENDIF (KDE4_FIND_REQUIRED)
  39. # use FindKDE4Internal.cmake to do the rest
  40. FIND_PACKAGE(KDE4Internal ${_req} ${_quiet})
  41. ELSE (KDE4_DATA_DIR)
  42. IF (KDE4_FIND_REQUIRED)
  43. MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
  44. ENDIF (KDE4_FIND_REQUIRED)
  45. ENDIF (KDE4_DATA_DIR)
  46. ELSE (KDE4_KDECONFIG_EXECUTABLE)
  47. IF (KDE4_FIND_REQUIRED)
  48. MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde-config")
  49. ENDIF (KDE4_FIND_REQUIRED)
  50. ENDIF (KDE4_KDECONFIG_EXECUTABLE)