Commit a7dd8e66 authored by Michael Stürmer's avatar Michael Stürmer

VS: added support for C# (for Visual Studio 2010, 2012, 2013, 2015)

parent 6fda6005
Pipeline #42489 passed with stage
......@@ -34,10 +34,6 @@ if(NOT CMAKE_CSharp_COMPILER_WORKS)
# Move result from cache to normal variable.
set(CMAKE_CSharp_COMPILER_WORKS ${CMAKE_CSharp_COMPILER_WORKS})
unset(CMAKE_CSharp_COMPILER_WORKS CACHE)
if(NOT CMAKE_CSharp_COMPILER_WORKS)
message("forcing compiler works to true (will be removed once C# support is integrated)")
set(CMAKE_CSharp_COMPILER_WORKS 1)
endif()
set(CSharp_TEST_WAS_RUN 1)
endif()
......
This diff is collapsed.
......@@ -56,6 +56,7 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteMSToolConfigurationValues(std::string const& config);
void WriteMSToolConfigurationValuesManaged(std::string const& config);
void WriteHeaderSource(cmSourceFile const* sf);
void WriteExtraSource(cmSourceFile const* sf);
void WriteNsightTegraConfigurationValues(std::string const& config);
......
......@@ -325,6 +325,9 @@ if(BUILD_TESTING)
endif()
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^789]|[789][0-9])")
ADD_TEST_MACRO(CSharpOnly CSharpOnly)
endif()
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
......
# a simple CSharp only test case
project (CSharpOnly CSharp)
# C# does not make any difference between STATIC and SHARED libs
add_library(lib1 STATIC lib1.cs)
add_library(lib2 SHARED lib2.cs)
add_executable(CSharpOnly csharponly.cs)
target_link_libraries(CSharpOnly lib1 lib2)
namespace CSharpOnly
{
class CSharpOnly
{
public static void Main(string[] args)
{
int val = Lib1.getResult();
Lib2 l = new Lib2();
val = l.myVal;
return;
}
}
}
namespace CSharpOnly
{
public class Lib1
{
public static int getResult()
{
return 23;
}
}
}
namespace CSharpOnly
{
public class Lib2
{
public int myVal = 42;
public Lib2()
{}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment