summaryrefslogtreecommitdiffstats
path: root/Tests/UseSWIG
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-01-12 15:38:23 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-01-21 18:29:04 (GMT)
commit89b01b04faa7e32a243eeaa87475c944da39f6b3 (patch)
treec28dea6ff2aff975645b8590be6c343ec198e7f7 /Tests/UseSWIG
parentc69567e56a3b4ba4eb6e02112b95c0143894d598 (diff)
downloadCMake-89b01b04faa7e32a243eeaa87475c944da39f6b3.zip
CMake-89b01b04faa7e32a243eeaa87475c944da39f6b3.tar.gz
CMake-89b01b04faa7e32a243eeaa87475c944da39f6b3.tar.bz2
UseSWIG: use swig tool to generate dependencies
add_custom_command() supports option DEPFILE when generator is Makefiles or Ninja. And swig tool is able to generate a dependencies file which is compatible with DEPFILE option.
Diffstat (limited to 'Tests/UseSWIG')
-rw-r--r--Tests/UseSWIG/BasicPerl/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/BasicPython/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/CMakeLists.txt24
3 files changed, 26 insertions, 2 deletions
diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
index cf02de7..671d529 100644
--- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1...3.13)
+cmake_minimum_required(VERSION 3.1...3.20)
project(TestBasicPerl CXX)
diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt
index 8bbd1cb..a1163a2 100644
--- a/Tests/UseSWIG/BasicPython/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1...3.13)
+cmake_minimum_required(VERSION 3.1...3.20)
project(TestBasicPython CXX)
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index e150223..d08c59c 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -1,3 +1,5 @@
+find_package(SWIG QUIET)
+
add_test(NAME UseSWIG.LegacyPython COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -64,6 +66,28 @@ add_test(NAME UseSWIG.BasicPerl COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+if(SWIG_FOUND AND NOT SWIG_VERSION VERSION_LESS "4.0.2")
+ add_test(NAME UseSWIG.Depfile.BasicPython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPython"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPython.Depfile"
+ ${build_generator_args}
+ --build-project TestBasicPython
+ --build-options ${build_options} -DSWIG_USE_SWIG_DEPENDENCIES=ON
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME UseSWIG.Depfile.BasicPerl COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPerl"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPerl.Depfile"
+ ${build_generator_args}
+ --build-project TestBasicPerl
+ --build-options ${build_options} -DSWIG_USE_SWIG_DEPENDENCIES=ON
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
if (CMake_TEST_UseSWIG_Fortran)
check_language(Fortran)