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.

113 lines
3.1 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. macro( tqt_message )
  12. message( STATUS "${ARGN}" )
  13. endmacro( )
  14. if( NOT TQT_FOUND )
  15. pkg_search_module( TQT tqt )
  16. if( NOT TQT_FOUND )
  17. tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
  18. endif( )
  19. mark_as_advanced(
  20. TMOC_EXECUTABLE
  21. MOC_EXECUTABLE
  22. UIC_EXECUTABLE
  23. )
  24. # tmoc_executable
  25. tde_execute_process(
  26. COMMAND pkg-config tqt --variable=tmoc_executable
  27. OUTPUT_VARIABLE TMOC_EXECUTABLE
  28. CACHE FILEPATH "TQt tmoc executable path"
  29. OUTPUT_STRIP_TRAILING_WHITESPACE )
  30. if( NOT EXISTS ${TMOC_EXECUTABLE} )
  31. tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
  32. endif( )
  33. tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
  34. # moc_executable
  35. tde_execute_process(
  36. COMMAND pkg-config tqt --variable=moc_executable
  37. OUTPUT_VARIABLE MOC_EXECUTABLE
  38. CACHE FILEPATH "TQt moc executable path"
  39. OUTPUT_STRIP_TRAILING_WHITESPACE )
  40. if( NOT EXISTS ${MOC_EXECUTABLE} )
  41. tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
  42. endif( )
  43. tqt_message( " moc path: ${MOC_EXECUTABLE}" )
  44. # uic_executable
  45. tde_execute_process(
  46. COMMAND pkg-config tqt --variable=uic_executable
  47. OUTPUT_VARIABLE UIC_EXECUTABLE
  48. CACHE FILEPATH "TQt uic executable path"
  49. OUTPUT_STRIP_TRAILING_WHITESPACE )
  50. if( NOT EXISTS ${UIC_EXECUTABLE} )
  51. tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
  52. endif( )
  53. tqt_message( " uic path: ${UIC_EXECUTABLE}" )
  54. # tqt-replace script
  55. set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace"
  56. CACHE FILEPATH "TQt replace script path" )
  57. if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
  58. tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
  59. endif( )
  60. tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" )
  61. # check if tqt is usable
  62. tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
  63. set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
  64. foreach( _dirs ${TQT_LIBRARY_DIRS} )
  65. list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
  66. endforeach()
  67. list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
  68. check_cxx_source_compiles("
  69. #include <tqapplication.h>
  70. int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
  71. HAVE_USABLE_TQT )
  72. if( NOT HAVE_USABLE_TQT )
  73. tde_message_fatal( "Unable to build a simple tqt test." )
  74. endif( )
  75. tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
  76. # TQT_CXX_FLAGS
  77. foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
  78. set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
  79. endforeach()
  80. set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS}" CACHE INTERNAL "" )
  81. endif( NOT TQT_FOUND )
  82. # Set compiler flags according to build type
  83. set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" )
  84. set( CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG" )