cmake 交叉编译常用参数及cmake在线文档

创建时间:2023-04-27 11:16:59
栏目:c++
CMAKE_SYSTEM_NAME 交叉编译的必设参数,只有当CMAKE_SYSTEM_NAME这个变量被设置了,CMake才认为此时正在交叉编译,它会额外设置一个变量CMAKE_CROSSCOMPILING为true.

set(CMAKE_SYSTEM_PROCESSOR aarch64)

可选项,目标系统的处理器,有时候配置了会多编译一些库出来,根据情况配置

set(CMAKE_CXX_COMPILER_ID GNU)

set(CMAKE_C_COMPILER "aarch64-***-gcc")

set(CMAKE_CXX_COMPILER "aarch64-***-g++")

set(CMAKE_FIND_ROOT_PATH ${PATH1} ${PATH2} )

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)

set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

CMAKE在线文档 https://cmake.org/cmake/help/latest/

联系我们

微信号:shidaping023