Email us for more information and to confirm.21+Q:
CMake is not defining empty project
I have a very simple CMakeLists.txt file for an empty Qt project. However, it is telling me that my project name is not defined. It says the following:
[ 1%] Building CXX object CMakeFiles/my_project.dir/main.cpp.o
In file included from /usr/include/qt5/QtWidgets/qapplication.h:41:0,
from /usr/include/qt5/QtWidgets/qapplication_x11.h:37,
from /usr/include/qt5/QtWidgets/qapplication.h:41,
from CMakeFiles/my_project.dir/main.cpp.o:40:
/usr/include/qt5/QtWidgets/qdesktopwidget.h:35:18: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [CMakeFiles/my_project.dir/main.cpp.o] Error 1
Makefile:15: recipe for target 'CMakeFiles/my_project.dir/all' failed
make: *** [all] Error 2
My CMakeLists.txt file is as follows:
project(my_project)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(Qt5Widgets)
qt5_add_resources(resources)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_executable(my_project main.cpp)
target_link_libraries(my_project Qt5::Widgets)
What's going on? What am I doing wrong?
A:
Related links:
Comments