summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-02-08 10:39:19 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-02-10 11:43:49 +0100
commitfb6b5b5109a19e50b03734619ba3f9716b56b2d2 (patch)
treeacb7947f43cfd005e1d4dc3a76ac18519aa8accd
parent39a5f9b5e22ba711ce88bcbbbb1ba29d86d6d0e0 (diff)
downloadqtserialport-fb6b5b5109a19e50b03734619ba3f9716b56b2d2.tar.gz
SerialPort examples: update CMakeLists.txt
* Use qt_standard_project_setup() instead of enabling AUTOMOC and AUTOUIC manually * Use versionless CMake functions * Update check for Qt::Widgets when selecting the examples to build Task-number: QTBUG-108868 Pick-to: 6.5 Change-Id: I71962ae99ed0586a482282df15a1a1f25d273c35 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--examples/serialport/CMakeLists.txt2
-rw-r--r--examples/serialport/blockingreceiver/CMakeLists.txt4
-rw-r--r--examples/serialport/blockingsender/CMakeLists.txt4
-rw-r--r--examples/serialport/receiver/CMakeLists.txt4
-rw-r--r--examples/serialport/sender/CMakeLists.txt4
-rw-r--r--examples/serialport/terminal/CMakeLists.txt7
6 files changed, 12 insertions, 13 deletions
diff --git a/examples/serialport/CMakeLists.txt b/examples/serialport/CMakeLists.txt
index 24c6175..a771a68 100644
--- a/examples/serialport/CMakeLists.txt
+++ b/examples/serialport/CMakeLists.txt
@@ -3,7 +3,7 @@
qt_internal_add_example(creaderasync)
qt_internal_add_example(cwriterasync)
-if((((NOT QT.widgets.name_ISEMPTY))))
+if(TARGET Qt::Widgets)
qt_internal_add_example(terminal)
qt_internal_add_example(blockingsender)
qt_internal_add_example(blockingreceiver)
diff --git a/examples/serialport/blockingreceiver/CMakeLists.txt b/examples/serialport/blockingreceiver/CMakeLists.txt
index e835de8..b2db3fe 100644
--- a/examples/serialport/blockingreceiver/CMakeLists.txt
+++ b/examples/serialport/blockingreceiver/CMakeLists.txt
@@ -4,8 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(blockingreceiver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialport/blockingreceiver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui SerialPort Widgets)
+qt_standard_project_setup()
+
qt_add_executable(blockingreceiver
dialog.cpp dialog.h
main.cpp
diff --git a/examples/serialport/blockingsender/CMakeLists.txt b/examples/serialport/blockingsender/CMakeLists.txt
index 265a728..d982aa4 100644
--- a/examples/serialport/blockingsender/CMakeLists.txt
+++ b/examples/serialport/blockingsender/CMakeLists.txt
@@ -4,8 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(blockingsender LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialport/blockingsender")
find_package(Qt6 REQUIRED COMPONENTS Core Gui SerialPort Widgets)
+qt_standard_project_setup()
+
qt_add_executable(blockingsender
dialog.cpp dialog.h
main.cpp
diff --git a/examples/serialport/receiver/CMakeLists.txt b/examples/serialport/receiver/CMakeLists.txt
index 01fe292..f929a46 100644
--- a/examples/serialport/receiver/CMakeLists.txt
+++ b/examples/serialport/receiver/CMakeLists.txt
@@ -4,8 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(receiver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialport/receiver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui SerialPort Widgets)
+qt_standard_project_setup()
+
qt_add_executable(receiver
dialog.cpp dialog.h
main.cpp
diff --git a/examples/serialport/sender/CMakeLists.txt b/examples/serialport/sender/CMakeLists.txt
index 58cc8f8..2fa11cb 100644
--- a/examples/serialport/sender/CMakeLists.txt
+++ b/examples/serialport/sender/CMakeLists.txt
@@ -4,8 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(sender LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialport/sender")
find_package(Qt6 REQUIRED COMPONENTS Core Gui SerialPort Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sender
dialog.cpp dialog.h
main.cpp
diff --git a/examples/serialport/terminal/CMakeLists.txt b/examples/serialport/terminal/CMakeLists.txt
index 4a5a3d4..e430780 100644
--- a/examples/serialport/terminal/CMakeLists.txt
+++ b/examples/serialport/terminal/CMakeLists.txt
@@ -4,9 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(terminal LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialport/terminal")
find_package(Qt6 REQUIRED COMPONENTS Core Gui SerialPort Widgets)
+qt_standard_project_setup()
+
qt_add_executable(terminal
console.cpp console.h
main.cpp
@@ -43,7 +42,7 @@ set(terminal_resource_files
"images/settings.png"
)
-qt6_add_resources(terminal "terminal"
+qt_add_resources(terminal "terminal"
PREFIX
"/"
FILES