title: cross-compile QT6, configure doesn't recognize installed packages/libs on target
body: <p>I'm on a native bullseye machine
  building QT6.2 from git using the compiler and cross-compiler that comes packaged in bullseye
  cmake version 3.21</p>
  <p>first I build QT for the host using</p>
  <pre><code>jgnoss@mav-dev:~/Devel/QT/qt_x86_64_build$ ../qt_git/configure -prefix /home/jgnoss/Devel/QT/qt_x86_64/6.2.0
  </code></pre>
  <p>configure, build and install worked fine</p>
  <p>for cross-compile, I sshfs'd the targets rootfs to:
  /home/jgnoss/Devel/bbb/sysroot then try</p>
  <pre><code>jgnoss@mav-dev:~/Devel/QT/qt_bbb_build$  ../qt_git/configure -sysroot /home/jgnoss/Devel/bbb/sysroot -qt-host-path /home/jgnoss/Devel/QT/qt_x86_64/6.2.0 -prefix /home/jgnoss/Devel/QT/qt_bbb -extprefix /home/jgnoss/Devel/QT/qt_bbb -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON -- -DCMAKE_TOOLCHAIN_FILE=/home/jgnoss/Devel/QT/toolchain-cross_armhf.cmake
  </code></pre>
  <p>configure runs fine, but misses to detect packages/libraries that are installed on the target</p>
  <p>for example:
  output from configure</p>
  <pre><code>-- Checking for module 'libudev'
  --   No package 'libudev' found
  </code></pre>
  <p>running on target</p>
  <pre><code>jgnoss@beaglebone:~$ dpkg -l |grep libudev
  ii  libgudev-1.0-0:armhf                      232-2                                 armhf        G
  Object-based wrapper library for libudev
  ii  libudev-dev:armhf                         241-7~deb10u8                         armhf        l
  ibudev development files
  ii  libudev1:armhf                            241-7~deb10u8                         armhf        l
  ibudev shared library
  
  jgnoss@beaglebone:~$ pkg-config --libs libudev
  -ludev
  </code></pre>
  <p>that's just one example, there are a lot of packages/libraries that are not detected</p>
  <p>any ideas how to solve that?</p>
  <p>thanks
  Ju</p>
  <p>EDIT:
  the cmake toolchain-file I use is :</p>
  <pre><code>cmake_minimum_required(VERSION 3.18)
  include_guard(GLOBAL)
  
  set(CMAKE_SYSTEM_NAME Linux)
  set(CMAKE_SYSTEM_PROCESSOR arm)
  
  set(TARGET_SYSROOT /home/jgnoss/Devel/bbb/sysroot)
  set(CROSS_COMPILER /usr/arm-linux-gnueabihf)
  
  set(CMAKE_SYSROOT ${TARGET_SYSROOT})
  
  set(ENV{PKG_CONFIG_PATH} &quot;&quot;)
  set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
  set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
  
  set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc-10)
  set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++-10)
  
  # set(QT_COMPILER_FLAGS &quot;-march=armv7-a -mfpu=neon -mfloat-abi=hard&quot;)
  # set(QT_COMPILER_FLAGS &quot;-march=armv7-a -mtune=cortex-a9 -mfpu=neon&quot;)
  #set(QT_COMPILER_FLAGS &quot;-march=armv7-a -mfpu=neon&quot;)
  
  set(QT_COMPILER_FLAGS_RELEASE &quot;-O2 -pipe&quot;)
  set(QT_LINKER_FLAGS &quot;-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed&quot;)
  
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  
  include(CMakeInitializeConfigs)
  
  function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
    if (_PREFIX MATCHES &quot;CMAKE_(C|CXX|ASM)_FLAGS&quot;)
      set(CMAKE_${CMAKE_MATCH_1}_FLAGS_INIT &quot;${QT_COMPILER_FLAGS}&quot;)
  
      foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
        if (DEFINED QT_COMPILER_FLAGS_${config})
          set(CMAKE_${CMAKE_MATCH_1}_FLAGS_${config}_INIT &quot;${QT_COMPILER_FLAGS_${config}}&quot;)
        endif()
      endforeach()
    endif()
  
    if (_PREFIX MATCHES &quot;CMAKE_(SHARED|MODULE|EXE)_LINKER_FLAGS&quot;)
      foreach (config SHARED MODULE EXE)
        set(CMAKE_${config}_LINKER_FLAGS_INIT &quot;${QT_LINKER_FLAGS}&quot;)
      endforeach()
    endif()
  
    _cmake_initialize_per_config_variable(${ARGV})
  endfunction()
  </code></pre>