CMake设置交叉编译程序
作者:互联网
原文链接:https://my.oschina.net/fuyajun1983cn/blog/263847
SET(TOOLCHAIN_DIR "/home/fuyajun/Public/toolchain/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686")
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-gcc)
set(GNU_FLAGS "-mfpu=vfp -fPIC")
set(CMAKE_CXX_FLAGS "${GNU_FLAGS} ")
set(CMAKE_C_FLAGS "${GNU_FLAGS} ")
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR}
${TOOLCHAIN_DIR}/armv7a-mediatek-linux-gnueabi/include
${TOOLCHAIN_DIR}/armv7a-mediatek-linux-gnueabi/lib
SET(TOOLCHAIN_DIR "/home/fuyajun/Public/toolchain/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686")
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-gcc)
set(GNU_FLAGS "-mfpu=vfp -fPIC")
set(CMAKE_CXX_FLAGS "${GNU_FLAGS} ")
set(CMAKE_C_FLAGS "${GNU_FLAGS} ")
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR}
${TOOLCHAIN_DIR}/armv7a-mediatek-linux-gnueabi/include
${TOOLCHAIN_DIR}/armv7a-mediatek-linux-gnueabi/lib
)
可以在上述基础上添加更多的搜索路径。
转载于:https://my.oschina.net/fuyajun1983cn/blog/263847
标签:set,TOOLCHAIN,交叉,FLAGS,linux,CMAKE,CMake,编译程序,DIR 来源: https://blog.csdn.net/chijiandao3197/article/details/100930653