linux cmake添加--sysroot路徑
添加以下
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")
*博客內(nèi)容為網(wǎng)友個人發(fā)布,僅代表博主個人觀點(diǎn),如有侵權(quán)請聯(lián)系工作人員刪除。
手機(jī)電池相關(guān)文章:手機(jī)電池修復(fù)