I cross compile a third-party lib use cmake, I create a toolchain.make like this
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER aarch64-poky-linux-gcc)
SET(CMAKE_CXX_COMPILER aarch64-poky-linux-g++)
SET(CMAKE_FIND_ROOT_PATH /home/sundq/workspace/mengbin/tmp/Conexant_2Mic/build/tmp/sysroots/aud8516-slc)
SET(CMAKE_SYSROOT /home/sundq/workspace/mengbin/tmp/Conexant_2Mic/build/tmp/sysroots/aud8516-slc)
SET(CMAKE_SYSROOT_COMPILE "${CMAKE_SYSROOT}")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
The question is: Why cmake finds gstreamer-2.0 header file in the host system path /usr/include/gstreamer-2.0
first, not in the sysroot path ${CMAKE_SYSROOT}/usr/include/gstreamer-2.0
. I mean I have set SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY), the ONLY value mean find header file just in target directories, not in host directories, but it seems that this param CMAKE_FIND_ROOT_PATH_MODE_INCLUDE does not works!!!