cmake_minimum_required(VERSION 3.18 )
project(CMakeCSharpDemos LANGUAGES CSharp)
add_executable(CMakeCSharpDemo "Program.cs")
set(CMAKE_CSharp_FLAGS "/langversion:latest")
set_property(TARGET CMakeCSharpDemo PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6.1")
set_property(TARGET CMakeCSharpDemo PROPERTY VS_DOTNET_REFERENCES
"Microsoft.CSharp"
"System"
"System.Core"
"System.Data"
"System.Deployment"
"System.Drawing"
"System.Xml"
"System.Xml.Linq")
namespace CMakeCSharpDemo
{
public class Program
{
public static void Main(string[] args)
{
System.Console.WriteLine("Hello World!");
System.Console.ReadLine();
}
}
}