diff options
| -rw-r--r-- | baz/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | cmake/dotnet.cmake | 16 |
2 files changed, 15 insertions, 4 deletions
diff --git a/baz/CMakeLists.txt b/baz/CMakeLists.txt index 0813bcc..97387ce 100644 --- a/baz/CMakeLists.txt +++ b/baz/CMakeLists.txt @@ -1,5 +1,4 @@ add_dotnet_library(Baz SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Baz.cs + NATIVE_DEPENDS hello_c ) - -add_dependencies(Baz hello_c) diff --git a/cmake/dotnet.cmake b/cmake/dotnet.cmake index cd848e2..26d6c10 100644 --- a/cmake/dotnet.cmake +++ b/cmake/dotnet.cmake @@ -1,5 +1,5 @@ function(add_dotnet_library NAME) - set(multiValueArgs SOURCES REFERENCES DEPENDS) + set(multiValueArgs SOURCES REFERENCES DEPENDS NATIVE_DEPENDS) cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "${multiValueArgs}" @@ -20,6 +20,9 @@ function(add_dotnet_library NAME) foreach(dep IN LISTS arg_DEPENDS) list(APPEND DEPS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dep}.dll) endforeach() + foreach(dep IN LISTS arg_NATIVE_DEPENDS) + list(APPEND DEPS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${dep}.so) + endforeach() add_custom_command( OUTPUT ${OUTPUT_FILE} @@ -42,6 +45,9 @@ function(add_dotnet_library NAME) foreach(dep IN LISTS arg_DEPENDS) add_dependencies(${NAME} ${dep}) endforeach() + foreach(dep IN LISTS arg_NATIVE_DEPENDS) + add_dependencies(${NAME} ${dep}) + endforeach() set_target_properties(${NAME} PROPERTIES DOTNET_ALL_REFS "" @@ -52,7 +58,7 @@ endfunction() function(add_dotnet_executable NAME) set(oneValueArgs MAIN) - set(multiValueArgs SOURCES REFERENCES DEPENDS) + set(multiValueArgs SOURCES REFERENCES DEPENDS NATIVE_DEPENDS) cmake_parse_arguments(PARSE_ARGV 1 arg "" "${oneValueArgs}" "${multiValueArgs}" @@ -84,6 +90,9 @@ function(add_dotnet_executable NAME) foreach(dep IN LISTS arg_DEPENDS) list(APPEND DEPS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dep}.dll) endforeach() + foreach(dep IN LISTS arg_NATIVE_DEPENDS) + list(APPEND DEPS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${dep}.so) + endforeach() add_custom_command( OUTPUT ${OUTPUT_FILE} @@ -106,6 +115,9 @@ function(add_dotnet_executable NAME) foreach(dep IN LISTS arg_DEPENDS) add_dependencies(${NAME} ${dep}) endforeach() + foreach(dep IN LISTS arg_NATIVE_DEPENDS) + add_dependencies(${NAME} ${dep}) + endforeach() set_target_properties(${NAME} PROPERTIES DOTNET_ALL_REFS "" |
