summaryrefslogtreecommitdiff
path: root/examples/assistant
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-02-14 19:33:08 +0100
committerKai Köhne <kai.koehne@qt.io>2022-02-19 08:56:49 +0100
commit1b640ab2aa150adfc04ad378cd1aadce7054a56a (patch)
treec95637c448cd1975876c29389c018265a5984d97 /examples/assistant
parentbf18e7956ddb0f99f0358f67cfe043553babbdad (diff)
downloadqttools-1b640ab2aa150adfc04ad378cd1aadce7054a56a.tar.gz
Improve examples CMakeLists.txt
- Remove # generated from xyz.pro comment from pro2cmake - Remove "# special case" markers for 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, when unnecessary - 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: If8bf84b498189fa681cfe5128bc8566026dabec0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'examples/assistant')
-rw-r--r--examples/assistant/CMakeLists.txt2
-rw-r--r--examples/assistant/remotecontrol/CMakeLists.txt14
-rw-r--r--examples/assistant/simpletextviewer/CMakeLists.txt16
3 files changed, 9 insertions, 23 deletions
diff --git a/examples/assistant/CMakeLists.txt b/examples/assistant/CMakeLists.txt
index f9064128d..3d8c97dbb 100644
--- a/examples/assistant/CMakeLists.txt
+++ b/examples/assistant/CMakeLists.txt
@@ -1,4 +1,2 @@
-# Generated from assistant.pro.
-
qt_internal_add_example(simpletextviewer)
qt_internal_add_example(remotecontrol)
diff --git a/examples/assistant/remotecontrol/CMakeLists.txt b/examples/assistant/remotecontrol/CMakeLists.txt
index c8b3b5c91..9d5b6523c 100644
--- a/examples/assistant/remotecontrol/CMakeLists.txt
+++ b/examples/assistant/remotecontrol/CMakeLists.txt
@@ -1,39 +1,33 @@
-# Generated from remotecontrol.pro.
-
cmake_minimum_required(VERSION 3.16)
project(remotecontrol 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}/assistant/remotecontrol")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(remotecontrol
main.cpp
remotecontrol.cpp remotecontrol.h remotecontrol.ui
)
+
set_target_properties(remotecontrol PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(remotecontrol PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(remotecontrol_resource_files
"enter.png"
diff --git a/examples/assistant/simpletextviewer/CMakeLists.txt b/examples/assistant/simpletextviewer/CMakeLists.txt
index fb4f100be..b6b9fcc8e 100644
--- a/examples/assistant/simpletextviewer/CMakeLists.txt
+++ b/examples/assistant/simpletextviewer/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from simpletextviewer.pro.
-
cmake_minimum_required(VERSION 3.16)
project(simpletextviewer 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}/assistant/simpletextviewer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(simpletextviewer
assistant.cpp assistant.h
@@ -26,12 +18,14 @@ qt_add_executable(simpletextviewer
mainwindow.cpp mainwindow.h
textedit.cpp textedit.h
)
+
set_target_properties(simpletextviewer PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_compile_definitions(simpletextviewer PUBLIC
- SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" # special case
+ SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/"
)
target_link_libraries(simpletextviewer PUBLIC