0

I'm trying to compile a project using my Mac (MacOsX High Sierra) and CMake version: 3.12.2

Clicking on "Generate" gives the following error:

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

My CMakeLists.txt is the following:

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})

If I do: which gcc the result is:

/usr/bin/gcc

If I do: cc --version the result is:

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

Can anyone help me in understanding why I cannot generate the project?

Praneeth Peiris
  • 2,008
  • 20
  • 40
  • how do you generate project? Describe it. If you are using command line tool provide a command. If you use CMake UI show how it is configured. There must be more error information too. – Marek R Sep 11 '18 at 14:00
  • explain more detail like https://stackoverflow.com/questions/28119552/no-known-features-for-cxx-compiler-when-compiling-with-msvc-2013, which feature unknown for CXX compiler? It's better to paste cmake error log in your question. – kgbook Sep 11 '18 at 14:14
  • I just generated the project using CMake, so I did ccmake ../ and it prompted the configuration, I hit Configure and then generate and I get the error – Marco Solbiati Sep 11 '18 at 14:30
  • Here is the output of CMakeError.log: Detecting C [-std=c11] compiler features failed to compile with the following output: Change Dir: /Users/Solbia/Desktop/Endosight:INTRA/ImageProcessing/MRILiver/RightKidney_MR/build/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_397ea/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_397ea.dir/build.make CMakeFiles/cmTC_397ea.dir/build CMakeFiles/cmTC_397ea.dir/build.make:64: *** target pattern contains no `%'. Stop. make: *** [cmTC_397ea/fast] Error 2 – Marco Solbiati Sep 11 '18 at 14:31
  • Detecting CXX [-std=c++1z] compiler features failed to compile with the following output: Change Dir: /Users/Solbia/Desktop/Endosight:INTRA/ImageProcessing/MRILiver/RightKidney_MR/build/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_be907/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_be907.dir/build.make CMakeFiles/cmTC_be907.dir/build CMakeFiles/cmTC_be907.dir/build.make:64: *** target pattern contains no `%'. Stop. make: *** [cmTC_be907/fast] Error 2 – Marco Solbiati Sep 11 '18 at 14:31
  • Please do not add code or logs into the *Comments* area - it is unformatted and very hard to read. Instead, please click `edit` under your question and paste in your code, the select it with the mouse and click the button labelled `{}` beside **Bold** and *Italic* in the formatting toolbar. – Mark Setchell Sep 11 '18 at 14:52
  • Is your code C or C++? Do you want to use `clang`, `clang++`, `gcc` or `g++` as the compiler? Have you told `cmake` which compiler you want to use? – Mark Setchell Sep 11 '18 at 14:53
  • Now it does not let me edit my comments, for the future, I'll take into account to use the parenthesis. As regards the code my code is .cxx and so it is C++. I don't have any specific compiler to use, I just need my project to be compiled successfully. How can I tell CMake which compiler to use? – Marco Solbiati Sep 11 '18 at 15:04
  • That error from the log - `target pattern contains no \`%'. Stop.` is most likely about the path `/Users/Solbia/Desktop/Endosight:INTRA/ImageProcessing/MRILiver/RightKidney_MR/build/` which you use as a build directory. `make` doesn't like colon(`:`) in the path - it treats colon as a target/pattern/dependency delimiter. Use another directory for build your project. – Tsyvarev Sep 11 '18 at 17:03
  • Thank you very much. It solves the issue. – Marco Solbiati Sep 11 '18 at 19:01

0 Answers0