summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/UseSWIG/MultipleModules.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/UseSWIG/MultipleModules.cmake')
-rw-r--r--Tests/RunCMake/UseSWIG/MultipleModules.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/UseSWIG/MultipleModules.cmake b/Tests/RunCMake/UseSWIG/MultipleModules.cmake
new file mode 100644
index 0000000..e3d579f
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/MultipleModules.cmake
@@ -0,0 +1,30 @@
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(PythonLibs REQUIRED)
+find_package(PerlLibs REQUIRED)
+
+unset(CMAKE_SWIG_FLAGS)
+
+set (CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
+set_property(SOURCE example.i PROPERTY COMPILE_OPTIONS -includeall)
+
+set_property(SOURCE example.i PROPERTY GENERATED_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_PATH})
+
+swig_add_library(example1
+ LANGUAGE python
+ SOURCES example.i example.cxx)
+target_link_libraries(example1 PRIVATE ${PYTHON_LIBRARIES})
+
+# re-use sample interface file for another plugin
+set_property(SOURCE example.i PROPERTY GENERATED_INCLUDE_DIRECTORIES ${PERL_INCLUDE_PATH})
+separate_arguments(c_flags UNIX_COMMAND "${PERL_EXTRA_C_FLAGS}")
+set_property(SOURCE example.i PROPERTY GENERATED_COMPILE_OPTIONS ${c_flags})
+
+swig_add_library(example2
+ LANGUAGE perl
+ SOURCES example.i example.cxx)
+target_link_libraries(example2 PRIVATE ${PERL_LIBRARY})