修改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