## Build type ##
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_VERBOSE_MAKEFILE ON)
endif(NOT CMAKE_BUILD_TYPE)
## Compiler options
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(tools /opt/ql_crosstools/ql-ag550qcn-cs-gcc820-v1-toolchain/gcc/usr/bin/arm-oe-linux-gnueabi)
set(CMAKE_C_COMPILER ${tools}/arm-oe-linux-gnueabi-gcc)
set(CMAKE_C_FLAGS "-march=armv7-a -marm -mfpu=neon -mfloat-abi=hard --sysroot=/opt/ql_crosstools/ql-sysroots")
if(MSVC)
append_c_compiler_flags("/W4" "VC" CMAKE_C_FLAGS)
append_c_compiler_flags("/Oi;/Ot;/Ox;/Oy" "VC" CMAKE_C_FLAGS_RELEASE)
if(USE_OPENMP)
append_c_compiler_flags("/openmp" "VC" CMAKE_C_FLAGS)
endif(USE_OPENMP)
参考 https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#
1、修改CMakeLists.txt,增加以下内容
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(tools /opt/ql_crosstools/ql-ag550qcn-cs-gcc820-v1-toolchain/gcc/usr/bin/arm-oe-linux-gnueabi)
set(CMAKE_C_COMPILER ${tools}/arm-oe-linux-gnueabi-gcc)
set(CMAKE_C_FLAGS "-march=armv7-a -marm -mfpu=neon -mfloat-abi=hard --sysroot=/opt/ql_crosstools/ql-sysroots")