Skip to content

C# support: add compiler detection for MSVC

This MR adds detection of the C# compiler for Visual Studio Generators 2010 and newer.

To make the current state of the MR easier to track/understand I rewrite this description a bit:

Compiler detection now works very similar to C/C++ compiler detection. Some things have to be done differently however. Especially the version of the C# compiler cannot be compiled in the test binary.

There is a minimal test CMakeOnly.CompilerIdCSharp which checks for existence and id of a C# compiler

The default values of the C# compiler flags introduced in CMakeCSharpInformation.cmake are completely open for discussion, I do not know which one should really be the defaults or what Microsoft considers to be best choice

The test CMakeOnly.CompilerIdCSharp runs a try_compile() command at some point where a simple .csproj file is generated and compiled. As .csproj generation is not yet integrated this fails for VS10 (VS11-14 work). With the upcoming changes in cmVisualStudio10TargetGenerator the try_compile works for VS10 as well. To avoid errors the test compiler script is forced to work and prints a message.

Merge request reports

Loading