Steven
Steven

Reputation: 13975

Qt5 Cmake can't figure it out

I am really confused with Qt5 and Cmake. I had everything working but then I cleaned my build directory and then suddenly everything stopped working. I have the following CMakeLists

cmake_minimum_required(VERSION 2.8.8)

add_definitions(-DVERSION="0.0.0.1")

project(pocket)

set(SOURCE
    gui/LoginDialog.cpp
    main.cpp
)

set(HEADERS
    gui/LoginDialog.h
)

set(FORMS
    gui/LoginDialog.ui
)

set(RESOURCES
    resources/images.qrc
)

find_package(Qt5Widgets)

qt5_wrap_cpp(HEADERS_MOC ${HEADERS})
qt5_wrap_ui(FORMS_HEADERS ${FORMS})
qt5_add_resources(RESOURCES_RCC ${RESOURCES})

include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_executable(Test ${SOURCE} ${HEADERS_MOC} ${FORMS_HEADERS} ${RESOURCES_RCC})
qt5_use_modules(Test Widgets)

My problem is, it isn't doing the *.ui -> ui_*.h conversion, so then my .cpp files that include my form ui's fail compiling with (ui_*.h no such file or directory`)

Any idea what I am missing?

Upvotes: 1

Views: 852

Answers (1)

steveire
steveire

Reputation: 11074

You are missing an sscce. I can write a trivial case with this that works:

find_package(Qt5Widgets)

qt5_wrap_ui(uis somefile.ui)
add_executable(Test ${uis} foo.cpp)

Upvotes: 3

Related Questions