Skip to content

Clang: Do not mistake clang-cl 6.0 for GNU-like clang

Ismail Donmez requested to merge ismail/cmake:clang-cl-fix into master

The check added by !1373 (merged) is incorrectly detecting clang-cl 6.0 as GNU-like. Currently cmake is testing if the clang compiler accepts --version to see if it accepts GNU style flags, however with the latest llvm snapshot this also works for clang-cl:

> clang-cl --version
clang version 6.0.0 (trunk)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

So instead we should use the /? flag which fails with clang but works with clang-cl:

> clang-cl /? &> /dev/null; echo $?
0
> clang /? &> /dev/null; echo $?
1

Fixes: #17518 (closed)

Edited by Ismail Donmez

Merge request reports