[c++] In cmake, how can I test if the compiler is Clang?


Answers

The OGRE 3D engine source code uses the following check:

if (CMAKE_CXX_COMPILER MATCHES ".*clang")
    set(CMAKE_COMPILER_IS_CLANGXX 1)
endif ()
Question

We have a set of cross platform CMake build scripts, and we support building with MSVC and GCC.

We're trying out Clang, but I can't figure out how to test whether or not the compiler is Clang with our CMake script.

What should I test to see if the compiler is Clang or not? We're currently using MSVC and CMAKE_COMPILER_IS_GNU<LANG> to test for MSVC and GCC, respectively.




Links