[CMake] C# support?
James Johnston
JamesJ at motionview3d.com
Fri Jun 26 12:16:06 EDT 2015
> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Stuermer,
> Michael SP/HZA-ZSEP
> Sent: Friday, June 26, 2015 14:47
> To: cmake-developers at cmake.org; cmake at cmake.org
> Subject: [CMake] C# support?
>
> Hi and sorry for cross-posting this on both lists,
>
> I checked the mailing list history about the C#/.NET support topic and
realized
> that the interest in C# support seems to have declined a bit.
>
> I am right now in the need of good C# support and adding external project
> files is not that much of an option to me. So I started hacking away
> everything that is needed for .csproj generation and support of mixed
> managed/unmanaged targets. Not yet done, but there is a light at the end
of
> the tunnel.
>
> Now the question: is there any real interest at all in this feature? Does
it have
> a realistic chance to be accepted for upstream or will I have to maintain
my
> own fork of CMake?
>
Well, I have only just recently started using CMake. So I am not speaking
from a great deal of experience. But I am currently converting over a bunch
of stuff into a set of CMake projects. (must be multiple CMake projects
built by a superbuild via ExternalProject because we use three different
C/C++ compilers and target three different CPU architectures.)
Part of that "stuff" involves a mixture of Visual Studio projects involving
(1) 100% unmanaged C++ code: this is the easy stuff to move to CMake, (2)
C++/CLI mixed mode projects, (3) C# projects that consume the mixed mode
C++/CLI projects. I have yet to start working on that part of the CMake
migration, but I'm not looking forward to figuring out how to make the C#
projects consume the build output from the C++/CLI projects and still have
the Visual C# projects be easy to add/remove files from. All these
particular projects are targeting Visual Studio 2008 32-bit, so it *ought*
be possible to use them all from one single CMake build tree & one single
Visual Studio solution...
I have seen include_external_msproject CMake command:
http://www.cmake.org/cmake/help/v3.3/command/include_external_msproject.html
But it's not clear to me how I'd make the C# project depend on other CMake
targets (i.e. the mixed mode C++ projects). The best I've thought of would
be to use configure_file to modify the project to substitute the compiled
C++ DLLs in the references section of the project. But then it will be a
pain to modify the original C# projects in SOURCE_DIR. And also, the C#
project normally has relative paths, so if it gets configure_file'd into
BINARY_DIR all the source code paths will break.
I guess all the above is to say, I'm interested in that feature. But I may
be too much of a newbie at CMake to say whether that is a good "CMake way"
of doing things. I still need to experiment with the above command, and
read up on old mailing list messages on the subject.
But it seems to me the logical way for supporting C# would be: (1) it
becomes a first-class language that can be mentioned in the project()
command, (2) therefore, all the generators can use it, so you aren't
restricted to Visual Studio generator (I like the Ninja generator because
it's faster than Visual Studio), (3) Visual Studio generator would emit a
solution containing generated VC++/VC# projects. Anything else feels like a
bit of a hack to me. But #1 thru #3 sounds like a lot of work though...
Also, C# doesn't compile to object files - does CMake currently support the
concept of a language that doesn't require separate compiling/linking steps?
Best regards,
James Johnston
More information about the CMake
mailing list