cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain_RK3399.cmake CMAKE_INSTALL_PREFIX=/usr/local/rk3399mpp ..
创建toolchain_RK3399.cmake文件
# cmake_minimum_required (VERSION 3.12)
# PLATEFORM_COMPILER_TOOL配置成自己交叉编译工具的目录
set(PLATEFORM_COMPILER_TOOL "/opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-")
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/)
# specify the cross compiler
set(CMAKE_C_COMPILER "${PLATEFORM_COMPILER_TOOL}gcc")
set(CMAKE_CXX_COMPILER "${PLATEFORM_COMPILER_TOOL}g++")
# # 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)