Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. cmake. add_subdirectory shows error "No such file or directory"

cmake. add_subdirectory shows error "No such file or directory"

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 625 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BrMisha
    wrote on last edited by
    #1

    Hello!
    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).

    add_subdirectory(drc)
    

    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?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      When you use a Qt library you also have to link against it. See e.g. the documentation for QWidget class - the first table.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved