CMake: fix android target build not picking the correct sysroot

This previous way caused target builds under Linux to pick the host
packages like udev and mtdev and build for them which they will
fail during the build.

Task-number: QTBUG-86028
Change-Id: Ic029f0a3e71b50c694473a110922f0ef11e5b0bf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Assam Boudjelthia 2020-08-13 13:05:13 +03:00
parent fdd61b3a7b
commit 5b76414b43

View File

@ -7,6 +7,14 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtAutoDetect.cmake)
endif()
include(".cmake.conf")
project(QtBase
VERSION "${QT_REPO_MODULE_VERSION}"
DESCRIPTION "Qt Base Libraries"
HOMEPAGE_URL "https://qt.io/"
LANGUAGES CXX C ASM
)
if (CMAKE_CROSSCOMPILING AND CMAKE_SYSROOT)
# When cross compiling with CMake any calls to pkg_check_modules() will
# search into the host system instead of the target sysroot.
@ -17,14 +25,6 @@ if (CMAKE_CROSSCOMPILING AND CMAKE_SYSROOT)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
endif()
include(".cmake.conf")
project(QtBase
VERSION "${QT_REPO_MODULE_VERSION}"
DESCRIPTION "Qt Base Libraries"
HOMEPAGE_URL "https://qt.io/"
LANGUAGES CXX C ASM
)
if(NOT QT_BUILD_STANDALONE_TESTS)
## Add some paths to check for cmake modules:
list(PREPEND CMAKE_MODULE_PATH