summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/UseSWIG
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2018-02-22 15:18:43 (GMT)
committerMarc Chevrier <marc.chevrier@sap.com>2018-03-20 08:29:44 (GMT)
commit352baee2074d12637c65e3113f560bbf98d0640a (patch)
tree916caf02869368eb32ef955697147e6a2f52ff40 /Tests/RunCMake/UseSWIG
parentdfc9036bcf65afc4aa0fd21092d47da4ccd259cb (diff)
downloadCMake-352baee2074d12637c65e3113f560bbf98d0640a.zip
CMake-352baee2074d12637c65e3113f560bbf98d0640a.tar.gz
CMake-352baee2074d12637c65e3113f560bbf98d0640a.tar.bz2
FindPython*: New implementation for Python stuff
Fixes: #16142
Diffstat (limited to 'Tests/RunCMake/UseSWIG')
-rw-r--r--Tests/RunCMake/UseSWIG/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/MultiplePython.cmake26
-rw-r--r--Tests/RunCMake/UseSWIG/RunCMakeTest.cmake6
3 files changed, 32 insertions, 2 deletions
diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt
index f452db1..2d75985 100644
--- a/Tests/RunCMake/UseSWIG/CMakeLists.txt
+++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 3.1)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
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)
diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
index c63ff2e..cded22f 100644
--- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
@@ -10,8 +10,11 @@ function(run_SWIG test)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set (RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
run_cmake(${test})
- run_cmake_command(${test}-test ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} ${_SWIG_TEST_TARGET})
+ run_cmake_command(${test}-test ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Release ${_SWIG_TEST_TARGET})
endfunction()
run_SWIG(LegacyPython TARGET RunTest)
@@ -21,3 +24,4 @@ run_SWIG(BasicPython TARGET RunTest)
run_SWIG(BasicPerl TARGET RunTest)
run_SWIG(MultipleModules)
+run_SWIG(MultiplePython)