summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/csharp/CMakeLists.txt20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/csharp/CMakeLists.txt b/src/csharp/CMakeLists.txt
index 1698bcf..8ba7651 100644
--- a/src/csharp/CMakeLists.txt
+++ b/src/csharp/CMakeLists.txt
@@ -1,32 +1,34 @@
# Generate C# wrapper
include_directories(../)
-set(KOLAB_SWIG_CSHARP_SOURCE_FILE csharp_kolabformat_wrapper.cpp)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_CSHARP_SOURCE_FILE}
- COMMAND ${SWIG} -v -c++ -csharp -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_CSHARP_SOURCE_FILE} ../kolabformat.i
+set(KOLAB_SWIG_CSHARP_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/csharp_kolabformat_wrapper.cpp)
+set(KOLAB_SWIG_CSHARP_DLL_FILE ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.dll)
+
+add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_SOURCE_FILE}
+ COMMAND ${SWIG} -v -c++ -csharp -o ${KOLAB_SWIG_CSHARP_SOURCE_FILE} ../kolabformat.i
COMMENT "Generating C# bindings"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ../kolabformat.i kolabxml
VERBATIM
)
-SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_CSHARP_SOURCE_FILE} PROPERTIES GENERATED 1)
+SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_SOURCE_FILE} PROPERTIES GENERATED 1)
# Compile CSHARP Bindings
find_program(GMCS NAMES gmcs HINTS /usr/bin/)
if (GMCS)
- add_custom_command(OUTPUT kolabformat.dll
- COMMAND ${GMCS} --target:library kolabformat.cs *.cs
+ add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_DLL_FILE}
+ COMMAND ${GMCS} -target:library ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.cs ${CMAKE_CURRENT_BINARY_DIR}/*.cs
COMMENT "Compiling C# library"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS kolabxml
+ DEPENDS kolabxml ${KOLAB_SWIG_CSHARP_SOURCE_FILE}
VERBATIM
)
- SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/kolabformat.dll PROPERTIES GENERATED 1)
+ SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_DLL_FILE} PROPERTIES GENERATED 1)
#One custom target is enough, no need for one per command
- ADD_CUSTOM_TARGET(generate_CSHARP_bindings ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.dll ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_CSHARP_SOURCE_FILE})
+ ADD_CUSTOM_TARGET(generate_csharp_bindings ALL DEPENDS ${KOLAB_SWIG_CSHARP_DLL_FILE})
if (KOLAB_CSHARP_INSTALL_DIR)
set(CSHARP_INSTALL_DIR ${KOLAB_CSHARP_INSTALL_DIR})