编写Toolchain-aarch64.cmake文件,内容如下:
# this is required
SET(CMAKE_SYSTEM_NAME Linux)
# 必须
set(CMAKE_SYSROOT /opt/rootfs-s5p6818)
# specify the cross compiler
# toolchain root
# https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html#cross-compiling-for-linux
set(tools /usr/bin)
SET(CMAKE_C_COMPILER ${tools}/aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER ${tools}/aarch64-linux-gnu-g++)
# where is the target environment
#SET(CMAKE_FIND_ROOT_PATH /opt/arm/ppc_74xx /home/rickk/arm_inst)
# search for programs in the build host directories (not necessary)
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)
# configure Boost and Qt
SET(CMAKE_PREFIX_PATH /opt/rootfs-s5p6818/usr/local/Trolltech/Qt-5.9.1-nexell64/lib/cmake)
SET(QT_QMAKE_EXECUTABLE /usr/local/Trolltech/Qt-5.9.1-nexell64-x86tools/bin/qmake)
#SET(BOOST_ROOT /opt/boost_arm)
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-aarch64.cmake ../qxmpp/
make