summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-15 14:20:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-06-15 14:20:08 (GMT)
commit2afc4bf60843872e7d9fa883c61427facdbb4cae (patch)
treec2a840184ed3d801c123bdfc3ea9c366461549d3 /Modules
parent41897b4665d49690200024eb18e083861730779b (diff)
parent76a0286b1d53ba35d6fa7cee152259bc040d80fb (diff)
downloadCMake-2afc4bf60843872e7d9fa883c61427facdbb4cae.zip
CMake-2afc4bf60843872e7d9fa883c61427facdbb4cae.tar.gz
CMake-2afc4bf60843872e7d9fa883c61427facdbb4cae.tar.bz2
Merge topic 'UseSWIG-avoid-dllimport-repeat'
76a0286b UseSWIG: Add `-dllimport` only if not already specified Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !958
Diffstat (limited to 'Modules')
-rw-r--r--Modules/UseSWIG.cmake11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index bfe1a6f..456a6bd 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -82,10 +82,6 @@ macro(SWIG_MODULE_INITIALIZE name language)
set(SWIG_MODULE_${name}_REAL_NAME "_${name}")
elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPERL")
set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
- elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP")
- # This makes sure that the name used in the generated DllImport
- # matches the library name created by CMake
- set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}")
endif()
endmacro()
@@ -192,6 +188,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if(swig_source_file_cplusplus)
set(swig_special_flags ${swig_special_flags} "-c++")
endif()
+ if("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP")
+ if(NOT ";${swig_source_file_flags};${CMAKE_SWIG_FLAGS};" MATCHES ";-dllimport;")
+ # This makes sure that the name used in the generated DllImport
+ # matches the library name created by CMake
+ set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}")
+ endif()
+ endif()
set(swig_extra_flags)
if(SWIG_MODULE_${name}_EXTRA_FLAGS)
set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})