Android: find Qt cmake modules

With a recent change to the qt-android-cmake project we are now using
the toolchain file bundled with the NDK, and that forces all cmake
modules to be part of the NDK tree - which breaks the way we find our Qt
installation.  This is a hack to work around this as it undoes this
setting, which I'm sure is well intentioned to prevent host system
issues in this cross build scenario.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-11-13 15:47:47 +08:00
parent a58cd3eb13
commit a250642479

View file

@ -225,6 +225,12 @@ if(BTSUPPORT)
list(APPEND QT_EXTRA_LIBRARIES Qt5::Bluetooth)
endif()
if(ANDROID)
# when building for Android, the toolchain file requires all cmake modules
# to be inside the CMAKE_FIND_ROOT_PATH - which prevents cmake from finding
# our Qt installation. This is ugly, but it works.
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network Svg Test QuickTest LinguistTools Positioning Quick Location ${QT_EXTRA_COMPONENTS})
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Svg Qt5::Positioning Qt5::Quick Qt5::Location ${QT_EXTRA_LIBRARIES})
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)