summaryrefslogtreecommitdiffstats
path: root/Tests/CSharpLinkToCxx/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-21 12:46:12 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-21 12:46:12 (GMT)
commitfff7d8c666e436d9a1a33865d87668e9cf6ff0da (patch)
treea89c2d67cd8d7fe0cd7dbef1fb74d8268835b93b /Tests/CSharpLinkToCxx/CMakeLists.txt
parentab4c3270ae7062a8f3296055b9f6443b80f3aef2 (diff)
parent51865fc67ecd61d9cbf984be0310f2e9fb8ff455 (diff)
downloadCMake-fff7d8c666e436d9a1a33865d87668e9cf6ff0da.zip
CMake-fff7d8c666e436d9a1a33865d87668e9cf6ff0da.tar.gz
CMake-fff7d8c666e436d9a1a33865d87668e9cf6ff0da.tar.bz2
Merge branch 'vs_csharp_link_to_managed_cxx' into release-3.9
Diffstat (limited to 'Tests/CSharpLinkToCxx/CMakeLists.txt')
-rw-r--r--Tests/CSharpLinkToCxx/CMakeLists.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/CSharpLinkToCxx/CMakeLists.txt b/Tests/CSharpLinkToCxx/CMakeLists.txt
new file mode 100644
index 0000000..c4269e0
--- /dev/null
+++ b/Tests/CSharpLinkToCxx/CMakeLists.txt
@@ -0,0 +1,17 @@
+# test if CSharp application correctly links
+# to managed C++ binary
+cmake_minimum_required(VERSION 3.9)
+project (CSharpLinkToCxx CXX CSharp)
+
+# we have to change the default flags for the
+# managed C++ project to build
+string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
+
+add_library(CLIApp SHARED cli.hpp cli.cpp)
+
+target_compile_options(CLIApp PRIVATE "/clr")
+
+add_executable(CSharpLinkToCxx csharp.cs)
+
+target_link_libraries(CSharpLinkToCxx CLIApp)