blob: 3d1427d741685b1e37fc6f88c9c51054b8d1e098 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Program.cs)
set(TARGET HelloCMake)
set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/${TARGET}.dll)
add_custom_command(
OUTPUT ${OUTPUT_FILE}
COMMAND dotnet ${CSC_DLL}
-target:exe
-out:${OUTPUT_FILE}
-lib:${RUNTIME_DIR}
-reference:System.Private.CoreLib.dll
-reference:System.Runtime.dll
-reference:System.Console.dll
-reference:${CMAKE_BINARY_DIR}/FooBar.dll
-main:Program
${SOURCES}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/HelloCMake.runtimeconfig.json
${CMAKE_BINARY_DIR}/${TARGET}.runtimeconfig.json
DEPENDS ${SOURCES} ${CMAKE_BINARY_DIR}/FooBar.dll
COMMENT "Compiling ${TARGET} with Roslyn csc..."
)
add_custom_target(${TARGET} ALL DEPENDS ${OUTPUT_FILE})
add_dependencies(${TARGET} FooBar)
|