I have a simple CMakeLists.txt that looks like this:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(calculator) FIND_PACKAGE(Qt5Core) FIND_PACKAGE(Qt5Gui) FIND_PACKAGE(Qt5Widgets) SET(CMAKE_AUTOMOC ON) SET(CMAKE_INCLUDE_CURRENT_DIR ON) SET(calculator_SOURCES main.cpp mainwindow.cpp) SET(calculator_HEADERS mainwindow.h) SET(calculator_FORMS mainwindow.ui) QT5_WRAP_CPP(calculator_HEADERS_MOC ${calculator_HEADERS}) QT5_WRAP_UI(calculator_FORMS_HEADERS ${calculator_FORMS}) ADD_LIBRARY(calculator_CONFIG ${calculator_HEADERS_MOC} ${calculator_FORMS_HEADERS}) QT5_USE_MODULES(calculator_CONFIG Widgets) ADD_EXECUTABLE(calculator ${calculator_SOURCES} ${calculator_CONFIG}) QT5_USE_MODULES(calculator Core Gui Widgets)
And when I try to build a project using cmake -G "Unix Makefiles" and subsequently make , the console says that ui_mainwindow.h not found. What is the problem? Is this my cmake file?
Full error output:
[ 22%] Building CXX object CMakeFiles/calculator.dir/mainwindow.cpp.o /home/centurion/Code/cpp/calculator/mainwindow.cpp:2:27: fatal error: ui_mainwindow.h: No such file or directory #include "ui_mainwindow.h" ^ compilation terminated. make[2]: *** [CMakeFiles/calculator.dir/mainwindow.cpp.o] Error 1 make[1]: *** [CMakeFiles/calculator.dir/all] Error 2 make: *** [all] Error 2
c ++ qt cmake makefile
Kenny worden
source share