summaryrefslogtreecommitdiffstats
path: root/hello/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'hello/CMakeLists.txt')
-rw-r--r--hello/CMakeLists.txt29
1 files changed, 6 insertions, 23 deletions
diff --git a/hello/CMakeLists.txt b/hello/CMakeLists.txt
index 3d1427d..d726950 100644
--- a/hello/CMakeLists.txt
+++ b/hello/CMakeLists.txt
@@ -1,25 +1,8 @@
-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_dotnet_executable(HelloCMake
+ MAIN Program
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Program.cs
)
-add_custom_target(${TARGET} ALL DEPENDS ${OUTPUT_FILE})
-add_dependencies(${TARGET} FooBar)
+target_link_dotnet_libraries(HelloCMake
+ LIBRARIES FooBar
+)