From 70dc8438fce5c9a5b6c9ea9392dbbadf92ea2cb1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 8 Oct 2020 12:31:03 +0200 Subject: CMake: Fix find_package puzzle piece of top-level cross-builds The subdirectories, the top-level CMakeLists.txt adds, contain find_package(Qt6 COMPONENTS ...) calls. When cross-compiling to Android, the toolchain file sets CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_MODE to ONLY. That means, the packages that are created in qtbase can never be found by other Qt repositories, e.g. qtdeclarative. Append the qtbase build dir to CMAKE_FIND_ROOT_PATH to find the Qt packages of the build dir when cross-compiling. Because of some CMake idiosyncracy, we need to append "${QtBase_BINARY_DIR}/lib/cmake" to CMAKE_PREFIX_PATH and not just "${QtBase_BINARY_DIR}". See qtbase/ec90f9013b4c6b63d7e03a964f66f97329be7885 for details. Task-number: QTBUG-85080 Change-Id: I799f851316538c310d73f5ab59c809229e16e8a8 Reviewed-by: Alexandru Croitor --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5feb49a9..13817e75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,8 @@ list(REMOVE_ITEM git_module_list qtbase) add_subdirectory(qtbase) if (NOT QT_BUILD_STANDALONE_TESTS) - list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}") + list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/lib/cmake") + list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}") endif() foreach(module IN LISTS git_module_list) -- cgit v1.2.3