Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
cmake. add_subdirectory shows error "No such file or directory"
BrMisha last edited by
I want to move from the qmake to the cmake, that will my first experience with the cmake.
I need to add some subdirectory contains the CMakeLists (similar *.pri using the qmake).
Inside the internal CMakeLists i added next:
cmake_minimum_required(VERSION 3.5) project(DRC) add_executable(DRC drcwidget.cpp drcwidget.h )
drcwidget uses QWidget. Finaly i got build error:
drc/drcwidget.h:4:10: fatal error: QWidget: No such file or directory
Why doesn't drc/CMakeLists.txt see QWidget included in main CMakeLists.txt?
When you use a Qt library you also have to link against it. See e.g. the documentation for QWidget class - the first table.