diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2017-01-09 15:34:13 (GMT) |
---|---|---|
committer | Michael Stürmer <michael.stuermer@schaeffler.com> | 2017-01-13 08:28:13 (GMT) |
commit | a7dd8e669289e7b78ebc05b5d337052f32582038 (patch) | |
tree | 5142590a9f2f520e4dc0f9e70524d633c8f3a023 /Tests | |
parent | 6fda6005b306cc4a1e9e9e66d9cd4525fc623f73 (diff) | |
download | CMake-a7dd8e669289e7b78ebc05b5d337052f32582038.zip CMake-a7dd8e669289e7b78ebc05b5d337052f32582038.tar.gz CMake-a7dd8e669289e7b78ebc05b5d337052f32582038.tar.bz2 |
VS: added support for C# (for Visual Studio 2010, 2012, 2013, 2015)
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/CSharpOnly/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/CSharpOnly/csharponly.cs | 15 | ||||
-rw-r--r-- | Tests/CSharpOnly/lib1.cs | 10 | ||||
-rw-r--r-- | Tests/CSharpOnly/lib2.cs | 10 |
5 files changed, 48 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 73eef9a..4945b31 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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) diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt new file mode 100644 index 0000000..0e3e39e --- /dev/null +++ b/Tests/CSharpOnly/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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) diff --git a/Tests/CSharpOnly/csharponly.cs b/Tests/CSharpOnly/csharponly.cs new file mode 100644 index 0000000..ad4641a --- /dev/null +++ b/Tests/CSharpOnly/csharponly.cs @@ -0,0 +1,15 @@ +namespace CSharpOnly +{ + class CSharpOnly + { + public static void Main(string[] args) + { + int val = Lib1.getResult(); + + Lib2 l = new Lib2(); + val = l.myVal; + + return; + } + } +} diff --git a/Tests/CSharpOnly/lib1.cs b/Tests/CSharpOnly/lib1.cs new file mode 100644 index 0000000..7a7ae10 --- /dev/null +++ b/Tests/CSharpOnly/lib1.cs @@ -0,0 +1,10 @@ +namespace CSharpOnly +{ + public class Lib1 + { + public static int getResult() + { + return 23; + } + } +} diff --git a/Tests/CSharpOnly/lib2.cs b/Tests/CSharpOnly/lib2.cs new file mode 100644 index 0000000..b4b38ce --- /dev/null +++ b/Tests/CSharpOnly/lib2.cs @@ -0,0 +1,10 @@ +namespace CSharpOnly +{ + public class Lib2 + { + public int myVal = 42; + + public Lib2() + {} + } +} |