[CMake] Not sure how to list C# files in the generated Visual Studio project
David Cole
david.cole at kitware.com
Sat Oct 1 13:50:19 EDT 2011
On Mon, Sep 26, 2011 at 11:37 AM, Stephen Torri <stephen.torri at gmail.com>wrote:
> I am using CMake to run SWIG to generate C# wrapper files for a
> project. While the attached CMakeLists.txt file produces a Visual
> Studio solutions that builds the C++ library, C# wrapper library and
> C# prototype executable I don't know first if I am using CMake
> correctly in this case.
If it works, then it is not incorrect. :-)
add_custom_command is the "right" way to build C# files driven by a
CMakeLists.txt file at present.
We've had feature requests before to add better C# support, but no serious
funders to back a full implementation of generating *.csproj files for C#
libs and executables. See this bug report (and related ones) for more info,
specifically, this bug note:
http://public.kitware.com/Bug/view.php?id=7918#c22170
Secondly I am not sure what to do to list the
> C# files in the visual studio project so that I can quickly go to a
> the definition of a C# type for example. I would appreciate any
> feedback on how to improve the CMakeLists.txt file.
>
You probably should not try to list the *.cs files in a *.vcproj file... Not
sure what Visual Studio will do with such a condition. But you can try:
simply add the *.cs files as "SOURCES" for the custom target and they should
show up. If VS tries to compile them when you do that, in addition to the
custom build rules you're already specifying, then we may have to find a way
to avoid that... Give it a shot and let us know.
See the documentation on SOURCES in the add_custom_target help:
http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_target
HTH,
David C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111001/e03f1035/attachment.htm>
More information about the CMake
mailing list