diff options
Diffstat (limited to 'Tests/RunCMake/UseSWIG/MultiplePython.cmake')
-rw-r--r-- | Tests/RunCMake/UseSWIG/MultiplePython.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/UseSWIG/MultiplePython.cmake b/Tests/RunCMake/UseSWIG/MultiplePython.cmake new file mode 100644 index 0000000..3804bdd --- /dev/null +++ b/Tests/RunCMake/UseSWIG/MultiplePython.cmake @@ -0,0 +1,26 @@ + +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 (CMAKE_INCLUDE_CURRENT_DIR ON) + +set_property(SOURCE example.i PROPERTY CPLUSPLUS ON) +set_property(SOURCE example.i PROPERTY COMPILE_OPTIONS -includeall) + +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) |