From 6b14de6bc55ddc3c6883276153720d8ccc656d85 Mon Sep 17 00:00:00 2001 From: Mario Emmenlauer Date: Fri, 9 Sep 2022 16:45:46 +0200 Subject: 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 --- Modules/UseSWIG.cmake | 3 +++ 1 file changed, 3 insertions(+) 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 "") -- cgit v0.12