Mac Cmake错误:CXX编译器没有已知功能

时间:2018-09-11 13:42:30

标签: c++ gcc cmake clang

我正在尝试使用Mac(MacOsX High Sierra)和CMake版本:3.12.2

编译项目

点击“生成”会出现以下错误:

CMake Error in CMakeLists.txt: No known features for CXX compiler "Clang" version 9.1.0.9020039.

我的CMakeLists.txt如下:

PROJECT(rightKidney_seg)
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
       cmake_policy(SET CMP0003 NEW)
     endif(COMMAND cmake_policy)
INCLUDE_REGULAR_EXPRESSION("^.*$")
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)
ADD_EXECUTABLE(rightKidney_seg rightKidney_seg.cxx)
TARGET_LINK_LIBRARIES(rightKidney_seg ${ITK_LIBRARIES})

如果我这样做:结果是哪个gcc:

/usr/bin/gcc

如果我这样做:cc --version,结果是:

Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

有人可以帮助我理解为什么我无法生成项目吗?

0 个答案:

没有答案