summaryrefslogtreecommitdiffstats
path: root/Tests/CSharpLinkToCxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-01 15:26:35 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-02 18:58:11 (GMT)
commit375b420fdfe4eb34e92b98bb648ba37de3691c2e (patch)
treedd9fefe53eae946d7b80394d931090cb62635318 /Tests/CSharpLinkToCxx
parent8b21aa0af00a6366c301241bab081f2daae6104c (diff)
downloadCMake-375b420fdfe4eb34e92b98bb648ba37de3691c2e.zip
CMake-375b420fdfe4eb34e92b98bb648ba37de3691c2e.tar.gz
CMake-375b420fdfe4eb34e92b98bb648ba37de3691c2e.tar.bz2
CSharp: Fix regression in VS project type selection
A that target contains only `.cs` sources should be generated as a `.csproj` project even if it links to non-CSharp static libraries. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) enforces its "exclusive" check on the combined set of source file languages and the link language. To restore the original `TargetIsCSharpOnly` semantics, update `HasLanguage` to enforce exclusiveness only on the list of sources. Fixes: #18239
Diffstat (limited to 'Tests/CSharpLinkToCxx')
-rw-r--r--Tests/CSharpLinkToCxx/CMakeLists.txt6
-rw-r--r--Tests/CSharpLinkToCxx/cpp_static.cpp3
2 files changed, 9 insertions, 0 deletions
diff --git a/Tests/CSharpLinkToCxx/CMakeLists.txt b/Tests/CSharpLinkToCxx/CMakeLists.txt
index 153c57c..a3067af 100644
--- a/Tests/CSharpLinkToCxx/CMakeLists.txt
+++ b/Tests/CSharpLinkToCxx/CMakeLists.txt
@@ -21,3 +21,9 @@ target_link_libraries(CSharpLinkToCxx CLIApp)
# because it is unmanaged
add_library(CppNativeApp SHARED cpp_native.hpp cpp_native.cpp)
target_link_libraries(CSharpLinkToCxx CppNativeApp)
+
+# Link a static C++ library into the CSharp executable.
+# We do not actually use any symbols but this helps cover
+# link language selection.
+add_library(CppStaticLib STATIC cpp_static.cpp)
+target_link_libraries(CSharpLinkToCxx CppStaticLib)
diff --git a/Tests/CSharpLinkToCxx/cpp_static.cpp b/Tests/CSharpLinkToCxx/cpp_static.cpp
new file mode 100644
index 0000000..9af2b6e
--- /dev/null
+++ b/Tests/CSharpLinkToCxx/cpp_static.cpp
@@ -0,0 +1,3 @@
+void cpp_static()
+{
+}