diff options
author | Kinan Mahdi <kinan.mahdi@gmail.com> | 2020-02-18 16:06:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-28 16:42:01 (GMT) |
commit | ac6b18cd907392e4a6d5d76ac0f9e173a9cc7e32 (patch) | |
tree | 23315246444c32b4f30503e07518fd2cb87245d8 /Tests/CSharpOnly | |
parent | 8625ffd939b3c74944f6da9652777f7ca137b856 (diff) | |
download | CMake-ac6b18cd907392e4a6d5d76ac0f9e173a9cc7e32.zip CMake-ac6b18cd907392e4a6d5d76ac0f9e173a9cc7e32.tar.gz CMake-ac6b18cd907392e4a6d5d76ac0f9e173a9cc7e32.tar.bz2 |
CSharp: Add support for source groups with out-of-source builds
This also fixes support for multiple sources of the same name in
different directories. Add a test for both problems.
Issue: #19505
Diffstat (limited to 'Tests/CSharpOnly')
-rw-r--r-- | Tests/CSharpOnly/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CSharpOnly/csharponly.cs | 4 | ||||
-rw-r--r-- | Tests/CSharpOnly/nested/lib1.cs | 13 |
3 files changed, 17 insertions, 4 deletions
diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt index 82049c7..42cbe2e 100644 --- a/Tests/CSharpOnly/CMakeLists.txt +++ b/Tests/CSharpOnly/CMakeLists.txt @@ -2,7 +2,9 @@ project (CSharpOnly CSharp) # C# does not make any difference between STATIC and SHARED libs -add_library(lib1 STATIC lib1.cs) +add_library(lib1 STATIC lib1.cs nested/lib1.cs) +#without the source group this test will fail to compile +source_group(nested FILES nested/lib1.cs) add_library(lib2 SHARED lib2.cs) add_executable(CSharpOnly csharponly.cs) diff --git a/Tests/CSharpOnly/csharponly.cs b/Tests/CSharpOnly/csharponly.cs index ad4641a..3890c82 100644 --- a/Tests/CSharpOnly/csharponly.cs +++ b/Tests/CSharpOnly/csharponly.cs @@ -5,10 +5,8 @@ namespace CSharpOnly public static void Main(string[] args) { int val = Lib1.getResult(); - Lib2 l = new Lib2(); - val = l.myVal; - + val = val + l.myVal + nested.Lib1.getResult(); return; } } diff --git a/Tests/CSharpOnly/nested/lib1.cs b/Tests/CSharpOnly/nested/lib1.cs new file mode 100644 index 0000000..c2fde4b --- /dev/null +++ b/Tests/CSharpOnly/nested/lib1.cs @@ -0,0 +1,13 @@ +namespace CSharpOnly +{ + namespace nested + { + public class Lib1 + { + public static int getResult() + { + return 23; + } + } + } +} |