summaryrefslogtreecommitdiffstats
path: root/Tests/UseSWIG/MultiplePython/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/UseSWIG/MultiplePython/CMakeLists.txt')
-rw-r--r--Tests/UseSWIG/MultiplePython/CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
new file mode 100644
index 0000000..f1ae42a
--- /dev/null
+++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestMultiplePython CXX)
+
+include(CTest)
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(Python2 REQUIRED COMPONENTS Development)
+find_package(Python3 REQUIRED COMPONENTS Development)
+
+unset(CMAKE_SWIG_FLAGS)
+
+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 "${CMAKE_CURRENT_SOURCE_DIR}/..")
+
+swig_add_library(example1
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python2"
+ SOURCES ../example.i ../example.cxx)
+target_link_libraries(example1 PRIVATE Python2::Python)
+
+# re-use sample interface file for another plugin
+swig_add_library(example2
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python3"
+ SOURCES ../example.i ../example.cxx)
+target_link_libraries(example2 PRIVATE Python3::Python)