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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Mateusz Loskot
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
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
--
Mateusz Loskot
http://mateusz.loskot.net
Reply | Threaded
Open this post in threaded view
|

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

Konstantin Tokarev


11.09.2017, 17:59, "Mateusz Loskot" <[hidden email]>:

> 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?

Yes. clang-cl is mostly compatible with MSVC on the command line, so it's natural
that MSVC code in existing projects is applied to clang-cl too.

> 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
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

--
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

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

Mateusz Loskot
On 11 September 2017 at 17:04, Konstantin Tokarev <[hidden email]> wrote:

> 11.09.2017, 17:59, "Mateusz Loskot" <[hidden email]>:
>> 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?
>
> Yes. clang-cl is mostly compatible with MSVC on the command line


Mostly, or less or more, it's subjective and my experience show it is not
as compatible as one may expect.
Also, AFAIU, compatibility is only at driver level that is command
line interface.

> so it's natural that MSVC code in existing projects is applied to clang-cl too.

I'd rather expect CL.exe exclusively considered as CL.exe

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

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
--
Mateusz Loskot
http://mateusz.loskot.net
Reply | Threaded
Open this post in threaded view
|

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

Konstantin Tokarev


11.09.2017, 18:12, "Mateusz Loskot" <[hidden email]>:

> On 11 September 2017 at 17:04, Konstantin Tokarev <[hidden email]> wrote:
>>  11.09.2017, 17:59, "Mateusz Loskot" <[hidden email]>:
>>>  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?
>>
>>  Yes. clang-cl is mostly compatible with MSVC on the command line
>
> Mostly, or less or more, it's subjective and my experience show it is not
> as compatible as one may expect.
> Also, AFAIU, compatibility is only at driver level that is command
> line interface.
>
>>  so it's natural that MSVC code in existing projects is applied to clang-cl too.
>
> I'd rather expect CL.exe exclusively considered as CL.exe

For fine-grained distinction you have CMAKE_CXX_COMPILER_ID

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

--
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

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

Mateusz Loskot
On 12 September 2017 at 14:53, Konstantin Tokarev <[hidden email]> wrote:

> 11.09.2017, 18:12, "Mateusz Loskot" <[hidden email]>:
>> On 11 September 2017 at 17:04, Konstantin Tokarev <[hidden email]> wrote:
>>>  11.09.2017, 17:59, "Mateusz Loskot" <[hidden email]>:
>>>>
>>>>  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?
>>>
>>>  Yes. clang-cl is mostly compatible with MSVC on the command line
>>
>> Mostly, or less or more, it's subjective and my experience show it is not
>> as compatible as one may expect.
>> Also, AFAIU, compatibility is only at driver level that is command
>> line interface.
>>
>>>  so it's natural that MSVC code in existing projects is applied to clang-cl too.
>>
>> I'd rather expect CL.exe exclusively considered as CL.exe
>
> For fine-grained distinction you have CMAKE_CXX_COMPILER_ID


I'll switch over to that one. Thanks

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

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
--
Mateusz Loskot
http://mateusz.loskot.net