"); //-->
添加以下
set(MYSYSROOT /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux) # compiler/linker flags set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_FIND_ROOT_PATH "${MYSYSROOT}")
示例:
SET(CMAKE_SYSTEM_NAME Linux) SET(TOOLCHAIN_DIR "/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/usr/bin/aarch64-poky-linux") SET(CMAKE_FIND_ROOT_PATH "${TOOLCHAIN_DIR}") SET(CMAKE_C_COMPILER "/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc") SET(CMAKE_CXX_COMPILER "/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++") set(MYSYSROOT /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux) # compiler/linker flags set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_FIND_ROOT_PATH "${MYSYSROOT}") SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) #for libraries and headers in the target directories #SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) #SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET(CMAKE_C_FLAGS"${CMAKE_C_FLAGS} --sysroot=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux") SET(CMAKE_CXX_FLAGS"${CMAKE_CXX_FLAGS} --sysroot=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux")
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。