[cmake-developers] [PATCH SET] Support of Clang/C2 compiler

Brad King brad.king at kitware.com
Wed Mar 9 09:37:13 EST 2016


On 02/27/2016 09:38 AM, Mariusz Pluciński wrote:
> Following is the list of patches with descriptions:

Thanks!

> 1. kwsys: fix build on VS Clang/C2 toolset
> Makes it possible to build CMake itself with Clang/C2.

Applied to KWSys [upstream] (http://review.source.kitware.com/#/c/20856/)
and merged to CMake.

> 2. CMakeDetermineCompilerId: allow to detect clang.exe bundled with Visual Studio
> CMAKE_C(XX)?_COMPILER variables should point to clang.exe instead of cl.exe
> 
> 3. Visual Studio: in Clang/C2 toolset, setup correct compiler settings
> clang.exe takes most of options in clang/gcc-compatible format instead of cl.exe format.
> 
> 4. Clang testable features: don't enable cxx_decltype_incomplete_return_type in MSVC simluation mode
> This feature does not work. Honestly, I am not sure about the reason - may be the bug in the compiler.
> 
> 5. Visual Studio 14: support of <CppLanguageStandard> tag in project files
> Projects using Clang/C2 use this tag to control language standard version.

Applied with minor tweaks:

 CMakeDetermineCompilerId: Add detection of clang.exe bundled with VS
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a0c98ce

 VS: in Clang/C2 toolset, setup correct compiler settings
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f913700

 Features: Clang has no cxx_decltype_incomplete_return_type in MSVC sim mode
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99b38f32

 VS 14: Add flag map for -std= to CppLanguageStandard tag in project files
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=384a9f6b

Mostly I changed use of CMAKE_GENERATOR_TOOLSET to CMAKE_VS_PLATFORM_TOOLSET.
The former is the user input.  The latter is provided by the VS generator to
indicate the actual toolset chosen, even if it is just a default when the
user does not specify one.

> 6. Tests: fix AliasTarget building on Clang/C2
> Clang in C++98 mode is unable to parse some of headers bundled with MSVC, so using C++11 is necessary.
> 
> 7. Tests: fix Module.GenerateExportHeader building on Clang/C2
> Clang/C2 uses gcc attributes syntax for deprecations, but uses cl.exe syntax for dllimports/exports.
> Also, includes same fix as in patch 6.
> 
> 9. Tests: fix Complex building on Clang/C2
> Same as in patch 6.
> 
> 10. Tests: fix complexOneConfig building on Clang/C2
> Same as in patch 6.
> 
> 12. Tests: fix Plugin building on Clang/C2
> Same as in patch 6.
> 
> 13. Tests: fix PDBDirectoryAndName on Clang/C2
> Clang/C2 does not generate pdb files for static libraries. Note that debugging information is not lost - they're put into the .lib itself, and when the binary is created, they seem to be extracted and placed into binary's own pdb file.
> 
> 14. Tests: do not build PrecompiledHeader on Clang/C2
> Precompiled headers are not (yet?) supported in this compiler.

Applied, thanks:

 Tests: fix AliasTarget building on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ec61500

 Tests: fix Module.GenerateExportHeader building on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a902f24

 Tests: fix Complex building on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7726767a

 Tests: fix complexOneConfig building on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71c09356

 Tests: fix Plugin building on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1e9d121

 Tests: fix PDBDirectoryAndName on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fdd7b6b

 Tests: do not build PrecompiledHeader on Clang/C2
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c8a101e

I also added a release note:

 Help: Add notes for topic 'vs-clang-cl'
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eab94259

> 11. Tests: do not build ExternalProjectLocal/TutorialStep5 when path is too long
> This toolset uses a bit longer names of some files, which may cause full path size to exceed 256 characters.

The condition for this one needs to be thought out a bit more.
We no longer support Windows 98 so the old condition can simply
be replaced.  I expect it applies to all Windows versions anyway.
Anyway, this is mostly orthogonal to Clang/C2 support.

> 8. Tests: fix Module.WriteCompilerDetectionHeader building on Clang/C2
> Visual Studio does not handle this test very well. Not sure why.
> 
> 15. Tests: disable VSMidl on Clang/C2
> I don't know why this test fails.

I'm going to let these fail for now until someone has time to investigate
them more.

Would you be able to run nightly testing with this generator/compiler?
Instructions are here:

 https://cmake.org/Wiki/CMake/Git/Dashboard

Thanks,
-Brad


More information about the cmake-developers mailing list