[CMake] CMake with Qt5

Bogdan Cristea cristeab at gmail.com
Sun Mar 24 16:55:46 EDT 2013


On Sunday 24 March 2013 13:41:31 you wrote:
> Christea sent me a private response which has gotten me farther than
> before.  {Thanks Christea!}
> 
> The next issue I face is that it is not processing the *.ui files.  I am 
> missing the replacement for qt4_wrap_ui.  How do I include the *.ui files?
> 
> Below are the key pieces from my current CMakeLists.txt file:
> 
>     find_package (Qt5Core REQUIRED)
>     set(CMAKE_AUTOMOC ON)
>     set(CMAKE_INCLUDE_CURRENT_DIR ON)
> 
>     file (GLOB Sources *.cpp)
>     file (GLOB Headers *.h)
>     file (GLOB UIs *.ui)
>     file (GLOB Resources *.qrc)
> 
>     QT5_ADD_RESOURCES (ResourceSources ${Resources})
> 
>     include_directories (${CMAKE_CURRENT_BINARY_DIR})
> 
>     add_executable (Test ${Sources} ${Headers} ${ResourceSources})
> 
>     qt5_use_module (Test Widgets Qml Quick)
> 
> With this, MSVC gives errors for missing header files which should be 
> generated from the .ui files.

I have not yet used ui files, but I think QT5_WRAP_UI is available only when 
Qt5Widgets is found:
http://qt.developpez.com/doc/5.0-snapshot/cmake-manual/

-- 
Bogdan Cristea
Software Engineer
tel: +33 (0)6 21 64 15 81
personal site: http://sites.google.com/site/cristeab/


More information about the CMake mailing list