Shared cmake folder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.0 KiB

  1. #################################################
  2. #
  3. # (C) 2010-2011 Serghei Amelian
  4. # serghei (DOT) amelian (AT) gmail.com
  5. #
  6. # Improvements and feedback are welcome
  7. #
  8. # This file is released under GPL >= 2
  9. #
  10. #################################################
  11. if( NOT TDE_FOUND )
  12. message( STATUS "checking for 'TDE'")
  13. pkg_search_module( TDE tqt )
  14. if( NOT TDE_FOUND )
  15. tde_message_fatal( "Unable to find tdelibs!\n Try adding the directory in which the tdelibs.pc file is located\nto the PKG_CONFIG_PATH variable." )
  16. endif( )
  17. # if the path is not already defined by user,
  18. # find tde-config executable
  19. if( NOT DEFINED KDECONFIG_EXECUTABLE )
  20. find_program( KDECONFIG_EXECUTABLE
  21. NAMES tde-config
  22. HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} )
  23. if( NOT KDECONFIG_EXECUTABLE )
  24. tde_message_fatal( "tde-config are NOT found." )
  25. endif( NOT KDECONFIG_EXECUTABLE )
  26. set( KDECONFIG_EXECUTABLE ${KDECONFIG_EXECUTABLE}
  27. CACHE INTERNAL "tde-config executable" )
  28. endif( NOT DEFINED KDECONFIG_EXECUTABLE )
  29. set( ENV{LD_LIBRARY_PATH} "${TDE_LIBDIR}:$ENV{LD_LIBRARY_PATH}" )
  30. # check for installed trinity version
  31. tde_execute_process(
  32. COMMAND ${KDECONFIG_EXECUTABLE} --version
  33. OUTPUT_VARIABLE _version
  34. RESULT_VARIABLE _result
  35. OUTPUT_STRIP_TRAILING_WHITESPACE
  36. MESSAGE "Unable to run tde-config!\n TDELIBS are correctly installed?\n Path to tde-config are corect?" )
  37. # parse tde-config output, to extract TDE version
  38. string( REGEX MATCH "TDE: R([0-9\\.]+).*" __dummy "${_version}" )
  39. set( TDE_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "" )
  40. # ask tde-config for few paths
  41. macro( __internal_get_path __type __var )
  42. tde_execute_process(
  43. COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
  44. OUTPUT_VARIABLE ${__var}
  45. CACHE INTERNAL "TDE ${__type} path" FORCE
  46. OUTPUT_STRIP_TRAILING_WHITESPACE )
  47. endmacro( __internal_get_path )
  48. __internal_get_path( include TDE_INCLUDE_DIR )
  49. __internal_get_path( lib TDE_LIB_DIR )
  50. __internal_get_path( exe TDE_BIN_DIR )
  51. __internal_get_path( data TDE_DATA_DIR )
  52. __internal_get_path( config TDE_CONFIG_DIR )
  53. __internal_get_path( html TDE_HTML_DIR )
  54. __internal_get_path( cmake TDE_CMAKE_DIR )
  55. __internal_get_path( tqtplugins TDE_TQTPLUGINS_DIR )
  56. # find kde tools
  57. macro( __internal_find_program __prog __var )
  58. find_program( ${__var}
  59. NAMES ${__prog}
  60. HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR}
  61. OUTPUT_STRIP_TRAILING_WHITESPACE )
  62. if( NOT ${__var} )
  63. tde_message_fatal( "${__prog} is NOT found.\n TDELIBS are correctly installed?" )
  64. endif( NOT ${__var} )
  65. set( ${__var} ${${__var}} CACHE INTERNAL "${__prog} executable" FORCE )
  66. endmacro( __internal_find_program )
  67. __internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE )
  68. __internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE )
  69. __internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE )
  70. __internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE )
  71. __internal_find_program( tdeconfig_compiler KDE3_KCFGC_EXECUTABLE )
  72. __internal_find_program( maketdewidgets KDE3_MAKETDEWIDGETS_EXECUTABLE )
  73. # Don't use __internal_find_program due to it's not mandatory
  74. if( NOT DEFINED TDELFEDITOR_EXECUTABLE )
  75. find_program( TDELFEDITOR_EXECUTABLE NAMES tdelfeditor
  76. HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE )
  77. set( TDELFEDITOR_EXECUTABLE ${TDELFEDITOR_EXECUTABLE}
  78. CACHE INTERNAL "tdelfeditor executable" )
  79. endif( )
  80. # dcopidlng is a bash script which using tde-config;
  81. # if PATH to tde-config is not set, dcopidlng will fail;
  82. # for this reason we set KDECONFIG environment variable before running dcopidlng
  83. set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
  84. CACHE INTERNAL "dcopidlng executable" FORCE )
  85. # read source metadata
  86. tde_read_src_metadata()
  87. message( STATUS " found 'TDE', version ${TDE_VERSION}" )
  88. endif( NOT TDE_FOUND )
  89. if( NOT TARGET tdecore-shared )
  90. include( "${TDE_CMAKE_DIR}/tdelibs.cmake" )
  91. endif()