CMake how to add QT += core gui widgets
-
wrote on 30 Aug 2023, 14:47 last edited by
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}) -
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})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
-
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
wrote on 31 Aug 2023, 10:06 last edited by JacobNovitskyadded 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 -
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@JacobNovitsky Seriously? The message tells you very good what to do...
-
@JacobNovitsky Seriously? The message tells you very good what to do...
wrote on 31 Aug 2023, 10:40 last edited by JacobNovitskycan 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 -
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@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...
1/6