Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMake how to add QT += core gui widgets
Forum Updated to NodeBB v4.3 + New Features

CMake how to add QT += core gui widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.1k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by
    #1

    How to ammend my CMake file

    project(GMPU CXX)

    find_package(PkgConfig REQUIRED)
    pkg_search_module(LIBEVDEV REQUIRED libevdev)

    add_executable(GMPU main.cpp)
    target_include_directories(GMPU PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
    target_link_libraries(GMPU PRIVATE ${LIBEVDEV_LIBRARIES})

    pkg_search_module(X11 REQUIRED x11)
    target_include_directories(GMPU PRIVATE ${X11_INCLUDE_DIRS})
    target_link_libraries(GMPU PRIVATE ${X11_LIBRARIES})

    pkg_search_module(XTST REQUIRED xtst)
    target_include_directories(GMPU PRIVATE ${XTST_INCLUDE_DIRS})
    target_link_libraries(GMPU PRIVATE ${XTST_LIBRARIES})

    sierdzioS 1 Reply Last reply
    0
    • J JacobNovitsky

      How to ammend my CMake file

      project(GMPU CXX)

      find_package(PkgConfig REQUIRED)
      pkg_search_module(LIBEVDEV REQUIRED libevdev)

      add_executable(GMPU main.cpp)
      target_include_directories(GMPU PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
      target_link_libraries(GMPU PRIVATE ${LIBEVDEV_LIBRARIES})

      pkg_search_module(X11 REQUIRED x11)
      target_include_directories(GMPU PRIVATE ${X11_INCLUDE_DIRS})
      target_link_libraries(GMPU PRIVATE ${X11_LIBRARIES})

      pkg_search_module(XTST REQUIRED xtst)
      target_include_directories(GMPU PRIVATE ${XTST_INCLUDE_DIRS})
      target_link_libraries(GMPU PRIVATE ${XTST_LIBRARIES})

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      This is listed in every page of documentation :-)

      find_package(Qt6 REQUIRED COMPONENTS Core)
      target_link_libraries(mytarget PRIVATE Qt6::Core)
      

      https://doc.qt.io/qt-6/qtcore-index.html#building-with-cmake

      (Z(:^

      J 1 Reply Last reply
      5
      • sierdzioS sierdzio

        This is listed in every page of documentation :-)

        find_package(Qt6 REQUIRED COMPONENTS Core)
        target_link_libraries(mytarget PRIVATE Qt6::Core)
        

        https://doc.qt.io/qt-6/qtcore-index.html#building-with-cmake

        J Offline
        J Offline
        JacobNovitsky
        wrote on last edited by JacobNovitsky
        #3

        @sierdzio

        added lines:
        find_package(Qt6 REQUIRED COMPONENTS Core)
        target_link_libraries(GMPU PRIVATE Qt6::Core)

        getting error:
        /home/supernova/prob_what_need/CMakeLists.txt:-1: error: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.24) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000".

        how to fix?
        upd: fixed, i'm ready to go, ty :)
        btw, can you give me right to post more often then once in 10 minutes? one reputation or sort of this...

        upd2::

        getting this error after set first header
        https://ibb.co/Yk44ddL

        Christian EhrlicherC 1 Reply Last reply
        1
        • J JacobNovitsky

          @sierdzio

          added lines:
          find_package(Qt6 REQUIRED COMPONENTS Core)
          target_link_libraries(GMPU PRIVATE Qt6::Core)

          getting error:
          /home/supernova/prob_what_need/CMakeLists.txt:-1: error: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.24) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000".

          how to fix?
          upd: fixed, i'm ready to go, ty :)
          btw, can you give me right to post more often then once in 10 minutes? one reputation or sort of this...

          upd2::

          getting this error after set first header
          https://ibb.co/Yk44ddL

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JacobNovitsky Seriously? The message tells you very good what to do...

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

          J 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @JacobNovitsky Seriously? The message tells you very good what to do...

            J Offline
            J Offline
            JacobNovitsky
            wrote on last edited by JacobNovitsky
            #5

            can not see Qt headers

            my current cmake:

            project(GMPU CXX)
            cmake_minimum_required(VERSION 3.24)
            find_package(PkgConfig REQUIRED)
            pkg_search_module(LIBEVDEV REQUIRED libevdev)

            add_executable(GMPU main.cpp)
            target_include_directories(GMPU PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
            target_link_libraries(GMPU PRIVATE ${LIBEVDEV_LIBRARIES})

            pkg_search_module(X11 REQUIRED x11)
            target_include_directories(GMPU PRIVATE ${X11_INCLUDE_DIRS})
            target_link_libraries(GMPU PRIVATE ${X11_LIBRARIES})

            pkg_search_module(XTST REQUIRED xtst)
            target_include_directories(GMPU PRIVATE ${XTST_INCLUDE_DIRS})
            target_link_libraries(GMPU PRIVATE ${XTST_LIBRARIES})

            find_package(Qt6 REQUIRED COMPONENTS Core)
            target_link_libraries(GMPU PRIVATE Qt6::Core)

            project(GMPU VERSION 1.0.0 LANGUAGES CXX)

            set(CMAKE_CXX_STANDARD 17)
            set(CMAKE_CXX_STANDARD_REQUIRED ON)

            Qt Creator and error itself screenshot:
            https://ibb.co/MR6jczX

            jsulmJ 1 Reply Last reply
            0
            • J JacobNovitsky

              can not see Qt headers

              my current cmake:

              project(GMPU CXX)
              cmake_minimum_required(VERSION 3.24)
              find_package(PkgConfig REQUIRED)
              pkg_search_module(LIBEVDEV REQUIRED libevdev)

              add_executable(GMPU main.cpp)
              target_include_directories(GMPU PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
              target_link_libraries(GMPU PRIVATE ${LIBEVDEV_LIBRARIES})

              pkg_search_module(X11 REQUIRED x11)
              target_include_directories(GMPU PRIVATE ${X11_INCLUDE_DIRS})
              target_link_libraries(GMPU PRIVATE ${X11_LIBRARIES})

              pkg_search_module(XTST REQUIRED xtst)
              target_include_directories(GMPU PRIVATE ${XTST_INCLUDE_DIRS})
              target_link_libraries(GMPU PRIVATE ${XTST_LIBRARIES})

              find_package(Qt6 REQUIRED COMPONENTS Core)
              target_link_libraries(GMPU PRIVATE Qt6::Core)

              project(GMPU VERSION 1.0.0 LANGUAGES CXX)

              set(CMAKE_CXX_STANDARD 17)
              set(CMAKE_CXX_STANDARD_REQUIRED ON)

              Qt Creator and error itself screenshot:
              https://ibb.co/MR6jczX

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @JacobNovitsky Why don't you simply go to the documentation (https://doc.qt.io/qt-6/qapplication.html) to see what you have to add to CMakeLists.txt to be able to use QApplication? It's faster than asking in a forum...

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              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