記錄一點關於CMAKE的交叉編譯

修改CMakeLists.txt,添加以下於開頭,成功移植HYDRA到OP上了,爽

SET(CMAKE_SYSTEM_NAME Linux)


SET(CMAKE_C_COMPILER   mipsel-openwrt-linux-gcc)
SET(CMAKE_CXX_COMPILER mipsel-openwrt-linux-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /router/OpenWrt-Toolchain-brcm47xx-for-mipsel_74kc+dsp2-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_74kc+dsp2_gcc-4.8-linaro_uClibc-0.9.33.2)

# search for programs in the build host directories
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)

===================================================

詳情參考官方:

http://www.cmake.org/Wiki/CMake_Cross_Compiling

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章