diff options
author | Oliver Eftevaag <[email protected]> | 2023-01-11 09:38:15 +0100 |
---|---|---|
committer | Oliver Eftevaag <[email protected]> | 2023-01-16 16:16:47 +0100 |
commit | 7409c217e8691beae5cd195fc8a0e3479de1db77 (patch) | |
tree | efc78a981321468cf0f698c67005529d44ea2978 | |
parent | 7b0b09d87c36dfc67f0488d1ad87d720f721dea4 (diff) |
Quick examples: Modernize cmake files according to our guidelines
The following changes are made to the CMakeLists.txt files in all
quick examples:
- Use PRIVATE linkage when possible.
- Use qt_standard_project_setup()
- Set WIN32 and MACOSX_BUNDLE in qt_add_executable() instead of
set_target_properties()
Pick-to: 6.5
Change-Id: I18217585aec56794b327f103d6959879df59d68a
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
45 files changed, 170 insertions, 248 deletions
diff --git a/examples/quick/animation/CMakeLists.txt b/examples/quick/animation/CMakeLists.txt index 877a30be60..52fa6c0f44 100644 --- a/examples/quick/animation/CMakeLists.txt +++ b/examples/quick/animation/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(animation LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/animation") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(animationexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(animationexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(animationexample PUBLIC +target_link_libraries(animationexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/canvas/CMakeLists.txt b/examples/quick/canvas/CMakeLists.txt index 43ccac716f..3af5dd355e 100644 --- a/examples/quick/canvas/CMakeLists.txt +++ b/examples/quick/canvas/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(canvas LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/canvas") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(canvasexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(canvasexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(canvasexample PUBLIC +target_link_libraries(canvasexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/delegatechooser/CMakeLists.txt b/examples/quick/delegatechooser/CMakeLists.txt index b3e00c59a8..6b624bd0e6 100644 --- a/examples/quick/delegatechooser/CMakeLists.txt +++ b/examples/quick/delegatechooser/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(delegatechooser LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,11 +12,13 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/delegatechooser") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(delegatechooserexample WIN32 MACOSX_BUNDLE main.cpp) -target_link_libraries(delegatechooserexample PUBLIC +target_link_libraries(delegatechooserexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/draganddrop/CMakeLists.txt b/examples/quick/draganddrop/CMakeLists.txt index a48b5f2cd4..ece49e117a 100644 --- a/examples/quick/draganddrop/CMakeLists.txt +++ b/examples/quick/draganddrop/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(draganddrop 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}/quick/draganddrop") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(draganddropexample @@ -35,7 +35,7 @@ qt_add_qml_module(draganddropexample "views/gridview.qml" ) -target_link_libraries(draganddropexample PUBLIC +target_link_libraries(draganddropexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/embeddedinwidgets/CMakeLists.txt b/examples/quick/embeddedinwidgets/CMakeLists.txt index 95d2647e97..7d9c58cc71 100644 --- a/examples/quick/embeddedinwidgets/CMakeLists.txt +++ b/examples/quick/embeddedinwidgets/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(embeddedinwidgets 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}/quick/embeddedinwidgets") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Widgets) +qt_standard_project_setup() + qt_add_executable(embeddedinwidgetsexample WIN32 MACOSX_BUNDLE main.cpp ) diff --git a/examples/quick/externaldraganddrop/CMakeLists.txt b/examples/quick/externaldraganddrop/CMakeLists.txt index 03d4d38373..fd2b9be5c0 100644 --- a/examples/quick/externaldraganddrop/CMakeLists.txt +++ b/examples/quick/externaldraganddrop/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(externaldraganddrop LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,15 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/externaldraganddrop") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(externaldraganddropexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(externaldraganddropexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - qt_add_qml_module(externaldraganddropexample URI externaldraganddrop VERSION 1.0 @@ -32,7 +29,7 @@ qt_add_qml_module(externaldraganddropexample "externaldraganddrop.qml" ) -target_link_libraries(externaldraganddropexample PUBLIC +target_link_libraries(externaldraganddropexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/imageelements/CMakeLists.txt b/examples/quick/imageelements/CMakeLists.txt index 52e7eb53c1..9011880f65 100644 --- a/examples/quick/imageelements/CMakeLists.txt +++ b/examples/quick/imageelements/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(imageelements 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}/quick/imageelements") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(imageelementsexample @@ -22,7 +22,7 @@ qt_add_executable(imageelementsexample main.cpp ) -target_link_libraries(imageelementsexample PUBLIC +target_link_libraries(imageelementsexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/itemvariablerefreshrate/CMakeLists.txt b/examples/quick/itemvariablerefreshrate/CMakeLists.txt index b8cab61909..3d173e13c5 100644 --- a/examples/quick/itemvariablerefreshrate/CMakeLists.txt +++ b/examples/quick/itemvariablerefreshrate/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(itemvariablerefreshrate LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/itemvariablerefreshrate") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(itemvariablerefreshrateexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(itemvariablerefreshrateexample PROPERTIES - MACOSX_BUNDLE TRUE - WIN32_EXECUTABLE TRUE -) - - -target_link_libraries(itemvariablerefreshrateexample PUBLIC +target_link_libraries(itemvariablerefreshrateexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/keyinteraction/CMakeLists.txt b/examples/quick/keyinteraction/CMakeLists.txt index 87f9352c61..96a47b0e67 100644 --- a/examples/quick/keyinteraction/CMakeLists.txt +++ b/examples/quick/keyinteraction/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(keyinteraction 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}/quick/keyinteraction") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(keyinteractionexample WIN32 MACOSX_BUNDLE main.cpp ) diff --git a/examples/quick/layouts/CMakeLists.txt b/examples/quick/layouts/CMakeLists.txt index 770eb82953..e1aafcf08b 100644 --- a/examples/quick/layouts/CMakeLists.txt +++ b/examples/quick/layouts/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(layouts 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}/quick/layouts") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(layoutsexample WIN32 MACOSX_BUNDLE @@ -28,7 +28,7 @@ qt_add_qml_module(layoutsexample "layouts.qml" ) -target_link_libraries(layoutsexample PUBLIC +target_link_libraries(layoutsexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/localstorage/CMakeLists.txt b/examples/quick/localstorage/CMakeLists.txt index 934be8bf7b..0a6a9ebe51 100644 --- a/examples/quick/localstorage/CMakeLists.txt +++ b/examples/quick/localstorage/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(localstorage 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}/quick/localstorage") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(localstorageexample WIN32 MACOSX_BUNDLE @@ -32,7 +32,7 @@ qt_add_qml_module(localstorageexample "localstorage.qml" ) -target_link_libraries(localstorageexample PUBLIC +target_link_libraries(localstorageexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/models/abstractitemmodel/CMakeLists.txt b/examples/quick/models/abstractitemmodel/CMakeLists.txt index c74262dc8d..b42afcdbf7 100644 --- a/examples/quick/models/abstractitemmodel/CMakeLists.txt +++ b/examples/quick/models/abstractitemmodel/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(abstractitemmodel LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,12 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/abstractitemmodel") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(abstractitemmodelexample WIN32 MACOSX_BUNDLE main.cpp model.cpp model.h ) -target_link_libraries(abstractitemmodelexample PUBLIC +target_link_libraries(abstractitemmodelexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/models/objectlistmodel/CMakeLists.txt b/examples/quick/models/objectlistmodel/CMakeLists.txt index 92105e3473..619bd0da2d 100644 --- a/examples/quick/models/objectlistmodel/CMakeLists.txt +++ b/examples/quick/models/objectlistmodel/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(objectlistmodel LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,12 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/objectlistmodel") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(objectlistmodelexample WIN32 MACOSX_BUNDLE dataobject.cpp dataobject.h main.cpp ) -target_link_libraries(objectlistmodelexample PUBLIC +target_link_libraries(objectlistmodelexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/models/stringlistmodel/CMakeLists.txt b/examples/quick/models/stringlistmodel/CMakeLists.txt index 847c7f7a99..6ca4013d0f 100644 --- a/examples/quick/models/stringlistmodel/CMakeLists.txt +++ b/examples/quick/models/stringlistmodel/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(stringlistmodel LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,11 +12,13 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/stringlistmodel") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(stringlistmodelexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(stringlistmodelexample PUBLIC +target_link_libraries(stringlistmodelexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/mousearea/CMakeLists.txt b/examples/quick/mousearea/CMakeLists.txt index 55a601958b..ff3d7893ba 100644 --- a/examples/quick/mousearea/CMakeLists.txt +++ b/examples/quick/mousearea/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(mousearea LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,11 +12,13 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/mousearea") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(mouseareaexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(mouseareaexample PUBLIC +target_link_libraries(mouseareaexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/multieffect/itemswitcher/CMakeLists.txt b/examples/quick/multieffect/itemswitcher/CMakeLists.txt index 17ccb243d6..e0f5cde712 100644 --- a/examples/quick/multieffect/itemswitcher/CMakeLists.txt +++ b/examples/quick/multieffect/itemswitcher/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(itemswitcher 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}/quick/multieffect/itemswitcher") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(itemswitcherexample WIN32 MACOSX_BUNDLE diff --git a/examples/quick/multieffect/testbed/CMakeLists.txt b/examples/quick/multieffect/testbed/CMakeLists.txt index 7f7fda0082..fd4aa953db 100644 --- a/examples/quick/multieffect/testbed/CMakeLists.txt +++ b/examples/quick/multieffect/testbed/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(testbed 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}/quick/multieffect/testbed") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(testbedexample WIN32 MACOSX_BUNDLE diff --git a/examples/quick/particles/affectors/CMakeLists.txt b/examples/quick/particles/affectors/CMakeLists.txt index 1fe426a6f1..64b40c9acf 100644 --- a/examples/quick/particles/affectors/CMakeLists.txt +++ b/examples/quick/particles/affectors/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(affectors 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}/quick/particles/affectors") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(affectorsexample WIN32 MACOSX_BUNDLE diff --git a/examples/quick/particles/emitters/CMakeLists.txt b/examples/quick/particles/emitters/CMakeLists.txt index 2cabd799c4..7a7b602a80 100644 --- a/examples/quick/particles/emitters/CMakeLists.txt +++ b/examples/quick/particles/emitters/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(emitters LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/emitters") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(emittersexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(emittersexample PUBLIC +target_link_libraries(emittersexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/particles/imageparticle/CMakeLists.txt b/examples/quick/particles/imageparticle/CMakeLists.txt index 45fe858201..a2e576f23b 100644 --- a/examples/quick/particles/imageparticle/CMakeLists.txt +++ b/examples/quick/particles/imageparticle/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(imageparticle LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/imageparticle") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(imageparticleexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(imageparticleexample PUBLIC +target_link_libraries(imageparticleexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/particles/itemparticle/CMakeLists.txt b/examples/quick/particles/itemparticle/CMakeLists.txt index 4f745ae641..03093e85f2 100644 --- a/examples/quick/particles/itemparticle/CMakeLists.txt +++ b/examples/quick/particles/itemparticle/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(itemparticle LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/itemparticle") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(itemparticleexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(itemparticleexample PUBLIC +target_link_libraries(itemparticleexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/particles/system/CMakeLists.txt b/examples/quick/particles/system/CMakeLists.txt index 6eb2cb7e49..5df23081ac 100644 --- a/examples/quick/particles/system/CMakeLists.txt +++ b/examples/quick/particles/system/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(system LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/system") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../../shared" "shared") qt_add_executable(systemexample WIN32 MACOSX_BUNDLE main.cpp ) -target_link_libraries(systemexample PUBLIC +target_link_libraries(systemexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/pointerhandlers/CMakeLists.txt b/examples/quick/pointerhandlers/CMakeLists.txt index 297eac6cde..f24bde7436 100644 --- a/examples/quick/pointerhandlers/CMakeLists.txt +++ b/examples/quick/pointerhandlers/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(pointerhandlers LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,11 +12,13 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/pointerhandlers") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(pointerhandlersexample WIN32 MACOSX_BUNDLE main.cpp) -target_link_libraries(pointerhandlersexample PUBLIC +target_link_libraries(pointerhandlersexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/positioners/CMakeLists.txt b/examples/quick/positioners/CMakeLists.txt index f0c8765120..bda770a2af 100644 --- a/examples/quick/positioners/CMakeLists.txt +++ b/examples/quick/positioners/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(positioners 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}/quick/positioners") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(positionersexample @@ -32,7 +32,7 @@ qt_add_qml_module(positionersexample "positioners.qml" ) -target_link_libraries(positionersexample PUBLIC +target_link_libraries(positionersexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/quick-accessibility/CMakeLists.txt b/examples/quick/quick-accessibility/CMakeLists.txt index af539d5635..1cc2e55526 100644 --- a/examples/quick/quick-accessibility/CMakeLists.txt +++ b/examples/quick/quick-accessibility/CMakeLists.txt @@ -14,16 +14,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quick-accessibility") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + qt_add_executable(quick-accessibility + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(quick-accessibility PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(quick-accessibility PUBLIC +target_link_libraries(quick-accessibility PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt index ae19a82ebc..cb764dc720 100644 --- a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt +++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(qquickwidgetversuswindow_opengl LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,18 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quickwidgets/qquickwidgetve find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickWidgets ShaderTools Widgets) +qt_standard_project_setup() + qt_add_executable(qquickwidgetversuswindow_opengl + WIN32 + MACOSX_BUNDLE fbitem.cpp fbitem.h logo.cpp logo.h main.cpp mainwindow.cpp mainwindow.h ) -set_target_properties(qquickwidgetversuswindow_opengl PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(qquickwidgetversuswindow_opengl PUBLIC +target_link_libraries(qquickwidgetversuswindow_opengl PRIVATE Qt::Core Qt::Gui Qt::Quick diff --git a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt index 58d2d27090..f4df528e79 100644 --- a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt +++ b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(quickwidget LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,16 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quickwidgets/quickwidget") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickWidgets Widgets) +qt_standard_project_setup() + qt_add_executable(quickwidget + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(quickwidget PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(quickwidget PUBLIC +target_link_libraries(quickwidget PRIVATE Qt::Core Qt::Gui Qt::Quick diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt index f21cd271e5..d929d73fe0 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt +++ b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(rendercontrol_opengl LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/rendercontrol/rendercontrol find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Qml Quick) +qt_standard_project_setup() + qt_add_executable(rendercontrol_openglexample WIN32 MACOSX_BUNDLE cuberenderer.cpp cuberenderer.h main.cpp window_singlethreaded.cpp window_singlethreaded.h ) -target_link_libraries(rendercontrol_openglexample PUBLIC +target_link_libraries(rendercontrol_openglexample PRIVATE Qt::Core Qt::Gui Qt::OpenGL diff --git a/examples/quick/righttoleft/CMakeLists.txt b/examples/quick/righttoleft/CMakeLists.txt index 506dc469b9..38138e03aa 100644 --- a/examples/quick/righttoleft/CMakeLists.txt +++ b/examples/quick/righttoleft/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(righttoleft 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}/quick/righttoleft") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(righttoleftexample @@ -33,7 +33,7 @@ qt_add_qml_module(righttoleftexample "textalignment/textalignment.qml" ) -target_link_libraries(righttoleftexample PUBLIC +target_link_libraries(righttoleftexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/customgeometry/CMakeLists.txt b/examples/quick/scenegraph/customgeometry/CMakeLists.txt index 475c263d3a..e1ee8b248f 100644 --- a/examples/quick/scenegraph/customgeometry/CMakeLists.txt +++ b/examples/quick/scenegraph/customgeometry/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(customgeometry_declarative LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/customgeometry") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) -qt_add_executable(customgeometry_declarative +qt_standard_project_setup() + +qt_add_executable(customgeometry_declarative WIN32 MACOSX_BUNDLE beziercurve.cpp beziercurve.h main.cpp ) -set_target_properties(customgeometry_declarative PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(customgeometry_declarative PUBLIC +target_link_libraries(customgeometry_declarative PRIVATE Qt::Core Qt::Gui Qt::Quick diff --git a/examples/quick/scenegraph/custommaterial/CMakeLists.txt b/examples/quick/scenegraph/custommaterial/CMakeLists.txt index 7742d6bf7d..130287b213 100644 --- a/examples/quick/scenegraph/custommaterial/CMakeLists.txt +++ b/examples/quick/scenegraph/custommaterial/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(custommaterial_declarative LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/custommaterial") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick ShaderTools) -qt_add_executable(custommaterial_declarative +qt_standard_project_setup() + +qt_add_executable(custommaterial_declarative WIN32 MACOSX_BUNDLE customitem.cpp customitem.h main.cpp ) -set_target_properties(custommaterial_declarative PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(custommaterial_declarative PUBLIC +target_link_libraries(custommaterial_declarative PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/customrendernode/CMakeLists.txt b/examples/quick/scenegraph/customrendernode/CMakeLists.txt index 0d6776e53a..2e2ba1316c 100644 --- a/examples/quick/scenegraph/customrendernode/CMakeLists.txt +++ b/examples/quick/scenegraph/customrendernode/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(customrendernode LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/customrendernode find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick ShaderTools) -qt_add_executable(customrendernode +qt_standard_project_setup() + +qt_add_executable(customrendernode WIN32 MACOSX_BUNDLE main.cpp customrender.cpp customrender.h ) -set_target_properties(customrendernode PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(customrendernode PUBLIC +target_link_libraries(customrendernode PRIVATE Qt::Core Qt::GuiPrivate Qt::Qml diff --git a/examples/quick/scenegraph/fboitem/CMakeLists.txt b/examples/quick/scenegraph/fboitem/CMakeLists.txt index a79f8c7de8..6c87bc6561 100644 --- a/examples/quick/scenegraph/fboitem/CMakeLists.txt +++ b/examples/quick/scenegraph/fboitem/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(fboitem LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,22 +12,19 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/fboitem") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) -qt_add_executable(fboitem +qt_standard_project_setup() + +qt_add_executable(fboitem WIN32 MACOSX_BUNDLE ../shared/logorenderer.cpp ../shared/logorenderer.h fboinsgrenderer.cpp fboinsgrenderer.h main.cpp ) -set_target_properties(fboitem PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - target_include_directories(fboitem PUBLIC ../shared ) -target_link_libraries(fboitem PUBLIC +target_link_libraries(fboitem PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/graph/CMakeLists.txt b/examples/quick/scenegraph/graph/CMakeLists.txt index a675f31988..fe840c1251 100644 --- a/examples/quick/scenegraph/graph/CMakeLists.txt +++ b/examples/quick/scenegraph/graph/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(graph LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,7 +12,9 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/graph") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) -qt_add_executable(graph +qt_standard_project_setup() + +qt_add_executable(graph WIN32 MACOSX_BUNDLE graph.cpp graph.h gridnode.cpp gridnode.h linenode.cpp linenode.h @@ -23,14 +23,11 @@ qt_add_executable(graph ) set_target_properties(graph PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE - # Prevent name clash with build subdirectory on case-insensitive file systems OUTPUT_NAME graphapp ) -target_link_libraries(graph PUBLIC +target_link_libraries(graph PRIVATE Qt::Core Qt::Gui Qt::Quick diff --git a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt index 17d2655a2a..cac97aff62 100644 --- a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt +++ b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(openglunderqml LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,20 +12,20 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/openglunderqml") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) -qt_add_executable(openglunderqml +qt_standard_project_setup() + +qt_add_executable(openglunderqml WIN32 MACOSX_BUNDLE main.cpp squircle.cpp squircle.h ) set_target_properties(openglunderqml PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE # Prevent name clash with build subdirectory on case-insensitive file systems OUTPUT_NAME openglunderqmlapp ) -target_link_libraries(openglunderqml PUBLIC +target_link_libraries(openglunderqml PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt index f77e4c72a4..9a429dc23c 100644 --- a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt +++ b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(threadedanimation LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/threadedanimatio find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) -qt_add_executable(threadedanimation +qt_standard_project_setup() + +qt_add_executable(threadedanimation WIN32 MACOSX_BUNDLE main.cpp spinner.cpp spinner.h ) -set_target_properties(threadedanimation PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(threadedanimation PUBLIC +target_link_libraries(threadedanimation PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt index 57ab0a1595..28175248ec 100644 --- a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt +++ b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(twotextureproviders LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,17 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/twotextureprovid find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick ShaderTools) -qt_add_executable(twotextureproviders +qt_standard_project_setup() + +qt_add_executable(twotextureproviders WIN32 MACOSX_BUNDLE main.cpp xorblender.cpp xorblender.h ) -set_target_properties(twotextureproviders PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(twotextureproviders PUBLIC +target_link_libraries(twotextureproviders PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt index 8042e081f4..3f7b5e3b60 100644 --- a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt +++ b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(vulkantextureimport LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,20 +12,19 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/vulkantextureimp find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) -qt_add_executable(vulkantextureimport +qt_standard_project_setup() + +qt_add_executable(vulkantextureimport WIN32 MACOSX_BUNDLE main.cpp vulkantextureimport.cpp vulkantextureimport.h ) set_target_properties(vulkantextureimport PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE - # Prevent name clash with build subdirectory on case-insensitive file systems OUTPUT_NAME vulkantextureimportapp ) -target_link_libraries(vulkantextureimport PUBLIC +target_link_libraries(vulkantextureimport PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt index fc4e3e50c3..38bb243eb4 100644 --- a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt +++ b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(vulkanunderqml LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,20 +12,19 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/vulkanunderqml") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) -qt_add_executable(vulkanunderqml +qt_standard_project_setup() + +qt_add_executable(vulkanunderqml WIN32 MACOSX_BUNDLE main.cpp vulkansquircle.cpp vulkansquircle.h ) set_target_properties(vulkanunderqml PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE - # Prevent name clash with build subdirectory on case-insensitive file systems OUTPUT_NAME vulkanunderqmlapp ) -target_link_libraries(vulkanunderqml PUBLIC +target_link_libraries(vulkanunderqml PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/shadereffects/CMakeLists.txt b/examples/quick/shadereffects/CMakeLists.txt index b9d1ff9dc2..883352e54a 100644 --- a/examples/quick/shadereffects/CMakeLists.txt +++ b/examples/quick/shadereffects/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(shadereffects LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,16 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/shadereffects") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick ShaderTools) +qt_standard_project_setup() + qt_add_executable(shadereffectsexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(shadereffectsexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(shadereffectsexample PUBLIC +target_link_libraries(shadereffectsexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/shapes/CMakeLists.txt b/examples/quick/shapes/CMakeLists.txt index 994befa0f3..5c6348ab04 100644 --- a/examples/quick/shapes/CMakeLists.txt +++ b/examples/quick/shapes/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(shapes LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/shapes") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(shapesexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(shapesexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(shapesexample PUBLIC +target_link_libraries(shapesexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/text/CMakeLists.txt b/examples/quick/text/CMakeLists.txt index a338d31260..4050357c70 100644 --- a/examples/quick/text/CMakeLists.txt +++ b/examples/quick/text/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(text LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/text") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(textexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(textexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(textexample PUBLIC +target_link_libraries(textexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/threading/CMakeLists.txt b/examples/quick/threading/CMakeLists.txt index 8239eeb22d..9b60123d47 100644 --- a/examples/quick/threading/CMakeLists.txt +++ b/examples/quick/threading/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(threading LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/threading") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(threadingexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(threadingexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(threadingexample PUBLIC +target_link_libraries(threadingexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/touchinteraction/CMakeLists.txt b/examples/quick/touchinteraction/CMakeLists.txt index 2faf8b5b8d..942d81a10d 100644 --- a/examples/quick/touchinteraction/CMakeLists.txt +++ b/examples/quick/touchinteraction/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(touchinteraction LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,18 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/touchinteraction") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(touchinteractionexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(touchinteractionexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(touchinteractionexample PUBLIC +target_link_libraries(touchinteractionexample PRIVATE Qt::Core Qt::Gui Qt::Qml diff --git a/examples/quick/window/CMakeLists.txt b/examples/quick/window/CMakeLists.txt index 18c09aca59..294fd9cd53 100644 --- a/examples/quick/window/CMakeLists.txt +++ b/examples/quick/window/CMakeLists.txt @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(window LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() @@ -14,15 +12,21 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/window") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup() + add_subdirectory("../shared" "shared") qt_add_executable(windowexample + WIN32 + MACOSX_BUNDLE main.cpp ) -set_target_properties(windowexample PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +target_link_libraries(windowexample PRIVATE + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick ) qt_add_qml_module(windowexample @@ -36,13 +40,6 @@ qt_add_qml_module(windowexample "window.qml" ) -target_link_libraries(windowexample PRIVATE - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - add_dependencies(windowexample window_shared) install(TARGETS windowexample |