summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-02-14 19:33:08 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-19 14:47:36 +0000
commita1ba96ab54c7e0bc3ffc956d49cbd9eadb1ba79f (patch)
tree80243448f08833b321e27be3e7b576f9154d59de /examples
parentf5d54ece60fdc38e3e4b9a380f164ba872112f80 (diff)
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 Change-Id: If8bf84b498189fa681cfe5128bc8566026dabec0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 1b640ab2aa150adfc04ad378cd1aadce7054a56a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/assistant/CMakeLists.txt2
-rw-r--r--examples/assistant/remotecontrol/CMakeLists.txt14
-rw-r--r--examples/assistant/simpletextviewer/CMakeLists.txt16
-rw-r--r--examples/designer/CMakeLists.txt3
-rw-r--r--examples/designer/calculatorbuilder/CMakeLists.txt15
-rw-r--r--examples/designer/calculatorform/CMakeLists.txt13
-rw-r--r--examples/designer/containerextension/CMakeLists.txt19
-rw-r--r--examples/designer/customwidgetplugin/CMakeLists.txt19
-rw-r--r--examples/designer/taskmenuextension/CMakeLists.txt19
-rw-r--r--examples/designer/worldtimeclockbuilder/CMakeLists.txt13
-rw-r--r--examples/designer/worldtimeclockplugin/CMakeLists.txt19
-rw-r--r--examples/help/CMakeLists.txt2
-rw-r--r--examples/help/contextsensitivehelp/CMakeLists.txt12
-rw-r--r--examples/linguist/CMakeLists.txt2
-rw-r--r--examples/linguist/arrowpad/CMakeLists.txt15
-rw-r--r--examples/linguist/hellotr/CMakeLists.txt15
-rw-r--r--examples/linguist/trollprint/CMakeLists.txt15
-rw-r--r--examples/uitools/CMakeLists.txt2
-rw-r--r--examples/uitools/multipleinheritance/CMakeLists.txt13
-rw-r--r--examples/uitools/textfinder/CMakeLists.txt15
21 files changed, 68 insertions, 178 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 9407f84b5..54460f896 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,8 +1,5 @@
-# Generated from examples.pro.
-
qt_examples_build_begin(EXTERNAL_BUILD)
-
qt_exclude_tool_directories_from_default_target(
assistant
)
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
diff --git a/examples/designer/CMakeLists.txt b/examples/designer/CMakeLists.txt
index e41521d3c..0f4a7de51 100644
--- a/examples/designer/CMakeLists.txt
+++ b/examples/designer/CMakeLists.txt
@@ -1,6 +1,3 @@
-# Generated from designer.pro.
-
-
qt_exclude_tool_directories_from_default_target(
containerextension
taskmenuextension
diff --git a/examples/designer/calculatorbuilder/CMakeLists.txt b/examples/designer/calculatorbuilder/CMakeLists.txt
index dc1d9de5b..736d473ca 100644
--- a/examples/designer/calculatorbuilder/CMakeLists.txt
+++ b/examples/designer/calculatorbuilder/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from calculatorbuilder.pro.
-
cmake_minimum_required(VERSION 3.16)
project(calculatorbuilder 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}/designer/calculatorbuilder")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiTools)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiTools Widgets)
qt_add_executable(calculatorbuilder
calculatorform.cpp calculatorform.h
main.cpp
)
+
set_target_properties(calculatorbuilder PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(calculatorbuilder PUBLIC
Qt::Core
Qt::Gui
@@ -35,7 +29,6 @@ target_link_libraries(calculatorbuilder PUBLIC
Qt::Widgets
)
-
# Resources:
set(calculatorbuilder_resource_files
"calculatorform.ui"
diff --git a/examples/designer/calculatorform/CMakeLists.txt b/examples/designer/calculatorform/CMakeLists.txt
index 7034d6b17..d68752b6a 100644
--- a/examples/designer/calculatorform/CMakeLists.txt
+++ b/examples/designer/calculatorform/CMakeLists.txt
@@ -1,32 +1,27 @@
-# Generated from calculatorform.pro.
-
cmake_minimum_required(VERSION 3.16)
project(calculatorform 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}/designer/calculatorform")
-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(calculatorform
calculatorform.cpp calculatorform.h calculatorform.ui
main.cpp
)
+
set_target_properties(calculatorform PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(calculatorform PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/designer/containerextension/CMakeLists.txt b/examples/designer/containerextension/CMakeLists.txt
index efc0e8ef7..f96695c9c 100644
--- a/examples/designer/containerextension/CMakeLists.txt
+++ b/examples/designer/containerextension/CMakeLists.txt
@@ -1,26 +1,16 @@
-# Generated from containerextension.pro.
-
cmake_minimum_required(VERSION 3.16)
project(containerextension 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}/plugins/designer") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
+find_package(Qt6 REQUIRED COMPONENTS Core Designer Gui Widgets)
-# special case begin
qt_add_plugin(containerextension)
target_sources(containerextension PRIVATE
multipagewidget.cpp multipagewidget.h
@@ -28,11 +18,12 @@ target_sources(containerextension PRIVATE
multipagewidgetextensionfactory.cpp multipagewidgetextensionfactory.h
multipagewidgetplugin.cpp multipagewidgetplugin.h
)
-# special case end
+
set_target_properties(containerextension PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(containerextension PUBLIC
Qt::Core
Qt::Designer
diff --git a/examples/designer/customwidgetplugin/CMakeLists.txt b/examples/designer/customwidgetplugin/CMakeLists.txt
index ca2b0448b..007a5242c 100644
--- a/examples/designer/customwidgetplugin/CMakeLists.txt
+++ b/examples/designer/customwidgetplugin/CMakeLists.txt
@@ -1,36 +1,27 @@
-# Generated from customwidgetplugin.pro.
-
cmake_minimum_required(VERSION 3.16)
project(customwidgetplugin 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}/plugins/designer") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiPlugin Widgets)
-# special case begin
qt_add_plugin(customwidgetplugin)
target_sources(customwidgetplugin PRIVATE
analogclock.cpp analogclock.h
customwidgetplugin.cpp customwidgetplugin.h
)
-# special case end
+
set_target_properties(customwidgetplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(customwidgetplugin PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/designer/taskmenuextension/CMakeLists.txt b/examples/designer/taskmenuextension/CMakeLists.txt
index eb565d600..9c3c8e1c2 100644
--- a/examples/designer/taskmenuextension/CMakeLists.txt
+++ b/examples/designer/taskmenuextension/CMakeLists.txt
@@ -1,26 +1,16 @@
-# Generated from taskmenuextension.pro.
-
cmake_minimum_required(VERSION 3.16)
project(taskmenuextension 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}/plugins/designer") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
+find_package(Qt6 REQUIRED COMPONENTS Core Designer Gui Widgets)
-# special case begin
qt_add_plugin(taskmenuextension)
target_sources(taskmenuextension PRIVATE
tictactoe.cpp tictactoe.h
@@ -28,11 +18,12 @@ target_sources(taskmenuextension PRIVATE
tictactoeplugin.cpp tictactoeplugin.h
tictactoetaskmenu.cpp tictactoetaskmenu.h
)
-# special case end
+
set_target_properties(taskmenuextension PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(taskmenuextension PUBLIC
Qt::Core
Qt::Designer
diff --git a/examples/designer/worldtimeclockbuilder/CMakeLists.txt b/examples/designer/worldtimeclockbuilder/CMakeLists.txt
index b435dba0d..cbacb3a9e 100644
--- a/examples/designer/worldtimeclockbuilder/CMakeLists.txt
+++ b/examples/designer/worldtimeclockbuilder/CMakeLists.txt
@@ -1,32 +1,28 @@
-# Generated from worldtimeclockbuilder.pro.
-
cmake_minimum_required(VERSION 3.16)
project(worldtimeclockbuilder 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}/designer/worldtimeclockbuilder")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiTools)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiTools Widgets)
qt_add_executable(worldtimeclockbuilder
main.cpp
)
+
set_target_properties(worldtimeclockbuilder PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(worldtimeclockbuilder PUBLIC
Qt::Core
Qt::Gui
@@ -34,7 +30,6 @@ target_link_libraries(worldtimeclockbuilder PUBLIC
Qt::Widgets
)
-
# Resources:
set(worldtimeclockbuilder_resource_files
"form.ui"
diff --git a/examples/designer/worldtimeclockplugin/CMakeLists.txt b/examples/designer/worldtimeclockplugin/CMakeLists.txt
index 3cecd4b6d..dea05a38e 100644
--- a/examples/designer/worldtimeclockplugin/CMakeLists.txt
+++ b/examples/designer/worldtimeclockplugin/CMakeLists.txt
@@ -1,36 +1,27 @@
-# Generated from worldtimeclockplugin.pro.
-
cmake_minimum_required(VERSION 3.16)
project(worldtimeclockplugin 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}/plugins/designer") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiPlugin Widgets)
-# special case begin
qt_add_plugin(worldtimeclockplugin)
target_sources(worldtimeclockplugin PRIVATE
worldtimeclock.cpp worldtimeclock.h
worldtimeclockplugin.cpp worldtimeclockplugin.h
)
-# special case end
+
set_target_properties(worldtimeclockplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(worldtimeclockplugin PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/help/CMakeLists.txt b/examples/help/CMakeLists.txt
index d6ed06162..d51ae1d54 100644
--- a/examples/help/CMakeLists.txt
+++ b/examples/help/CMakeLists.txt
@@ -1,3 +1 @@
-# Generated from help.pro.
-
qt_internal_add_example(contextsensitivehelp)
diff --git a/examples/help/contextsensitivehelp/CMakeLists.txt b/examples/help/contextsensitivehelp/CMakeLists.txt
index f1b8808f0..1eebae222 100644
--- a/examples/help/contextsensitivehelp/CMakeLists.txt
+++ b/examples/help/contextsensitivehelp/CMakeLists.txt
@@ -1,34 +1,30 @@
-# Generated from contextsensitivehelp.pro.
-
cmake_minimum_required(VERSION 3.16)
project(contextsensitivehelp 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}/help/contextsensitivehelp")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Help)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Help Widgets)
qt_add_executable(contextsensitivehelp
helpbrowser.cpp helpbrowser.h
main.cpp
wateringconfigdialog.cpp wateringconfigdialog.h wateringconfigdialog.ui
)
+
set_target_properties(contextsensitivehelp PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(contextsensitivehelp PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/CMakeLists.txt b/examples/linguist/CMakeLists.txt
index 87865fb3a..433323c23 100644
--- a/examples/linguist/CMakeLists.txt
+++ b/examples/linguist/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from linguist.pro.
-
qt_internal_add_example(arrowpad)
qt_internal_add_example(hellotr)
qt_internal_add_example(trollprint)
diff --git a/examples/linguist/arrowpad/CMakeLists.txt b/examples/linguist/arrowpad/CMakeLists.txt
index 882136b95..1c9ced988 100644
--- a/examples/linguist/arrowpad/CMakeLists.txt
+++ b/examples/linguist/arrowpad/CMakeLists.txt
@@ -1,23 +1,16 @@
-# Generated from arrowpad.pro.
-
cmake_minimum_required(VERSION 3.16)
project(arrowpad 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}/linguist/arrowpad")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
#! [0]
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
#! [0]
@@ -27,6 +20,7 @@ qt_add_executable(arrowpad
main.cpp
mainwindow.cpp mainwindow.h
)
+
#! [1]
qt6_add_translations(arrowpad
TS_FILES arrowpad_fr.ts arrowpad_nl.ts
@@ -37,6 +31,7 @@ set_target_properties(arrowpad PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(arrowpad PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/hellotr/CMakeLists.txt b/examples/linguist/hellotr/CMakeLists.txt
index 9f9fb085d..eee4edadd 100644
--- a/examples/linguist/hellotr/CMakeLists.txt
+++ b/examples/linguist/hellotr/CMakeLists.txt
@@ -1,23 +1,16 @@
-# Generated from hellotr.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellotr 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}/linguist/hellotr")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
#! [0]
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
#! [0]
@@ -25,6 +18,7 @@ find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
qt_add_executable(hellotr
main.cpp
)
+
#! [1]
qt6_add_translations(hellotr
TS_FILES hellotr_la.ts
@@ -35,6 +29,7 @@ set_target_properties(hellotr PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellotr PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/trollprint/CMakeLists.txt b/examples/linguist/trollprint/CMakeLists.txt
index 42d26a75d..48119eeb2 100644
--- a/examples/linguist/trollprint/CMakeLists.txt
+++ b/examples/linguist/trollprint/CMakeLists.txt
@@ -1,23 +1,16 @@
-# Generated from trollprint.pro.
-
cmake_minimum_required(VERSION 3.16)
project(trollprint 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}/linguist/trollprint")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
qt_add_executable(trollprint
@@ -25,6 +18,7 @@ qt_add_executable(trollprint
mainwindow.cpp mainwindow.h
printpanel.cpp printpanel.h
)
+
qt6_add_translations(trollprint
TS_FILES trollprint_pt.ts
QM_FILES_OUTPUT_VARIABLE qm_files)
@@ -34,6 +28,7 @@ set_target_properties(trollprint PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(trollprint PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/uitools/CMakeLists.txt b/examples/uitools/CMakeLists.txt
index 7e4d326c8..4720af772 100644
--- a/examples/uitools/CMakeLists.txt
+++ b/examples/uitools/CMakeLists.txt
@@ -1,4 +1,2 @@
-# Generated from uitools.pro.
-
qt_internal_add_example(multipleinheritance)
qt_internal_add_example(textfinder)
diff --git a/examples/uitools/multipleinheritance/CMakeLists.txt b/examples/uitools/multipleinheritance/CMakeLists.txt
index 59c240144..d1e394484 100644
--- a/examples/uitools/multipleinheritance/CMakeLists.txt
+++ b/examples/uitools/multipleinheritance/CMakeLists.txt
@@ -1,32 +1,27 @@
-# Generated from multipleinheritance.pro.
-
cmake_minimum_required(VERSION 3.16)
project(multipleinheritance 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}/uitools/multipleinheritance")
-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(multipleinheritance
calculatorform.cpp calculatorform.h calculatorform.ui
main.cpp
)
+
set_target_properties(multipleinheritance PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(multipleinheritance PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/uitools/textfinder/CMakeLists.txt b/examples/uitools/textfinder/CMakeLists.txt
index 96911c675..17c6a9522 100644
--- a/examples/uitools/textfinder/CMakeLists.txt
+++ b/examples/uitools/textfinder/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from textfinder.pro.
-
cmake_minimum_required(VERSION 3.16)
project(textfinder 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}/uitools/textfinder")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiTools)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiTools Widgets)
qt_add_executable(textfinder
main.cpp
textfinder.cpp textfinder.h
)
+
set_target_properties(textfinder PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(textfinder PUBLIC
Qt::Core
Qt::Gui
@@ -35,7 +29,6 @@ target_link_libraries(textfinder PUBLIC
Qt::Widgets
)
-
# Resources:
set(textfinder_resource_files
"forms/input.txt"