|  | @@ -30,9 +30,10 @@ Defines the following command for use with ``SWIG``:
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    .. note::
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    The variable ``SWIG_MODULE_<name>_REAL_NAME`` will be set to the name
 | 
	
		
			
				|  |  | -    of the swig module target library. This variable is useless if variable
 | 
	
		
			
				|  |  | -    ``UseSWIG_TARGET_NAME_PREFERENCE`` is set to ``STANDARD``.
 | 
	
		
			
				|  |  | +    This command creates a target with the specified ``<name>`` when
 | 
	
		
			
				|  |  | +    policy :policy:`CMP0078` is set to ``NEW``.  Otherwise, the legacy
 | 
	
		
			
				|  |  | +    behavior will choose a different target name and store it in the
 | 
	
		
			
				|  |  | +    ``SWIG_MODULE_<name>_REAL_NAME`` variable.
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    .. note::
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -197,13 +198,6 @@ information about support files generated by ``SWIG`` interface compilation.
 | 
	
		
			
				|  |  |  Some variables can be set to customize the behavior of ``swig_add_library``
 | 
	
		
			
				|  |  |  as well as ``SWIG``:
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -``UseSWIG_TARGET_NAME_PREFERENCE``
 | 
	
		
			
				|  |  | -  Specify target name strategy.
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  * Set to ``LEGACY`` or undefined: legacy strategy is applied. Variable
 | 
	
		
			
				|  |  | -    ``SWIG_MODULE_<name>_REAL_NAME`` must be used to get real target name.
 | 
	
		
			
				|  |  | -  * Set to ``STANDARD``: target name matches specified name.
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  ``UseSWIG_MODULE_VERSION``
 | 
	
		
			
				|  |  |    Specify different behaviors for ``UseSWIG`` module.
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -225,8 +219,13 @@ as well as ``SWIG``:
 | 
	
		
			
				|  |  |    Specify extra dependencies for the generated module for ``<name>``.
 | 
	
		
			
				|  |  |  #]=======================================================================]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +cmake_policy(GET CMP0078 target_name_policy)
 | 
	
		
			
				|  |  |  cmake_policy (VERSION 3.12)
 | 
	
		
			
				|  |  | +if (target_name_policy)
 | 
	
		
			
				|  |  | +  # respect user choice regarding CMP0078 policy
 | 
	
		
			
				|  |  | +  cmake_policy(SET CMP0078 ${target_name_policy})
 | 
	
		
			
				|  |  | +endif()
 | 
	
		
			
				|  |  | +unset(target_name_policy)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  set(SWIG_CXX_EXTENSION "cxx")
 | 
	
		
			
				|  |  |  set(SWIG_EXTRA_LIBRARIES "")
 | 
	
	
		
			
				|  | @@ -545,10 +544,22 @@ function(SWIG_ADD_LIBRARY name)
 | 
	
		
			
				|  |  |      unset(_SAM_TYPE)
 | 
	
		
			
				|  |  |    endif()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
 | 
	
		
			
				|  |  | -    set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
 | 
	
		
			
				|  |  | -  elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$")
 | 
	
		
			
				|  |  | -    message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.")
 | 
	
		
			
				|  |  | +  cmake_policy(GET CMP0078 target_name_policy)
 | 
	
		
			
				|  |  | +  if (target_name_policy STREQUAL "NEW")
 | 
	
		
			
				|  |  | +    set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
 | 
	
		
			
				|  |  | +  else()
 | 
	
		
			
				|  |  | +    if (NOT target_name_policy)
 | 
	
		
			
				|  |  | +      message(AUTHOR_WARNING
 | 
	
		
			
				|  |  | +        "Policy CMP0078 is not set.  "
 | 
	
		
			
				|  |  | +        "Run \"cmake --help-policy CMP0078\" for policy details.  "
 | 
	
		
			
				|  |  | +        "Use the cmake_policy command to set the policy and suppress this warning."
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +    endif()
 | 
	
		
			
				|  |  | +    if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
 | 
	
		
			
				|  |  | +      set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
 | 
	
		
			
				|  |  | +    elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$")
 | 
	
		
			
				|  |  | +      message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.")
 | 
	
		
			
				|  |  | +    endif()
 | 
	
		
			
				|  |  |    endif()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    if (NOT DEFINED UseSWIG_MODULE_VERSION)
 |