[CMake] Qt4

John Biddiscombe biddisco at cscs.ch
Wed Jul 20 07:47:07 EDT 2005


Filipe

Did you solve Qt4 problems. I've just finished installing Qt4, run the 
demos, done my first hello world app and have discovered that cmake is 
generating the wrong stuff for Qt4. I'll start experimenting, but if 
you've already found a working solution, please tell.

thanks

JB

>I've seen commits to FindQt4.cmake in CVS. I just realize that neither 
>QT_WRAP_CPP nor QT_WRAP_UI will work with Qt4.
>
>I have my own QT_WRAP_CPP that works fine:
>  # output file
>  GET_FILENAME_COMPONENT(basename ${header} NAME_WE)
>  SET(output_file ${CMAKE_CURRENT_BINARY_DIR}/${basename}.moc.${source_ext})
>
>  # -D flags
>  GET_DIRECTORY_PROPERTY(flags DEFINITIONS)
>  SEPARATE_ARGUMENTS(flags)
>
>  # -I flags
>  GET_DIRECTORY_PROPERTY(includes INCLUDE_DIRECTORIES)
>  FOREACH(inc ${includes})
>    SET(flags ${flags} ${CMAKE_INCLUDE_FLAG_CXX}${inc})
>  ENDFOREACH(inc)
>
>  ADD_CUSTOM_COMMAND(
>    OUTPUT   ${output_file}
>    COMMAND  ${QT_MOC_EXECUTABLE}
>    ARGS     ${flags} ${header} -o ${output_file}
>    DEPENDS  ${QT_MOC_EXECUTABLE} ${header}
>    COMMENT  "Qt Wrap Files"
>    )
>
>Now, the uic in qt4 only generates one file, the header file, but I can't get 
>it automatically generated:
>
>  GET_FILENAME_COMPONENT(basename ${ui_file} NAME_WE)
>  SET(ui_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${basename}.${header_ext})
>
>  ADD_CUSTOM_COMMAND(
>    OUTPUT  ${ui_header}
>    COMMAND ${QT_UIC_EXECUTABLE}
>    ARGS    ${ui_file} -o ${ui_header}
>    DEPENDS ${ui_file}
>    )
>
>If I have a file that includes the generated file, shouldn't cmake generated 
>dependencies on this file and automatically generate the header file from .ui 
>file or do I have to use SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES 
>OBJECT_DEPENDS ${ui_header})?
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>  
>


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the CMake mailing list