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 30 Aug 2023, 14:47 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})

    S 1 Reply Last reply 30 Aug 2023, 15:06
    0
    • J JacobNovitsky
      30 Aug 2023, 14:47

      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})

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 30 Aug 2023, 15:06 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 31 Aug 2023, 10:06
      5
      • S sierdzio
        30 Aug 2023, 15:06

        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 31 Aug 2023, 10:06 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

        C 1 Reply Last reply 31 Aug 2023, 10:09
        1
        • J JacobNovitsky
          31 Aug 2023, 10:06

          @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

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 31 Aug 2023, 10:09 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 31 Aug 2023, 10:40
          1
          • C Christian Ehrlicher
            31 Aug 2023, 10:09

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

            J Offline
            J Offline
            JacobNovitsky
            wrote on 31 Aug 2023, 10:40 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 31 Aug 2023, 11:05
            0
            • J JacobNovitsky
              31 Aug 2023, 10:40

              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 31 Aug 2023, 11:05 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

              1/6

              30 Aug 2023, 14:47

              • Login

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