summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Emmenlauer <memmenlauer@biodataanalysis.de>2022-09-09 14:45:46 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-23 13:24:15 (GMT)
commit6b14de6bc55ddc3c6883276153720d8ccc656d85 (patch)
tree6f3b672f8871b871b8a8ae9afbab11804d702e3c
parent12de4ea2e8efc00c57c731b4a42066ef6d20e099 (diff)
downloadCMake-6b14de6bc55ddc3c6883276153720d8ccc656d85.zip
CMake-6b14de6bc55ddc3c6883276153720d8ccc656d85.tar.gz
CMake-6b14de6bc55ddc3c6883276153720d8ccc656d85.tar.bz2
UseSWIG: Change the library suffix to 'dylib' for C# on macOS
When testing on macOS, the command `swig_add_library("mytarget")` creates a library `libmytarget.so` instead of `libmytarget.dylib`. Subsequently, the library is not found by `dotnet` and the swig-generated `DllImport` statements. Fixes: #23967
-rw-r--r--Modules/UseSWIG.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 5b653ad..fd6596b 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -990,6 +990,9 @@ function(SWIG_ADD_LIBRARY name)
endif()
set_target_properties (${target_name} PROPERTIES PREFIX "")
endif()
+ if (APPLE)
+ set_target_properties (${target_name} PROPERTIES SUFFIX ".dylib")
+ endif ()
else()
# assume empty prefix because we expect the module to be dynamically loaded
set_target_properties (${target_name} PROPERTIES PREFIX "")