summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorØystein Heskestad <oystein.heskestad@qt.io>2023-09-27 16:33:25 +0200
committerØystein Heskestad <oystein.heskestad@qt.io>2023-10-11 18:14:32 +0200
commitc0765880c1ba60a1a487dddf25e7d0bc8a670d61 (patch)
tree8bdc0aa4accbce092ead8932a8087768d985c25b
parentfdc8f50466f0c8d04e954123a405047435e83517 (diff)
Update CMake-files for bluetooth manual examples
Task-number: QTBUG-112850 Pick-to: 6.6 6.5 Change-Id: Ib9a787f8fb84b149147baec4ff76f78b028cff2b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--tests/manual/examples/ble/CMakeLists.txt4
-rw-r--r--tests/manual/examples/ble/bleclient/CMakeLists.txt53
-rw-r--r--tests/manual/examples/ble/bleserver/CMakeLists.txt45
3 files changed, 37 insertions, 65 deletions
diff --git a/tests/manual/examples/ble/CMakeLists.txt b/tests/manual/examples/ble/CMakeLists.txt
index 52adc96..174aa79 100644
--- a/tests/manual/examples/ble/CMakeLists.txt
+++ b/tests/manual/examples/ble/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-qt_internal_add_example(bleclient)
-qt_internal_add_example(bleserver)
+add_subdirectory(bleclient)
+add_subdirectory(bleserver)
diff --git a/tests/manual/examples/ble/bleclient/CMakeLists.txt b/tests/manual/examples/ble/bleclient/CMakeLists.txt
index adef48b..628a717 100644
--- a/tests/manual/examples/ble/bleclient/CMakeLists.txt
+++ b/tests/manual/examples/ble/bleclient/CMakeLists.txt
@@ -2,45 +2,38 @@
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
-project(bleclient LANGUAGES CXX)
+project(tst_bleclient VERSION "${QT_REPO_MODULE_VERSION}" LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/remoteobjects/ble/bleclient")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Widgets Bluetooth RemoteObjects)
-
-qt_add_executable(bleclient
- ../common/bleiodevice.cpp ../common/bleiodevice.h
- connectpage.cpp connectpage.h connectpage.ui
- mainwindow.cpp mainwindow.h
- heaterview.cpp heaterview.h heaterview.ui
- main.cpp
+qt_internal_add_manual_test(tst_bleclient
+ SOURCES
+ ../common/bleiodevice.cpp ../common/bleiodevice.h
+ connectpage.cpp connectpage.h connectpage.ui
+ mainwindow.cpp mainwindow.h
+ heaterview.cpp heaterview.h heaterview.ui
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Widgets
+ Qt::Bluetooth
+ Qt::RemoteObjects
)
-set_target_properties(bleclient PROPERTIES
+qt_autogen_tools(tst_bleclient ENABLE_AUTOGEN_TOOLS moc uic)
+
+set_target_properties(tst_bleclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(bleclient PUBLIC
+target_include_directories(tst_bleclient PUBLIC
../common
)
-target_link_libraries(bleclient PUBLIC
- Qt::Core
- Qt::Widgets
- Qt::Bluetooth
- Qt::RemoteObjects
-)
-
-qt6_add_repc_replicas(bleclient
+qt_add_repc_replicas(tst_bleclient
../common/heater.rep
)
@@ -48,18 +41,12 @@ if (APPLE)
# Using absolute path for shared plist files is a Ninja bug workaround
get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common ABSOLUTE)
if (IOS)
- set_target_properties(bleclient PROPERTIES
+ set_target_properties(tst_bleclient PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.ios.plist"
)
else()
- set_target_properties(bleclient PROPERTIES
+ set_target_properties(tst_bleclient PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.cmake.macos.plist"
)
endif()
endif()
-
-install(TARGETS bleclient
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/tests/manual/examples/ble/bleserver/CMakeLists.txt b/tests/manual/examples/ble/bleserver/CMakeLists.txt
index c5c676a..5f77f26 100644
--- a/tests/manual/examples/ble/bleserver/CMakeLists.txt
+++ b/tests/manual/examples/ble/bleserver/CMakeLists.txt
@@ -2,41 +2,32 @@
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
-project(bleserver LANGUAGES CXX)
+project(tst_bleserver VERSION "${QT_REPO_MODULE_VERSION}" LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/remoteobjects/ble/bleserver")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Bluetooth RemoteObjects)
-
-qt_add_executable(bleserver
- ../common/bleiodevice.cpp ../common/bleiodevice.h
- main.cpp
+qt_internal_add_manual_test(tst_bleserver
+ SOURCES
+ ../common/bleiodevice.cpp ../common/bleiodevice.h
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Bluetooth
+ Qt::RemoteObjects
)
-set_target_properties(bleserver PROPERTIES
+set_target_properties(tst_bleserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(bleserver PUBLIC
+target_include_directories(tst_bleserver PUBLIC
../common
)
-target_link_libraries(bleserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Bluetooth
- Qt::RemoteObjects
-)
-
-qt6_add_repc_sources(bleserver
+qt_add_repc_sources(tst_bleserver
../common/heater.rep
)
@@ -44,18 +35,12 @@ if (APPLE)
# Using absolute path for shared plist files is a Ninja bug workaround
get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common ABSOLUTE)
if (IOS)
- set_target_properties(bleserver PROPERTIES
+ set_target_properties(tst_bleserver PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.ios.plist"
)
else()
- set_target_properties(bleserver PROPERTIES
+ set_target_properties(tst_bleserver PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.cmake.macos.plist"
)
endif()
endif()
-
-install(TARGETS bleserver
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)