[CMake] Status of clang support?

Michael Wild themiwi at gmail.com
Thu Oct 28 01:00:48 EDT 2010


On 27. Oct, 2010, at 21:38 , Alexander Neundorf wrote:

> On Wednesday 27 October 2010, Campbell Barton wrote:
>> On Tue, Oct 26, 2010 at 1:02 AM, Mateusz Loskot <mateusz at loskot.net> wrote:
>>> On 25/10/10 01:38, Mateusz Loskot wrote:
>>>> On 24/10/10 23:00, Ryan Pavlik wrote:
>>>>> My best guess would be to check for some Clang-specific defines,
>>>>> similar to the platform checks.  Actually, it looks like in the Git
>>>>> repository of CMake, there is now some Clang-specific support:
>>>>> http://github.com/Kitware/CMake/commit/571dc7489111893355deba710feee599
>>>>> 0bce92e4 I think that this commit is included in 2.8.2.
>>>> 
>>>> Ryan,
>>>> 
>>>> It's very good to know.
>>>> 
>>>>> I've made a note on that commit as to where I think a Clang-specific
>>>>> variable might be set.
>>>> 
>>>> I've seen, great!
>>>> 
>>>>> For now, you might be able to look at the
>>>>> value of CMAKE_CXX_COMPILER_ID for a more general solution - it seems
>>>>> like that might contain "Clang" if building using Clang.
>>>> 
>>>> I'm having access to CMake 2.8.0 at this moment
>>>> And, this version sets CMAKE_CXX_COMPILER_ID to GNU, even if
>>>> C/C++ compilers set to clang:
>>>> 
>>>> cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
>>>> 
>>>> Also, simple test always reports the "gnu".
>>>> 
>>>> if("${CMAKE_CXX_COMPILER_ID}" MATCHES "clang")
>>>>   message(STATUS "clang")
>>>> elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
>>>>   message(STATUS "gnu")
>>>> endif()
>>>> 
>>>> I will try 2.8.2 soon.
>>>> 
>>>> Thanks for your help!
>>> 
>>> FYI,
>>> 
>>> I have tried clang 2.9 (current SVN trunk)
>>> together with CMake from current git.
>>> 
>>> The compiler ID matching works perfectly well!
>>> 
>>> Thanks again!
>>> 
>>> Best regards,
>> 
>> I've been using Clang static analyzer & regular Clang from SVN with
>> CMake  for some time and I only have 2 problems with this.
>> * When switching compilers some settings are lost, this is an
>> annoyance when using ccmake, since I have custom includes that need to
>> be entered in manually.
> 
> What do you mean with "switching compilers" ?
> Installing a new version of clang or changing the compiler in an already 
> configured build tree ?

I think he's playing around with different compilers in a single build tree. I suggest to create a separate build tree for every compiler, avoiding the frequent re-configures.

> 
>> * For some reason I need to manually add these include paths to my
>> CXXFLAGS -I/usr/include/c++/4.5.1
>> -I/usr/include/c++/4.5.1/x86_64-unknown-linux-gnu/
> 
> Maybe you should put this in the cmake bug tracker.

Does it work if you invoke the compiler on the command line directly? I suspect that clang++ is mis-configured, nothing to do with CMake.

Michael

--
There is always a well-known solution to every human problem -- neat, plausible, and wrong.
H. L. Mencken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101028/2613f966/attachment.pgp>


More information about the CMake mailing list