summaryrefslogtreecommitdiff
path: root/src/csharp/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/CMakeLists.txt')
-rw-r--r--src/csharp/CMakeLists.txt49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/csharp/CMakeLists.txt b/src/csharp/CMakeLists.txt
index 11e3d09..522e5a8 100644
--- a/src/csharp/CMakeLists.txt
+++ b/src/csharp/CMakeLists.txt
@@ -3,33 +3,36 @@ 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
- COMMENT "Generating C# bindings"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ../kolabformat.i kolabxml
- VERBATIM
+ COMMAND ${SWIG} -v -c++ -csharp -o ${CMAKE_CURRENT_BINARY_DIR}/${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(${KOLAB_SWIG_CSHARP_SOURCE_FILE} PROPERTIES GENERATED 1)
ADD_CUSTOM_TARGET(generate_CSHARP_bindings ALL DEPENDS ${KOLAB_SWIG_CSHARP_SOURCE_FILE})
# Compile CSHARP Bindings
-# Since there is no C# library we can't compile with -Wl,--no-undefined
-if (APPLE)
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flat_namespace -undefined suppress" )
-endif()
-
-#include_directories(${PHP4i_INCLUDE_PATH})
-add_library(csharpbindings SHARED ${KOLAB_SWIG_CSHARP_SOURCE_FILE})
-target_link_libraries(csharpbindings kolabxml ${CSHARP_LIBRARIES})
-SET_TARGET_PROPERTIES(csharpbindings PROPERTIES OUTPUT_NAME "kolabformat")
-SET_TARGET_PROPERTIES(csharpbindings PROPERTIES PREFIX "")
-
-if (KOLAB_CSHARP_INSTALL_DIR)
- set(CSHARP_INSTALL_DIR ${KOLAB_PHP_INSTALL_DIR})
-else (KOLAB_CSHARP_INSTALL_DIR)
- set(CSHARP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/phpbindings)
-endif (KOLAB_CSHARP_INSTALL_DIR)
-
-install(TARGETS csharpbindings LIBRARY DESTINATION ${CSHARP_INSTALL_DIR})
+find_program(GMCS gmcs /usr/bin)
+
+if (GMCS_FOUND)
+ add_custom_command(OUTPUT kolabformat.dll
+ COMMAND ${GMCS} --target:library kolabformat.cs *.cs
+ COMMENT "Compiling C# library"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS kolabxml charpbindings
+ VERBATIM
+ )
+
+ if (KOLAB_CSHARP_INSTALL_DIR)
+ set(CSHARP_INSTALL_DIR ${KOLAB_CSHARP_INSTALL_DIR})
+ else (KOLAB_CSHARP_INSTALL_DIR)
+ set(CSHARP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/csharpbindings)
+ endif (KOLAB_CSHARP_INSTALL_DIR)
+
+ install(TARGETS csharpbindings LIBRARY DESTINATION ${CSHARP_INCLUDE_DIR})
+ install(FILES kolabformat.dll LIBRARY DESTINATION ${CSHARP_INSTALL_DIR})
+endif (GMCS_FOUND)