[cmake-developers] [PATCH] Let CMake know that clang uses the GCC toolchain.

Chaoren Lin aoe at google.com
Wed Aug 3 15:22:55 EDT 2016


> It will take some investigation to decide how/whether to set SIMULATE_ID
> to GNU.

This seems like the right thing to do, and is more future proof than the
alternative.

On Wed, Aug 3, 2016 at 5:56 AM, Brad King <brad.king at kitware.com> wrote:

> On 08/02/2016 06:59 PM, Chaoren Lin wrote:
> >> In the gcc-like variant the CMAKE_{C,CXX}_SIMULATE_ID
> >> should be detected as GNU and cause the existing code to work.
> >
> > Huh, it doesn't look like that variable is set automatically when using
> > clang with the gcc toolchain. Is that supposed to happen?
> > It should be set manually (say, in a toolchain file)?
>
> It is supposed to be detected automatically.  Whenever Clang is detected
> on Windows the _SIMULATE_ID should be detected too.  I found the problem.
> The simulate id detection is done here:
>
>
> https://gitlab.kitware.com/cmake/cmake/blob/v3.6.1/Modules/Compiler/Clang-DetermineCompilerInternal.cmake#L12-15
>
> and it only looks for MSVC.  Grepping for SIMULATE_ID reveals that it is
> used for Intel and Clang but only ever detects when MSVC is simulated.
> All consuming code paths are interested in whether SIMULATE_ID==MSVC
> and otherwise assume GNU, except cmGlobalNinjaGenerator::EnableLanguage.
>
> It will take some investigation to decide how/whether to set SIMULATE_ID
> to GNU.  Alternatively the corresponding test in the Ninja generator could
> be changed to look for `COMPILER_ID == Clang && SIMULATE_ID != MSVC`.
>
> -Brad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160803/e7f1d340/attachment.html>


More information about the cmake-developers mailing list