diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-08-31 10:33:57 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-08-31 10:33:57 (GMT) |
commit | d264685bee6a0d0598d46f5bc3e81f7231aa0c53 (patch) | |
tree | 96fef579c2708cc333b059f4f199722e648dfd0f /Modules/UseSWIG.cmake | |
parent | f2a22ecda9b21a8a26c99d201d6f542e78d4f414 (diff) | |
download | CMake-d264685bee6a0d0598d46f5bc3e81f7231aa0c53.zip CMake-d264685bee6a0d0598d46f5bc3e81f7231aa0c53.tar.gz CMake-d264685bee6a0d0598d46f5bc3e81f7231aa0c53.tar.bz2 |
UseSWIG: Update option -interface usage
Option -interface must not be used if multiple SWIG files are part
of the same library.
Fixes: #21134
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r-- | Modules/UseSWIG.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index a60e05e..b47a8cb 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -496,7 +496,8 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) endif() endif() if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY) - if(NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) + if(SWIG_USE_INTERFACE AND + NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) # This makes sure that the name used in the proxy code # matches the library name created by CMake list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-interface" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>") @@ -724,6 +725,13 @@ function(SWIG_ADD_LIBRARY name) set(swig_generated_sources) set(swig_generated_timestamps) + list(LENGTH swig_dot_i_sources swig_sources_count) + if (swig_sources_count GREATER "1") + # option -interface cannot be used + set(SWIG_USE_INTERFACE FALSE) + else() + set(SWIG_USE_INTERFACE TRUE) + endif() foreach(swig_it IN LISTS swig_dot_i_sources) SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}") list (APPEND swig_generated_sources "${swig_generated_source}") |