0

我有以下 toolchain.cmake 文件:

  1   set(CMAKE_SYSTEM_NAME Linux)
    1 set(CMAKE_SYSTEM_PROCESSOR arm)
    2 set(CMAKE_FIND_ROOT_PATH ~/my-project/embeddedfs)
    3 set(CMAKE_SYSROOT ~/my-project/embeddedfs)
    4 
    5 set(CROSS_ROOT /opt/cross/bin)
    6 
    7 set(CMAKE_AR                        ${CROSS_ROOT}/aarch64-linux-ar)
    8 set(CMAKE_ASM_COMPILER              ${CROSS_ROOT}/aarch64-linux-as)
    9 set(CMAKE_C_COMPILER                ${CROSS_ROOT}/aarch64-linux-gcc)
   10 set(CMAKE_CXX_COMPILER              ${CROSS_ROOT}/aarch64-linux-g++)
   11 set(CMAKE_LINKER                    ${CROSS_ROOT}/aarch64-linux-ld)
   12 set(CMAKE_OBJCOPY                   ${CROSS_ROOT}/aarch64-linux-objcopy)
   13 set(CMAKE_RANLIB                    ${CROSS_ROOT}/aarch64-linux-ranlib)
   14 set(CMAKE_SIZE                      ${CROSS_ROOT}/aarch64-linux-size)
   15 set(CMAKE_STRIP                     ${CROSS_ROOT}/aarch64-linux-strip)
   16 set(CMAKE_GCOV                      ${CROSS_ROOT}/aarch64-linux-gcov)
   17 
   18 set(CMAKE_C_FLAGS                   "${APP_C_FLAGS} -Wno-psabi" CACHE INTERNAL "")
   19 set(CMAKE_CXX_FLAGS                 "${APP_CXX_FLAGS} ${CMAKE_C_FLAGS}" CACHE INTERNAL "")
   20 
   21 set(CMAKE_C_FLAGS_DEBUG             "-O0 -g" CACHE INTERNAL "")
   22 set(CMAKE_C_FLAGS_RELEASE           "-O3 -DNDEBUG" CACHE INTERNAL "")
   23 set(CMAKE_CXX_FLAGS_DEBUG           "${CMAKE_C_FLAGS_DEBUG}" CACHE INTERNAL "")
   24 set(CMAKE_CXX_FLAGS_RELEASE         "${CMAKE_C_FLAGS_RELEASE}" CACHE INTERNAL "")
   25 
   26 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
   27 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
   28 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
   29 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

尝试配置项目时,CMake 使用 ARM 机器文件系统中的 make 测试 C 编译器。因此,检查失败。我可以在 CMake 中设置任何变量来为其提供主机上 make 程序的路径吗?

4

0 回答 0