[cmake-developers] C# support?

Brad King brad.king at kitware.com
Wed Jul 15 10:48:50 EDT 2015


On 07/02/2015 09:53 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> I got the first sort of working version running. Would be great
> if some people could have a look at it if it's going into a
> good direction.

Thanks again for working on this.  Sorry for the delay in response.
I was working on the basic Apple Swift support and thought it could
be a useful example for CSharp work.

> Patch 0001:
>  - adds the necessary Module/* files for enabling C# as a language

Some of the CMakeCSharpInformation module content like:

> +set(CMAKE_CSharp_FLAGS_INIT "/define:TRACE /langversion:3 /nowin32manifest")
> +set(CMAKE_CSharp_FLAGS_DEBUG_INIT "/debug:full /optimize- /warn:3 /errorreport:prompt /define:DEBUG")
> +set(CMAKE_CSharp_FLAGS_RELEASE_INIT "/debug:none /optimize  /warn:1  /errorreport:queue")
> +set(CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT "/debug:full /optimize-")
> +set(CMAKE_CSharp_FLAGS_MINSIZEREL_INIT "/debug:none /optimize")

belongs in a file such as Modules/Platform/Windows-MSVC-CSharp.cmake
file.  The CMakeCSharpInformation file should have only information
specific to the C# language and not any particular toolchain and then
load other modules that provide information specific to the platform
and toolchain vendor (compiler id).  See the recently added
CMakeSwiftInformation module for an example.

> Patch 0002:
>  - some minor changes to mostly visual studio related classes to enable .csproj support
>    o .csproj GUID is added
>    o a method to check if the target is C# is added

Looks good at a glance.

> Patch 0003:
>  - the actual implementation of the .csproj generation
>  - all generation takes place inside VisualStudio10TargetGenerator class

That looks like the right direction.  How did you generate the flag
table?  The other flag tables we have for VS >= 10 generators are
generated by Source/cmparseMSBuildXML.py.  See commit

 VS14: Generate flag tables from MSBuild v140 tool files
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d96b3f68

for an example.  Typically we add a new flag table generated by
the script in one commit and then add follow-up commits to apply
manual tweaks.  That way we know exactly how to reproduce the
table.

Thanks,
-Brad



More information about the cmake-developers mailing list