diff options
Diffstat (limited to 'cmake/QtConfig.cmake.in')
-rw-r--r-- | cmake/QtConfig.cmake.in | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index b63dca8732..8e828e8f33 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -1,5 +1,15 @@ @PACKAGE_INIT@ +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. + # The current work around is based on the discussion found at + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4478 + set(ENV{PKG_CONFIG_DIR} "") + set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") + set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT}) +endif() + # Slightly amended version of ./src/corelib/Qt6Config.cmake.in if (CMAKE_VERSION VERSION_LESS 3.1.0) message(FATAL_ERROR "Qt requires at least CMake version 3.1.0") |