cmake-modules icon indicating copy to clipboard operation
cmake-modules copied to clipboard

Compiler is not GNU or Flang! Aborting...

Open evan1026 opened this issue 2 years ago • 2 comments

I am getting the above error when trying to add coverage flags to my project. It seems to be related to checking the compilers for each of the available languages.

Relevant CMake code:

# Debug info to help with this issue
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
message("ALL LANGUAGES: ${LANGUAGES}")
foreach(LANG ${LANGUAGES})
    message("${LANG} compiler is \"${CMAKE_${LANG}_COMPILER_ID}\"")
endforeach()

# Error hit by this line
include(CodeCoverage)

Relevant output of CMake:

ALL LANGUAGES: ASM;C;CXX;NONE
ASM compiler is ""
C compiler is "Clang"
CXX compiler is "Clang"
NONE compiler is ""
CMake Error at lib/cmake-modules/CodeCoverage.cmake:159 (message):
  Compiler is not GNU or Flang! Aborting...
Call Stack (most recent call first):
  CMakeLists.txt:132 (include)

Please let me know if there's any more information I can provide

evan1026 avatar Oct 28 '22 19:10 evan1026

I ran into this. I had to make sure any project() I have all the languages I'm using in there.

I do think that the cmake should be updated to ignore the ones that are not set.

stiggy87 avatar Jan 25 '23 19:01 stiggy87

@stiggy87 solution helped me too.

benner avatar May 17 '23 04:05 benner