summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-02-14 19:15:29 +0100
committerKai Köhne <kai.koehne@qt.io>2022-02-21 10:24:46 +0100
commite318718f9ddd12f9328df249ae1b8f73b33f431c (patch)
tree2129c3eebf1d09d39af2a9be1b7aff89137d16fa /examples
parent041427535851f61e6db845ada3ea771eb89ac63b (diff)
Improve examples CMakeLists.txt
- Remove "# generated from xyz.pro" comment from pro2cmake - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: Ie7432614f6060152eb3278724877670059c71495 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/sensors/accelbubble/CMakeLists.txt9
-rw-r--r--examples/sensors/grue/CMakeLists.txt7
-rw-r--r--examples/sensors/grue/console_app/CMakeLists.txt11
-rw-r--r--examples/sensors/grue/plugin/CMakeLists.txt11
-rw-r--r--examples/sensors/maze/CMakeLists.txt10
-rw-r--r--examples/sensors/qmlqtsensors/CMakeLists.txt11
-rw-r--r--examples/sensors/qmlsensorgestures/CMakeLists.txt9
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt8
-rw-r--r--examples/sensors/sensor_explorer/CMakeLists.txt9
-rw-r--r--examples/sensors/sensorgestures/CMakeLists.txt9
-rw-r--r--examples/sensors/sensorsshowcase/CMakeLists.txt9
-rw-r--r--examples/sensors/shakeit/CMakeLists.txt11
12 files changed, 37 insertions, 77 deletions
diff --git a/examples/sensors/accelbubble/CMakeLists.txt b/examples/sensors/accelbubble/CMakeLists.txt
index 2709e7b2..83cc07cf 100644
--- a/examples/sensors/accelbubble/CMakeLists.txt
+++ b/examples/sensors/accelbubble/CMakeLists.txt
@@ -1,23 +1,20 @@
cmake_minimum_required(VERSION 3.16)
project(accelbubble LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/accelbubble")
-find_package(Qt6 COMPONENTS Core Gui Quick Sensors Svg Xml)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors Svg Xml)
qt_add_executable(accelbubble
main.cpp
)
+
set_target_properties(accelbubble PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
diff --git a/examples/sensors/grue/CMakeLists.txt b/examples/sensors/grue/CMakeLists.txt
index 54ef3e3e..8bdc8d03 100644
--- a/examples/sensors/grue/CMakeLists.txt
+++ b/examples/sensors/grue/CMakeLists.txt
@@ -1,11 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(grue_app LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
@@ -13,11 +9,12 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue")
-find_package(Qt6 COMPONENTS Quick Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Quick Sensors)
qt_add_executable(grue_app
main.cpp qmlgruesensor.h qmlgruesensor.cpp
)
+
set_target_properties(grue_app PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
diff --git a/examples/sensors/grue/console_app/CMakeLists.txt b/examples/sensors/grue/console_app/CMakeLists.txt
index 0e48b57e..26c22b65 100644
--- a/examples/sensors/grue/console_app/CMakeLists.txt
+++ b/examples/sensors/grue/console_app/CMakeLists.txt
@@ -1,25 +1,20 @@
-# Generated from console_app.pro.
-
cmake_minimum_required(VERSION 3.16)
project(detect_grue LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue")
-find_package(Qt6 COMPONENTS Core Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Core Sensors)
qt_add_executable(detect_grue
main.cpp
)
+
set_target_properties(detect_grue PROPERTIES
WIN32_EXECUTABLE FALSE
MACOSX_BUNDLE FALSE
diff --git a/examples/sensors/grue/plugin/CMakeLists.txt b/examples/sensors/grue/plugin/CMakeLists.txt
index 9a6325ac..10e554fe 100644
--- a/examples/sensors/grue/plugin/CMakeLists.txt
+++ b/examples/sensors/grue/plugin/CMakeLists.txt
@@ -1,22 +1,15 @@
-# Generated from plugin.pro.
-
cmake_minimum_required(VERSION 3.16)
project(qtsensors_grue LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue/sensors")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Core Sensors)
qt_add_plugin(qtsensors_grue
PLUGIN_TYPE sensors
diff --git a/examples/sensors/maze/CMakeLists.txt b/examples/sensors/maze/CMakeLists.txt
index 956047d0..c713d317 100644
--- a/examples/sensors/maze/CMakeLists.txt
+++ b/examples/sensors/maze/CMakeLists.txt
@@ -1,27 +1,25 @@
cmake_minimum_required(VERSION 3.16)
project(maze LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/maze")
-find_package(Qt6 COMPONENTS Core Gui Quick Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors)
qt_add_executable(maze
main.cpp
)
+
set_target_properties(maze PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
if(ANDROID)
set_property(TARGET maze PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/android)
diff --git a/examples/sensors/qmlqtsensors/CMakeLists.txt b/examples/sensors/qmlqtsensors/CMakeLists.txt
index dba938a4..32d5c1b4 100644
--- a/examples/sensors/qmlqtsensors/CMakeLists.txt
+++ b/examples/sensors/qmlqtsensors/CMakeLists.txt
@@ -1,34 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(qmlqtsensors LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlqtsensors")
-find_package(Qt6 COMPONENTS Core Gui Quick)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick)
qt_add_executable(qmlqtsensors
main.cpp
)
+
set_target_properties(qmlqtsensors PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(qmlqtsensors PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
)
-
# Resources:
set(qmlqtsensors_resource_files
"components/ApplicationWindow.qml"
diff --git a/examples/sensors/qmlsensorgestures/CMakeLists.txt b/examples/sensors/qmlsensorgestures/CMakeLists.txt
index 224e1bdf..f9c35206 100644
--- a/examples/sensors/qmlsensorgestures/CMakeLists.txt
+++ b/examples/sensors/qmlsensorgestures/CMakeLists.txt
@@ -1,19 +1,15 @@
cmake_minimum_required(VERSION 3.16)
project(qmlsensorgestures LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlsensorgestures")
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 REQUIRED COMPONENTS Quick)
qt_add_executable(qmlsensorgestures
main.cpp
@@ -49,4 +45,5 @@ install(TARGETS qmlsensorgestures
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
add_subdirectory(plugin)
diff --git a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
index 10bd98d6..abc405b2 100644
--- a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
+++ b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
@@ -1,19 +1,15 @@
cmake_minimum_required(VERSION 3.16)
project(qtsensorgestures_counterplugin LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
-find_package(Qt6 COMPONENTS Core Gui Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sensors)
qt_add_plugin(qtsensorgestures_counterplugin)
diff --git a/examples/sensors/sensor_explorer/CMakeLists.txt b/examples/sensors/sensor_explorer/CMakeLists.txt
index 9f37faba..db0d95dc 100644
--- a/examples/sensors/sensor_explorer/CMakeLists.txt
+++ b/examples/sensors/sensor_explorer/CMakeLists.txt
@@ -1,19 +1,15 @@
cmake_minimum_required(VERSION 3.16)
project(sensor_explorer LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensor_explorer")
-find_package(Qt6 COMPONENTS Qml Quick Sensors)
+find_package(Qt6 REQUIRED COMPONENTS Qml Quick Sensors)
qt_add_executable(sensor_explorer
main.cpp
@@ -24,6 +20,7 @@ set_target_properties(sensor_explorer PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(sensor_explorer PUBLIC
Qt::Qml
Qt::Quick
diff --git a/examples/sensors/sensorgestures/CMakeLists.txt b/examples/sensors/sensorgestures/CMakeLists.txt
index 2aff30d6..3a56bbc1 100644
--- a/examples/sensors/sensorgestures/CMakeLists.txt
+++ b/examples/sensors/sensorgestures/CMakeLists.txt
@@ -1,28 +1,27 @@
cmake_minimum_required(VERSION 3.16)
project(gesture LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensorgestures")
-find_package(Qt6 COMPONENTS Core Gui Sensors Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sensors Widgets)
qt_add_executable(gesture
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
)
+
set_target_properties(gesture PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(gesture PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sensors/sensorsshowcase/CMakeLists.txt b/examples/sensors/sensorsshowcase/CMakeLists.txt
index 411630d7..adce6612 100644
--- a/examples/sensors/sensorsshowcase/CMakeLists.txt
+++ b/examples/sensors/sensorsshowcase/CMakeLists.txt
@@ -1,23 +1,20 @@
cmake_minimum_required(VERSION 3.16)
project(sensorsshowcase LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensorsshowcase")
-find_package(Qt6 COMPONENTS Core Gui Quick Sensors Svg)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors Svg)
qt_add_executable(sensorsshowcase
main.cpp
)
+
set_target_properties(sensorsshowcase PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
diff --git a/examples/sensors/shakeit/CMakeLists.txt b/examples/sensors/shakeit/CMakeLists.txt
index f731ee31..769c0f98 100644
--- a/examples/sensors/shakeit/CMakeLists.txt
+++ b/examples/sensors/shakeit/CMakeLists.txt
@@ -1,34 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(shakeit LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/shakeit")
-find_package(Qt6 COMPONENTS Core Gui Quick)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick)
qt_add_executable(shakeit
main.cpp
)
+
set_target_properties(shakeit PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(shakeit PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
)
-
# Resources:
set(shakeit_resource_files
"audio/loopy2a_mono.wav"