2
我想建立一個最小的例子來建立一個C程序。當我運行cmake .
爲什麼CMake檢查C++編譯器?
cmake_minimum_required(VERSION 3.6)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
#set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")
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)
project("funambule")
list(
APPEND src
main.c
)
add_executable(
funambule
${src}
)
:我用這個CMakeLists.txt
文件。儘管我不需要C++編譯器,但它絕對需要檢查C++編譯器。我怎樣才能防止它做這個無用的檢查?
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /cygdrive/c/Users/NoOne/Home/bin/arm-none-eabi-gcc
-- Check for working C compiler: /cygdrive/c/Users/NoOne/Home/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/CC
-- Check for working CXX compiler: /usr/bin/CC -- broken
...