summaryrefslogtreecommitdiffstats
path: root/Modules/UseSWIG.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-30 14:56:49 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-10-30 14:56:55 (GMT)
commit263afbad64588eb896452cd85546a07321e9db92 (patch)
tree4eab6d31491cad5730508a8028023c3ffc73b79a /Modules/UseSWIG.cmake
parentb8f5eca5e2cff99ec0eeba645e3ccf5ac40d9825 (diff)
parentbb57cb80eb7d9ab779d19112f2da65c60bd37f39 (diff)
downloadCMake-263afbad64588eb896452cd85546a07321e9db92.zip
CMake-263afbad64588eb896452cd85546a07321e9db92.tar.gz
CMake-263afbad64588eb896452cd85546a07321e9db92.tar.bz2
Merge topic 'UseSWIG-multi-input'
bb57cb80eb UseSWIG: multiple input files must be supported in version 2 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2539
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r--Modules/UseSWIG.cmake11
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index edb8294..c94d8c6 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -234,6 +234,8 @@ set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
set(SWIG_CSHARP_EXTRA_FILE_EXTENSIONS ".cs" "PINVOKE.cs")
+set(SWIG_MANAGE_SUPPORT_FILES_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/UseSWIG/ManageSupportFiles.cmake")
+
##
## PRIVATE functions
##
@@ -444,9 +446,13 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
# as part of custom command, start by removing old generated files
# to ensure obsolete files do not stay
- set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" -E remove_directory "${outdir}")
+ set (swig_file_outdir "${workingdir}/${swig_source_file_name_we}.files")
+ set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=CLEAN -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
+ set (swig_copy_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=COPY -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
else()
+ set (swig_file_outdir "${outdir}")
unset (swig_cleanup_command)
+ unset (swig_copy_command)
endif()
# IMPLICIT_DEPENDS below can not handle situations where a dependent file is
@@ -476,12 +482,13 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
COMMAND "${CMAKE_COMMAND}" -E env "SWIG_LIB=${SWIG_DIR}" "${SWIG_EXECUTABLE}"
"-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
"${swig_source_file_flags}"
- -outdir "${outdir}"
+ -outdir "${swig_file_outdir}"
${swig_special_flags}
${swig_extra_flags}
"${swig_include_dirs}"
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
+ ${swig_copy_command}
MAIN_DEPENDENCY "${swig_source_file_fullname}"
DEPENDS ${swig_dependencies}
IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"