Cmake 交叉编译导致 arm-none-eabi-gcc 测试失败

Cmake Cross Compiling causing a test failure on arm-none-eabi-gcc

我正在尝试使用 cmake 交叉编译到 arm cortex-m。我已经使用以下 CMakeLists.txt 文件设置了 cmake。

INCLUDE(CMakeForceCompiler)
#cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_FORCE_C_COMPILER arm-none-eabi-gcc)
SET(CMAKE_FORCE_CXX_COMPILER arm-none-eabi-g++)
#added as test
SET(CMAKE_C_COMPILER arm-none-eabi-gcc)
SET(CMAKE_CXX_COMPILER arm-none-eabi-g++)
# this one is important
SET(CMAKE_SYSTEM_NAME Generic)

#specify the generator to use
SET(CMAKE_GENERATOR "Unix Makefiles")
project(Template C CXX)

但是,当我 运行 "cmake .." 从构建目录或从 gui.我收到以下错误。

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "C:/Program Files (x86)/GNU Tools ARM Embedded/4.9 2014q4/bin/arm-none-eabi-gcc.exe" is not able to compile a simple test program.

为什么 cmake 试图测试编译器?我如何让它停止? 我尝试使用 NONE 作为语言,但它不知道 link 语言。有什么想法吗?

CMAKE_FORCE_C_COMPILERdocumentation:

It sets CMAKE_C_COMPILER to the given compiler and the cmake internal variable CMAKE_C_COMPILER_ID to the given compiler-id. It also bypasses the check for working compiler and basic compiler information tests.