[CMake] Clang/C2 Visual Studio generator non-functional with cmake v3.6.1 and v3.6.2

Brad Gibson b2b at humanenginuity.com
Fri Sep 9 19:17:29 EDT 2016


Hi everyone.

I've been working on this issue for almost 2 weeks now, originally with 
cmake v3.6.1 and now with cmake v3.6.2.  I have looked far and wide for 
help, but with Clang/C2 support under Visual Studio being experimental, 
I haven't been able to find much.

The problem is that when I run the line
   cmake -G "Visual Studio 14 2015" -T "v140_clang_3_8"

  cmake reports
     -- The C compiler identification is unknown
     -- The CXX compiler identification is unknown
     ...

I have visited the source code and saw that cmake appears to be matching 
against "v[\d]+_clang_.*", so the above switch should work, AFAICT.  I 
have tried "v140_clang_3_7" as well, to be certain, and get the same 
behavior.

Everything works fine, of course without the -T "v140_clang_3_8", but 
generates VC++ project files, of course.

Here is my Visual Studio version information:
   Microsoft Visual Studio Community 2015
   Version 14.0.25425.01 Update 3
   Microsoft .NET Framework
   Version 4.6.02001

   Installed Version: Community
   ...
   Visual C++ 2015   00322-20000-00000-AA060
   Microsoft Visual C++ 2015
   ...
   Clang with Microsoft CodeGen   14.0.25516
   Clang with Microsoft CodeGen

I have ensured Clang/C2 is on my path (C:\Program Files (x86)\Microsoft 
Visual Studio 14.0\VC\ClangC2\bin\x86).

I know the feature is experimental, but I'm pretty sure it's supposed to 
do more than this... :)  Any ideas on what I should be checking?

CMakeError.log excerpt:

Compiling the C compiler identification source file "CMakeCCompilerId.c" 
failed.
Compiler: gcc
Build flags:
Id flags:

The output was:
1
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 9/9/2016 4:13:27 PM.
Project 
"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdC\CompilerIdC.vcxproj" 
on node 1 (default targets).
C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): 
error MSB8020: The build tools for v140_clang_3_8 (Platform Toolset = 
'v140_clang_3_8') cannot be found. To build using the v140_clang_3_8 
build tools, please install v140_clang_3_8 build tools.  Alternatively, 
you may upgrade to the current Visual Studio tools by selecting the 
Project menu or right-click the solution, and then selecting "Retarget 
solution". 
[C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project 
"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdC\CompilerIdC.vcxproj" 
(default targets) -- FAILED.

Build FAILED.

"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdC\CompilerIdC.vcxproj" 
(default target) (1) ->
(PlatformPrepareForBuild target) ->
   C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): 
error MSB8020: The build tools for v140_clang_3_8 (Platform Toolset = 
'v140_clang_3_8') cannot be found. To build using the v140_clang_3_8 
build tools, please install v140_clang_3_8 build tools.  Alternatively, 
you may upgrade to the current Visual Studio tools by selecting the 
Project menu or right-click the solution, and then selecting "Retarget 
solution". 
[C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdC\CompilerIdC.vcxproj]

     0 Warning(s)
     1 Error(s)

Time Elapsed 00:00:00.10


Checking whether the C compiler is IAR using "" did not match "IAR .+ 
Compiler":
gcc: fatal error: no input files
compilation terminated.
Compiling the CXX compiler identification source file 
"CMakeCXXCompilerId.cpp" failed.
Compiler: g++
Build flags:
Id flags:

The output was:
1
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 9/9/2016 4:13:28 PM.
Project 
"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdCXX\CompilerIdCXX.vcxproj" 
on node 1 (default targets).
C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): 
error MSB8020: The build tools for v140_clang_3_8 (Platform Toolset = 
'v140_clang_3_8') cannot be found. To build using the v140_clang_3_8 
build tools, please install v140_clang_3_8 build tools.  Alternatively, 
you may upgrade to the current Visual Studio tools by selecting the 
Project menu or right-click the solution, and then selecting "Retarget 
solution". 
[C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdCXX\CompilerIdCXX.vcxproj]
Done Building Project 
"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdCXX\CompilerIdCXX.vcxproj" 
(default targets) -- FAILED.

Build FAILED.

"C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdCXX\CompilerIdCXX.vcxproj" 
(default target) (1) ->
(PlatformPrepareForBuild target) ->
   C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): 
error MSB8020: The build tools for v140_clang_3_8 (Platform Toolset = 
'v140_clang_3_8') cannot be found. To build using the v140_clang_3_8 
build tools, please install v140_clang_3_8 build tools.  Alternatively, 
you may upgrade to the current Visual Studio tools by selecting the 
Project menu or right-click the solution, and then selecting "Retarget 
solution". 
[C:\Users\bRad\Development\FIT-MFA\Builds\CMakeFiles\3.6.2\CompilerIdCXX\CompilerIdCXX.vcxproj]

     0 Warning(s)
     1 Error(s)

Time Elapsed 00:00:00.10


Checking whether the CXX compiler is IAR using "" did not match "IAR .+ 
Compiler":
g++: fatal error: no input files
compilation terminated.

--

Many thanks,
-Brad


More information about the CMake mailing list