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.

68 lines
2.5 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. set( CMAKE_MODULE_PATH "${MASTER_SOURCE_DIR}/cmake/modules" )
  12. include( TDEMacros )
  13. get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
  14. # FIXME this will working only on out-of-source mode
  15. set( local_ui_file ${_ui_basename}.ui )
  16. configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
  17. tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file} )
  18. # ui.h extension file, if exists
  19. if( EXISTS "${UI_FILE}.h" )
  20. configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY )
  21. tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file}.h )
  22. endif( )
  23. if( TDE_TQTPLUGINS_DIR )
  24. set( L -L ${TDE_TQTPLUGINS_DIR} )
  25. endif( )
  26. tde_execute_process( COMMAND ${UIC_EXECUTABLE}
  27. -nounload -tr tr2i18n
  28. ${L}
  29. ${local_ui_file}
  30. OUTPUT_VARIABLE _ui_h_content )
  31. if( _ui_h_content )
  32. string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
  33. string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
  34. string( REGEX REPLACE "public TQWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
  35. string( REGEX REPLACE "public QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
  36. string( REGEX REPLACE "#include <ntqwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
  37. string( REGEX REPLACE "#include <qwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
  38. file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
  39. endif( )
  40. tde_execute_process( COMMAND ${UIC_EXECUTABLE}
  41. -nounload -tr tr2i18n
  42. ${L}
  43. -impl ${_ui_basename}.h
  44. ${local_ui_file}
  45. OUTPUT_VARIABLE _ui_cpp_content )
  46. if( _ui_cpp_content )
  47. string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
  48. string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
  49. string( REGEX REPLACE ": TQWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
  50. string( REGEX REPLACE ": QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
  51. file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <tdelocale.h>\n\n${_ui_cpp_content}" )
  52. tde_execute_process( COMMAND ${MOC_EXECUTABLE}
  53. ${_ui_basename}.h
  54. OUTPUT_VARIABLE _ui_h_moc_content )
  55. file( APPEND ${_ui_basename}.cpp "${_ui_h_moc_content}" )
  56. endif( )