Skip to content

Commit 2eaee79

Browse files
authored
Merge pull request #104 from mVento3/cmake
CMake support
2 parents 5e5fe0a + d136f2b commit 2eaee79

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is not used for compiling but used
2+
# when generating project using CMake generator.
3+
# If you are not using CMake then just open .sln file
4+
5+
cmake_minimum_required(VERSION 3.22)
6+
7+
project(CppAst.NET CSharp)
8+
9+
set(CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS} /langversion:latest")
10+
11+
set(CMAKE_DOTNET_TARGET_FRAMEWORK net8.0)
12+
set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")
13+
14+
add_subdirectory(src)

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cmake_minimum_required(VERSION 3.22)
2+
3+
add_subdirectory(CppAst)
4+
add_subdirectory(CppAst.Tests)

src/CppAst.Tests/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cs)
2+
3+
add_library(CppAst.Tests SHARED ${SOURCE_FILES})
4+
5+
set_target_properties(CppAst.Tests PROPERTIES
6+
VS_PACKAGE_REFERENCES "Microsoft.NET.Test.Sdk_17.8.0;nunit_4.0.1;NUnit3TestAdapter_4.5.0"
7+
)
8+
9+
target_compile_options(CppAst.Tests PUBLIC "/unsafe")
10+
target_link_libraries(CppAst.Tests CppAst)

src/CppAst/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cs)
2+
3+
set(CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS} /langversion:7.3")
4+
5+
add_library(CppAst SHARED ${SOURCE_FILES})
6+
7+
set_target_properties(CppAst PROPERTIES
8+
VS_PACKAGE_REFERENCES "ClangSharp_17.0.1;Irony_1.2.0"
9+
)
10+
11+
target_compile_options(CppAst PUBLIC "/unsafe")

0 commit comments

Comments
 (0)