summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-06-08 12:24:18 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-06-09 15:41:52 +0200
commiteaa0f9dbd55e4d9241f89ce402eb990d3998153d (patch)
tree306b871adf26531b8b1dd0b1dad458b20b3bae86 /tests
parent02a68d63e2944f695ac591442f3141110d6a82b2 (diff)
downloadqtconnectivity-eaa0f9dbd55e4d9241f89ce402eb990d3998153d.tar.gz
Build bttestui as standalone application
At least for testing on Android it's easier to have an out-of-tree build. Task-number: QTBUG-103827 Change-Id: I4f89a1c96d65542a1317a6f223f8bd00720ef3cb Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/bttestui/CMakeLists.txt62
1 files changed, 46 insertions, 16 deletions
diff --git a/tests/bttestui/CMakeLists.txt b/tests/bttestui/CMakeLists.txt
index d044cb9c..223cb269 100644
--- a/tests/bttestui/CMakeLists.txt
+++ b/tests/bttestui/CMakeLists.txt
@@ -2,16 +2,7 @@
## bttestui Binary:
#####################################################################
-qt_internal_add_executable(bttestui
- GUI
- SOURCES
- btlocaldevice.cpp btlocaldevice.h
- main.cpp
- PUBLIC_LIBRARIES
- Qt::Bluetooth
- Qt::Gui
- Qt::Quick
-)
+cmake_minimum_required(VERSION 3.16...3.21)
# Resources:
set(bttest_resource_files
@@ -19,12 +10,51 @@ set(bttest_resource_files
"main.qml"
)
-qt_internal_add_resource(bttestui "bttest"
- PREFIX
- "/"
- FILES
- ${bttest_resource_files}
-)
+if(NOT TARGET Qt::Bluetooth)
+ # for standalone build
+ project(bttestui LANGUAGES CXX)
+
+ set(CMAKE_AUTOMOC ON)
+
+ find_package(Qt6 REQUIRED COMPONENTS Bluetooth Core Gui Quick)
+
+ qt_add_executable(bttestui
+ btlocaldevice.cpp btlocaldevice.h
+ main.cpp
+ )
+
+ target_link_libraries(bttestui PUBLIC
+ Qt::Bluetooth
+ Qt::Gui
+ Qt::Quick
+ )
+
+ qt_add_resources(bttestui "bttest"
+ PREFIX
+ "/"
+ FILES
+ ${bttest_resource_files}
+ )
+else()
+ # in-tree build
+ qt_internal_add_executable(bttestui
+ GUI
+ SOURCES
+ btlocaldevice.cpp btlocaldevice.h
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Bluetooth
+ Qt::Gui
+ Qt::Quick
+ )
+
+ qt_internal_add_resource(bttestui "bttest"
+ PREFIX
+ "/"
+ FILES
+ ${bttest_resource_files}
+ )
+endif()
#### Keys ignored in scope 1:.:.:bttestui.pro:<TRUE>: