[CMake] [Windows] clang-cl.exe detected as MSVC?

Mateusz Loskot mateusz at loskot.net
Mon Sep 11 10:58:19 EDT 2017


Hi,

I'm building a project with CMake 3.9 using clang-cl.exe driver [1]
from LLVM/clang 4.0 enabled with Visual Studio 2015 environment.

CMake detects the compiler as Clang 4.0.0:

-- The C compiler identification is Clang 4.0.0
-- The CXX compiler identification is Clang 4.0.0
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works

and my project builds fine.

In my CMakeLists.txt, there is this flags update:

if(MSVC)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()

and in build log I see:

clang-cl.exe: warning: argument unused during compilation: '/MP'

I have double-checked and MSVC is defined and set True for clang-cl.exe.

Is this correct?
Is clang-cl.exe driver considered to be "when using Microsoft Visual C++" [2]

[1] https://clang.llvm.org/docs/UsersManual.html#clang-cl
[2] https://cmake.org/cmake/help/v3.9/variable/MSVC.html


Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list