We use this

if(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER MATCHES "clang")
        set(COMPILING_WITH_CLANG True)
elseif(CMAKE_C_COMPILER MATCHES ".*gcc.*" OR CMAKE_CXX_COMPILER MATCHES 
".*g[+][+].*")
        set(COMPILING_WITH_GCC True)
endif()

In our project

On 2013-30-01, at 14:42:05 , Thomas Nilsson wrote:

> I was looking for a way to identify the compiler as clang to know if I should 
> pass it a clang specific flag ("-x c++").
> 
> On Darwin default compiler is Clang used through /usr/bin/cc and and 
> /usr/bin/c++. The identification is clearly signaled as "Clang 4.1.0" but 
> CMAKE_CXX_COMPILER_ID is not set. Obviously CMAKE_CXX_COMPILER is set to 
> /usr/bin/c++.
> 
> Given my belief that CMAKE_CXX_COMPILER_ID will not be implemented soon, what 
> are my options?
> 
> Thomas
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to