diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2023-03-22 14:23:26 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@qt.io> | 2023-03-27 07:42:17 +0200 |
commit | efc852b0ea327831fcceaa925be8e6721ce93297 (patch) | |
tree | 2e373e4daec7c4b378e5bb9ac104fda4428d1fde /tests/manual | |
parent | 1885d031cb8d6d44cc33eeba229c655f39dde462 (diff) | |
download | qtconnectivity-efc852b0ea327831fcceaa925be8e6721ce93297.tar.gz |
CMake: Fix btscanner manual test to work on macOS
Because it's a manual test now instead of an example,
use qt_internal_add_manual_test.
Remove the code bits that were needed for examples.
Enable uic.
Manually link to the darwin permission plugin because that's not done
automatically for tests yet when targeting macOS.
Pick-to: 6.5 6.5.0
Task-number: QTBUG-104754
Task-number: QTBUG-112212
Change-Id: Id4176f60118a4d3dcca96df56d53f9243a50174d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/examples/btscanner/CMakeLists.txt | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/tests/manual/examples/btscanner/CMakeLists.txt b/tests/manual/examples/btscanner/CMakeLists.txt index 61d44dfc..25e0ccb7 100644 --- a/tests/manual/examples/btscanner/CMakeLists.txt +++ b/tests/manual/examples/btscanner/CMakeLists.txt @@ -1,31 +1,39 @@ -# Copyright (C) 2022 The Qt Company Ltd. +# Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.16) -project(btscanner LANGUAGES CXX) +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(btscanner LANGUAGES CXX) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) + endif() + +qt_internal_add_manual_test(btscanner + GUI + SOURCES + device.cpp device.h device.ui + main.cpp + service.cpp service.h service.ui + LIBRARIES + Qt::Bluetooth + Qt::Core + Qt::Widgets + ENABLE_AUTOGEN_TOOLS + uic +) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") +if(MACOS) + # Explicitly link against the static permission plugin because tests + # currently don't have finalizers run for them except for iOS. + # TODO: Remove this when qtbase automatically runs finalizers for tests: QTBUG-112212 + target_link_libraries(btscanner PRIVATE Qt6::QDarwinBluetoothPermissionPlugin) endif() -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/bluetooth/btscanner") - -find_package(Qt6 REQUIRED COMPONENTS Bluetooth Core Widgets) - -qt_standard_project_setup() - -qt_add_executable(btscanner - device.cpp device.h device.ui - main.cpp - service.cpp service.h service.ui -) - set_target_properties(btscanner PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -if (APPLE) +if(APPLE) if (IOS) set_target_properties(btscanner PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" @@ -38,15 +46,3 @@ if (APPLE) ) endif() endif() - -target_link_libraries(btscanner PRIVATE - Qt::Bluetooth - Qt::Core - Qt::Widgets -) - -install(TARGETS btscanner - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) |