summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Köhne <[email protected]>2023-09-18 09:38:57 +0200
committerKai Köhne <[email protected]>2023-09-22 11:24:16 +0200
commitf2ec221bd62b8722915db9fc7dc3eb78991f6e6d (patch)
tree720e3c279a7f52fa167b2a377a8c4b4daed506da
parentec32748b1e98b05d8dda23f8de2c6735f6a1140b (diff)
Make examples/bindableproperties a proper project
Both executables (subscription, bindablesubscription) are documented as one project. Make sure that e.g. Qt Creator can also load this project. Fixes: QTBUG-117109 Pick-to: 6.5 6.6 6.6.0 Change-Id: I3912f2f76379940b02f3a57a7a55440a30366755 Reviewed-by: Joerg Bornemann <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
-rw-r--r--examples/corelib/bindableproperties/CMakeLists.txt27
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt45
-rw-r--r--examples/corelib/bindableproperties/shared/CMakeLists.txt23
-rw-r--r--examples/corelib/bindableproperties/subscription/CMakeLists.txt40
4 files changed, 54 insertions, 81 deletions
diff --git a/examples/corelib/bindableproperties/CMakeLists.txt b/examples/corelib/bindableproperties/CMakeLists.txt
index c6d9076fd8d..9e23bf9b657 100644
--- a/examples/corelib/bindableproperties/CMakeLists.txt
+++ b/examples/corelib/bindableproperties/CMakeLists.txt
@@ -1,2 +1,25 @@
-qt_internal_add_example(bindablesubscription)
-qt_internal_add_example(subscription)
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(bindableproperties LANGUAGES CXX)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_standard_project_setup()
+
+add_subdirectory(shared)
+add_subdirectory(subscription)
+add_subdirectory(bindablesubscription)
+
+install(TARGETS subscription bindablesubscription
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
index c4a2e5fcfc9..d7967e67632 100644
--- a/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
+++ b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
@@ -1,50 +1,15 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-cmake_minimum_required(VERSION 3.16)
-project(bindablesubscription LANGUAGES CXX)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/bindablesubscription")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_standard_project_setup()
-
qt_add_executable(bindablesubscription
- ../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
- bindablesubscription.cpp bindablesubscription.h
- bindableuser.cpp bindableuser.h
+ bindablesubscription.cpp
+ bindablesubscription.h
+ bindableuser.cpp
+ bindableuser.h
)
target_link_libraries(bindablesubscription PRIVATE
- Qt6::Core
- Qt6::Gui
- Qt6::Widgets
+ bindableproperties_shared
)
-# Resources:
-set(countries_resource_files
- "../shared/finland.png"
- "../shared/germany.png"
- "../shared/norway.png"
-)
-
-qt_add_resources(bindablesubscription "countries"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${countries_resource_files}
-)
-
-install(TARGETS bindablesubscription
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/corelib/bindableproperties/shared/CMakeLists.txt b/examples/corelib/bindableproperties/shared/CMakeLists.txt
new file mode 100644
index 00000000000..dee3ecc1366
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_library(bindableproperties_shared STATIC
+ subscriptionwindow.cpp
+ subscriptionwindow.h
+ subscriptionwindow.ui
+)
+
+target_link_libraries(bindableproperties_shared PUBLIC
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
+)
+
+qt_add_resources(bindableproperties_shared "countries"
+ PREFIX
+ "/"
+ FILES
+ "finland.png"
+ "germany.png"
+ "norway.png"
+)
diff --git a/examples/corelib/bindableproperties/subscription/CMakeLists.txt b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
index 0dd027fc247..15e41ad77e2 100644
--- a/examples/corelib/bindableproperties/subscription/CMakeLists.txt
+++ b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
@@ -1,50 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-cmake_minimum_required(VERSION 3.16)
-project(subscription LANGUAGES CXX)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/subscription")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_standard_project_setup()
-
qt_add_executable(subscription
- ../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
subscription.cpp subscription.h
user.cpp user.h
)
target_link_libraries(subscription PRIVATE
- Qt6::Core
- Qt6::Gui
- Qt6::Widgets
-)
-
-# Resources:
-set(countries_resource_files
- "../shared/finland.png"
- "../shared/germany.png"
- "../shared/norway.png"
-)
-
-qt_add_resources(subscription "countries"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${countries_resource_files}
-)
-
-install(TARGETS subscription
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ bindableproperties_shared
)