You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.3 KiB
35 lines
1.3 KiB
# 设置目标系统、处理器架构
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
|
|
# 设置工具链目录
|
|
set(TOOL_CHAIN_DIR $ENV{CPP_TOOLCHAIN_ARM_LINUX})
|
|
|
|
set(TOOL_CHAIN_INCLUDE ${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/include ${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/libc/usr/include)
|
|
set(TOOL_CHAIN_LIB ${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/lib ${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/libc/usr/lib)
|
|
|
|
# 设置编译器位置
|
|
set(CMAKE_C_COMPILER ${TOOL_CHAIN_DIR}/bin/aarch64-none-linux-gnu-gcc.exe)
|
|
set(CMAKE_CXX_COMPILER ${TOOL_CHAIN_DIR}/bin/aarch64-none-linux-gnu-g++.exe)
|
|
|
|
# 设置cmake查找主路径
|
|
set(CMAKE_FIND_ROOT_PATH ${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
# 只在指定目录下查找库文件
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
# 只在指定目录下查找头文件
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
# 只在指定目录下查找依赖包
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|
|
# 包含工具链文件
|
|
include_directories(
|
|
${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/include
|
|
${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/libc/usr/include)
|
|
|
|
# 设置CMAKE_INCLUDE_PATH
|
|
set(CMAKE_INCLUDE_PATH ${TOOL_CHAIN_INCLUDE})
|
|
|
|
# 设置CMAKE_LIBRARY_PATH
|
|
set(CMAKE_LIBRARY_PATH ${TOOL_CHAIN_LIB}) |