diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-03-26 15:27:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2021-03-26 15:27:18 (GMT) |
commit | 1d8e3a1e770ae4aed921eefffaceb70b1fd73701 (patch) | |
tree | e92bba9d4420302b016e6491ced6cf45a3d5add9 /Modules/UseSWIG.cmake | |
parent | 18a2e863852e6b9f918940698952b75e5e17dcd8 (diff) | |
download | CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.zip CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.tar.gz CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.tar.bz2 |
UseSWIG: Use standard library name conventions for csharp language
Fixes: #21542
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r-- | Modules/UseSWIG.cmake | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b1e0576..c7d8346 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -38,7 +38,13 @@ Defines the following command for use with ``SWIG``: .. versionchanged:: 3.15 Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property, - for example) will be passed on to Python and CSharp wrapper libraries. + for example) will be passed on to ``Python`` and ``CSharp`` wrapper + libraries. + + .. versionchanged:: 3.21 + Generated library use standard naming conventions for ``CSharp`` language + when policy :policy:`CMP0122` is set to ``NEW``. Otherwise, the legacy + behavior is applied. .. note:: @@ -950,6 +956,17 @@ function(SWIG_ADD_LIBRARY name) endif () elseif (swig_lowercase_language STREQUAL "fortran") # Do *not* override the target's library prefix + elseif (swig_lowercase_language STREQUAL "csharp") + cmake_policy(GET CMP0122 csharp_naming_policy) + if (csharp_naming_policy STREQUAL "NEW") + # Do *not* override the target's library prefix + else() + if (NOT csharp_naming_policy) + cmake_policy(GET_WARNING CMP0122 _cmp0122_warning) + message(AUTHOR_WARNING "${_cmp0122_warning}\n") + endif() + set_target_properties (${target_name} PROPERTIES PREFIX "") + endif() else() # assume empty prefix because we expect the module to be dynamically loaded set_target_properties (${target_name} PROPERTIES PREFIX "") |