aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-02-14 19:37:50 +0100
committerKai Koehne <kai.koehne@qt.io>2022-02-15 07:53:00 +0000
commit53527909f424ba40e6e45e6ca474bb02446235d8 (patch)
tree2fd72af0797f77ad1826559060073e7765a0ad3a
parent1b65b1de998bb8664c0074bc17bb3c9b73d29a29 (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: I295f8b5f30e995e068244274f39e089b9a4ce872 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/virtualkeyboard/CMakeLists.txt2
-rw-r--r--examples/virtualkeyboard/basic/CMakeLists.txt24
3 files changed, 8 insertions, 20 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 7e68b02c..53719861 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from examples.pro.
-
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(virtualkeyboard)
diff --git a/examples/virtualkeyboard/CMakeLists.txt b/examples/virtualkeyboard/CMakeLists.txt
index 507f1186..e04da6ad 100644
--- a/examples/virtualkeyboard/CMakeLists.txt
+++ b/examples/virtualkeyboard/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from virtualkeyboard.pro.
-
if(TARGET Qt::QuickControls2)
qt_internal_add_example(basic)
endif()
diff --git a/examples/virtualkeyboard/basic/CMakeLists.txt b/examples/virtualkeyboard/basic/CMakeLists.txt
index 1b3782d7..8be9b50d 100644
--- a/examples/virtualkeyboard/basic/CMakeLists.txt
+++ b/examples/virtualkeyboard/basic/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from basic.pro.
-
cmake_minimum_required(VERSION 3.16)
project(basic 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}/virtualkeyboard/basic")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_add_executable(basic
main.cpp
)
+
set_target_properties(basic PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(basic PUBLIC
Qt::Core
Qt::Gui
@@ -34,7 +27,6 @@ target_link_libraries(basic PUBLIC
Qt::Quick
)
-
# Resources:
set(demo_resource_files
"Basic.qml"
@@ -55,8 +47,8 @@ qt6_add_resources(basic "demo"
${demo_resource_files}
)
-if(QT_FEATURE_static) # special case
- find_package(Qt6 COMPONENTS Svg) # special case
+if(QT_FEATURE_static)
+ find_package(Qt6 REQUIRED COMPONENTS Svg)
target_link_libraries(basic PUBLIC
Qt::Svg
)
@@ -64,13 +56,13 @@ endif()
if(NOT QT_FEATURE_vkb_desktop)
target_compile_definitions(basic PUBLIC
- MAIN_QML="basic-b2qt.qml" # special case
+ MAIN_QML="basic-b2qt.qml"
)
endif()
if(QT_FEATURE_vkb_desktop)
target_compile_definitions(basic PUBLIC
- MAIN_QML="Basic.qml" # special case
+ MAIN_QML="Basic.qml"
)
endif()