E
E
EgaMen2016-03-28 18:44:58
linux
EgaMen, 2016-03-28 18:44:58

How to connect qt to cmake?

c19cd561526a468fb1b3fe11d5d109da.pngfaa290a37b034c4da4129392637e0ab0.png
I use clion and qt, I don’t understand anything at all, help me, how can I connect qt to cmake, what would work, otherwise he can’t even find it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly, 2016-03-29
@EgaMen

First, install the system Qt (google how to do it in your Linux), it will be much easier for you than building Qt yourself and doing everything that CLion wrote to you in the log.
Secondly, CMakeLists should be something like this (well, write your includes there, etc.):

cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)

project(Foo)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} -std=c++1y")

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5Widgets REQUIRED)

include_directories(${Qt5Widgets_INCLUDES})
add_executable(Foo main.cpp)
qt5_use_modules(Foo Widgets Core)

But why do you have to suffer with CLion, which is not designed for Qt development at all? Isn't it better to take a normal IDE like QtCreator and not suffer?

A
Alexander Ananiev, 2016-03-28
@SaNNy32

doc.qt.io/qt-5/cmake-manual.html
https://habrahabr.ru/post/181838/
stackoverflow.com/questions/15639781/how-to-find-q...

S
SergeySimonenko, 2018-01-09
@SergeySimonenko

www.cyberforum.ru/blogs/849454/blog4312.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question