Cmake VS Qmake example:
qmake
QT += core gui
QT += charts
QT += concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
callout.cpp \
main.cpp \
mainwindow.cpp \
chartview.cpp \
view.cpp
HEADERS += \
callout.h \
mainwindow.h \
chartview.h \
view.h
TRANSLATIONS += \
Thread_data_viewer_nl_BE.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Cmake
cmake_minimum_required(VERSION 3.5)
project(Thread_data_viewer LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(
QT
NAMES
Qt6
Qt5
COMPONENTS
Widgets
Charts
Concurrent
REQUIRED
)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS
Widgets
Charts
Concurrent
REQUIRED
)
if(ANDROID)
add_library(
Thread_data_viewer
SHARED
main.cpp
mainwindow.cpp
mainwindow.h
callout.cpp
callout.h
chartview.cpp
chartview.h
view.cpp
view.h
)
else()
add_executable(
Thread_data_viewer
main.cpp
mainwindow.cpp
mainwindow.h
callout.cpp
callout.h
chartview.cpp
chartview.h
view.cpp
view.h
)
endif()
target_link_libraries(
Thread_data_viewer
PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Charts
Qt${QT_VERSION_MAJOR}::Concurrent)
note:
- no TRANSLATIONS
i am still working on it, so that it can be applied for qet.
this is going to be difficult.
todo find_package of xml svg network sql printsupport KWidgetsAddons KCoreAddons
see https://github.com/qelectrotech/qelectr … or/pull/98