mirror of
https://github.com/reactos/CMake.git
synced 2024-12-13 14:27:23 +00:00
parent
b7799f07d1
commit
51865fc67e
@ -3475,10 +3475,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
|
|||||||
->TargetIsFortranOnly(dt)) {
|
->TargetIsFortranOnly(dt)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (csproj == this->ProjectType &&
|
|
||||||
!this->GlobalGenerator->TargetIsCSharpOnly(dt)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
this->WriteString("<ProjectReference Include=\"", 2);
|
this->WriteString("<ProjectReference Include=\"", 2);
|
||||||
cmLocalGenerator* lg = dt->GetLocalGenerator();
|
cmLocalGenerator* lg = dt->GetLocalGenerator();
|
||||||
std::string name = dt->GetName();
|
std::string name = dt->GetName();
|
||||||
|
@ -331,6 +331,7 @@ if(BUILD_TESTING)
|
|||||||
|
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])")
|
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])")
|
||||||
ADD_TEST_MACRO(CSharpOnly CSharpOnly)
|
ADD_TEST_MACRO(CSharpOnly CSharpOnly)
|
||||||
|
ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ADD_TEST_MACRO(COnly COnly)
|
ADD_TEST_MACRO(COnly COnly)
|
||||||
|
17
Tests/CSharpLinkToCxx/CMakeLists.txt
Normal file
17
Tests/CSharpLinkToCxx/CMakeLists.txt
Normal file
@ -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)
|
10
Tests/CSharpLinkToCxx/cli.cpp
Normal file
10
Tests/CSharpLinkToCxx/cli.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "cli.hpp"
|
||||||
|
|
||||||
|
using namespace System;
|
||||||
|
|
||||||
|
namespace CLIApp {
|
||||||
|
void MyCli::testMyCli()
|
||||||
|
{
|
||||||
|
Console::WriteLine("#message from CLIApp");
|
||||||
|
}
|
||||||
|
}
|
10
Tests/CSharpLinkToCxx/cli.hpp
Normal file
10
Tests/CSharpLinkToCxx/cli.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace CLIApp {
|
||||||
|
public
|
||||||
|
ref class MyCli
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void testMyCli();
|
||||||
|
};
|
||||||
|
}
|
16
Tests/CSharpLinkToCxx/csharp.cs
Normal file
16
Tests/CSharpLinkToCxx/csharp.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using CLIApp;
|
||||||
|
|
||||||
|
namespace CSharpLinkToCxx
|
||||||
|
{
|
||||||
|
internal class CSharpLinkToCxx
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("#message from CSharpLinkToCxx");
|
||||||
|
|
||||||
|
var app = new MyCli();
|
||||||
|
app.testMyCli();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user