[cmake-developers] Suspicious Clang versions
Brad King
brad.king at kitware.com
Mon Aug 5 09:44:00 EDT 2013
On 08/05/2013 09:26 AM, Stephen Kelly wrote:
> Brad King wrote:
>> We need to fix this somehow or CMAKE_*_COMPILER_VERSION will be
>> useless for Clang. Sean, is there any way to extract the underlying
>> Clang version, perhaps with different preprocessor macros? We at
>> least need to be able to detect which version scheme is in use so
>> we can report it somehow.
According to
https://developer.apple.com/library/mac/#documentation/porting/conceptual/portingunix/compiling/compiling.html
and local testing we can use __APPLE_CC__ to detect Apple compiler
builds.
> This might lead to a solution:
>
> https://github.com/mozilla/rust/issues/6419
That shows a difference in the version string reported from the
compiler but AFAICT there is no way to determine the "based on"
version from the preprocessor.
Also any preprocessor tests in C/C++ code that use __clang_major__
for anything will get incorrect results. It would have to be
first conditioned on __APPLE_CC__ to know how to interpret the
version number.
We could consider treating this as a separate compiler and using
a new compiler id like ClangApple or AppleClang or something.
-Brad
More information about the cmake-developers
mailing list