CMake & QT5 - QT5_WRAP_UI not generating ui header files
I have encountered the same issue on Mac OS X. Ui form header file is not generated.
I have solved my problem by generating manually .h file with QtDesigner. When changes are made on ui form, header file is well generated.
Note: if I add some others ui forms, headers are generated automatically without needed to generate header file manually for these others ui.
EDIT: header file is well generated at first build only if it isn't used into cpp code.
I was running in the same issue with cmake 3.2.2. Try using
SET(CMAKE_AUTOUIC ON)
if the ui files are not generated. Maybe the default behaviour changed recently?
Use lower-case CMake commands. That has been the sane convention for years.
Why are you using both
AUTOMOC
andqt5_wrap_cpp
?AUTOMOC
is designed to replace the macro. http://www.cmake.org/cmake/help/v3.0/manual/cmake-qt.7.html#automocIf using CMake 2.8.11 or later, then don't use
qt5_use_modules
. I wrote that as a stop-gap hack until CMake 2.8.11 was released. Thetarget_link_libraries
command does whatqt5_use_modules
does, but better and more-generically. http://doc-snapshot.qt-project.org/qt5-5.3/cmake-manual.htmlThe library has no sources of its own and is not used. You're clearly 'doing it wrong' here. Move the
${calculator_FORMS_HEADERS}
variable usage to the executables sources. Then after addressing point 2, remove the library.