On 04/21/2016 10:15 AM, Johan Holmberg wrote:
> I chose the binaries behaving like "gcc"
> 
> I realize that Cristian Adams recommended using the "cl.exe" wrapper in
> his response, but I wanted at least to try using the "gcc-like" binaries
> first, hoping that they should work with CMake.

I think that is the problem.  See below.

> E:\work\proj\hello1\build> cmake -GNinja ..\src
> -- The C compiler identification is Clang 3.8.0
> -- The CXX compiler identification is Clang 3.8.0

>From the compiler id files you sent me I see:

    $ strings build/CMakeFiles/3.5.1/CompilerIdC/a.exe | grep INFO
    INFO:compiler[Clang]
    INFO:simulate[MSVC]
    INFO:compiler_version[00000003.00000008.00000000]
    INFO:simulate_version[00000018.00000000]
    INFO:platform[Windows]
    INFO:arch[x64]
    INFO:dialect_default[11]

    $ strings build/CMakeFiles/3.5.1/CompilerIdCXX/a.exe | grep INFO
    INFO:compiler[Clang]
    INFO:simulate[MSVC]
    INFO:platform[Windows]
    INFO:arch[x64]
    INFO:dialect_default[11]
    INFO:compiler_version[00000003.00000008.00000000]
    INFO:simulate_version[00000018.00000000]

The "INFO:simulate[MSVC]" lines mean that CMake has detected that the given
Clang compiler defines _MSC_VER and therefore acts like MSVC and not GNU
(i.e. uses the msvc ABI instead of the gnu ABI).

CMake then assumes that the compiler command line is compatible with "cl".
We have code that switches off this here:

 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows-Clang.cmake;hb=v3.5.2
 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/Clang.cmake;hb=v3.5.2

When all that was written clang-cl was still under development and our
assumption was that there is no such thing as a Clang that acts like
MSVC but is not cl-compatible on the command line.

-Brad

-- 

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 via email to