diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-04-17 10:23:15 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-05-03 16:20:17 (GMT) |
commit | e3919bae17d3442e18b5ec1f4a1ae994c87c455b (patch) | |
tree | 466c72ae4938936780a97c37d8234123f4fa2767 /Modules/UseSWIG.cmake | |
parent | 186ca170da51d64a50bb15bfd067ca9b4c987327 (diff) | |
download | CMake-e3919bae17d3442e18b5ec1f4a1ae994c87c455b.zip CMake-e3919bae17d3442e18b5ec1f4a1ae994c87c455b.tar.gz CMake-e3919bae17d3442e18b5ec1f4a1ae994c87c455b.tar.bz2 |
UseSWIG: Manage alternate library name
Manage alternate library name by passing -interface <library_name>
for python language or -dllimport <library_name> for CSharp language
to the SWIG compiler.
Fixes: #18771
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r-- | Modules/UseSWIG.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 18ea55c..c136b05 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -466,7 +466,14 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) # This makes sure that the name used in the generated DllImport # matches the library name created by CMake - list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "${name}") + list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>") + 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)) + # 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}>") endif() endif() list (APPEND swig_extra_flags ${SWIG_MODULE_${name}_EXTRA_FLAGS}) |