1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
8 This file provides support for ``SWIG``. It is assumed that :module:`FindSWIG`
9 module has already been loaded.
18 The following command is defined for use with ``SWIG``:
20 .. command:: swig_add_library
24 Define swig module with given name and specified language::
26 swig_add_library(<name>
27 [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
30 [OUTPUT_DIR <directory>]
31 [OUTFILE_DIR <directory>]
35 Targets created with the ``swig_add_library`` command have the same
36 capabilities as targets created with the :command:`add_library` command, so
37 those targets can be used with any command expecting a target (e.g.
38 :command:`target_link_libraries`).
40 .. versionchanged:: 3.13
41 This command creates a target with the specified ``<name>`` when
42 policy :policy:`CMP0078` is set to ``NEW``. Otherwise, the legacy
43 behavior will choose a different target name and store it in the
44 ``SWIG_MODULE_<name>_REAL_NAME`` variable.
46 .. versionchanged:: 3.15
47 Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property,
48 for example) will be passed on to ``Python`` and ``CSharp`` wrapper
51 .. versionchanged:: 3.21
52 Generated library use standard naming conventions for ``CSharp`` language
53 when policy :policy:`CMP0122` is set to ``NEW``. Otherwise, the legacy
58 For multi-config generators, this module does not support
59 configuration-specific files generated by ``SWIG``. All build
60 configurations must result in the same generated source file.
64 For :ref:`Makefile Generators`, if, for some sources, the
65 ``USE_SWIG_DEPENDENCIES`` property is ``FALSE``, ``swig_add_library`` does
66 not track file dependencies, so depending on the ``<name>_swig_compilation``
67 custom target is required for targets which require the ``swig``-generated
68 files to exist. Other generators may depend on the source files that would
72 ``SHARED``, ``MODULE`` and ``STATIC`` have the same semantic as for the
73 :command:`add_library` command. If ``USE_BUILD_SHARED_LIBS`` is specified,
74 the library type will be ``STATIC`` or ``SHARED`` based on whether the
75 current value of the :variable:`BUILD_SHARED_LIBS` variable is ``ON``. If
76 no type is specified, ``MODULE`` will be used.
79 Specify the target language.
82 Go and Lua language support.
87 .. versionadded:: 3.18
88 Fortran language support.
91 .. versionadded:: 3.12
93 Prevent the generation of the wrapper layer (swig ``-noproxy`` option).
96 .. versionadded:: 3.12
98 Specify where to write the language specific files (swig ``-outdir``
99 option). If not given, the ``CMAKE_SWIG_OUTDIR`` variable will be used.
100 If neither is specified, the default depends on the value of the
101 ``UseSWIG_MODULE_VERSION`` variable as follows:
103 * If ``UseSWIG_MODULE_VERSION`` is 1 or is undefined, output is written to
104 the :variable:`CMAKE_CURRENT_BINARY_DIR` directory.
105 * If ``UseSWIG_MODULE_VERSION`` is 2, a dedicated directory will be used.
106 The path of this directory can be retrieved from the
107 ``SWIG_SUPPORT_FILES_DIRECTORY`` target property.
110 .. versionadded:: 3.12
112 Specify an output directory name where the generated source file will be
113 placed (swig ``-o`` option). If not specified, the ``SWIG_OUTFILE_DIR``
114 variable will be used. If neither is specified, ``OUTPUT_DIR`` or
115 ``CMAKE_SWIG_OUTDIR`` is used instead.
118 List of sources for the library. Files with extension ``.i`` will be
119 identified as sources for the ``SWIG`` tool. Other files will be handled in
122 .. versionadded:: 3.14
123 This behavior can be overridden by specifying the variable
124 ``SWIG_SOURCE_FILE_EXTENSIONS``.
128 If ``UseSWIG_MODULE_VERSION`` is set to 2, it is **strongly** recommended
129 to use a dedicated directory unique to the target when either the
130 ``OUTPUT_DIR`` option or the ``CMAKE_SWIG_OUTDIR`` variable are specified.
131 The output directory contents are erased as part of the target build, so
132 to prevent interference between targets or losing other important files,
133 each target should have its own dedicated output directory.
135 Properties on Source Files
136 ^^^^^^^^^^^^^^^^^^^^^^^^^^
138 Source file properties on module files **must** be set before the invocation
139 of the ``swig_add_library`` command to specify special behavior of SWIG and
140 ensure generated files will receive the required settings.
143 Call SWIG in c++ mode. For example:
145 .. code-block:: cmake
147 set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
148 swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
152 Replaced with the fine-grained properties that follow.
154 Pass custom flags to the SWIG executable.
156 ``INCLUDE_DIRECTORIES``, ``COMPILE_DEFINITIONS`` and ``COMPILE_OPTIONS``
157 .. versionadded:: 3.12
159 Add custom flags to SWIG compiler and have same semantic as properties
160 :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
161 :prop_sf:`COMPILE_OPTIONS`.
163 ``USE_TARGET_INCLUDE_DIRECTORIES``
164 .. versionadded:: 3.13
166 If set to ``TRUE``, contents of target property
167 :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
168 If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be
169 ignored. If not set, target property ``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
172 ``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
173 .. versionadded:: 3.12
175 Add custom flags to the C/C++ generated source. They will fill, respectively,
176 properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
177 :prop_sf:`COMPILE_OPTIONS` of generated C/C++ file.
180 .. versionadded:: 3.12
182 Specify additional dependencies to the source file.
184 ``USE_SWIG_DEPENDENCIES``
185 .. versionadded:: 3.20
187 If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
188 itself. This property is only meaningful for
189 :ref:`Makefile <Makefile Generators>`,
190 :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and
191 :ref:`Visual Studio <Visual Studio Generators>`
192 (:generator:`Visual Studio 12 2013` and above) generators. Default value is
195 .. versionadded:: 3.21
196 Added the support of :generator:`Xcode` generator.
198 .. versionadded:: 3.22
199 Added the support of :ref:`Visual Studio Generators`.
202 Specify the actual import name of the module in the target language.
203 This is required if it cannot be scanned automatically from source
204 or different from the module file basename. For example:
206 .. code-block:: cmake
208 set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
210 .. versionchanged:: 3.14
211 If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>``
212 is passed to ``SWIG`` compiler.
215 .. versionadded:: 3.19
217 Specify where to write the language specific files (swig ``-outdir`` option)
218 for the considered source file. If not specified, the other ways to define
219 the output directory applies (see ``OUTPUT_DIR`` option of
220 ``swig_add_library()`` command).
223 .. versionadded:: 3.19
225 Specify an output directory where the generated source file will be placed
226 (swig ``-o`` option) for the considered source file. If not specified,
227 ``OUTPUT_DIR`` source property will be used. If neither are specified, the
228 other ways to define output file directory applies (see ``OUTFILE_DIR``
229 option of ``swig_add_library()`` command).
231 Properties on Targets
232 ^^^^^^^^^^^^^^^^^^^^^
234 Target library properties can be set to apply same configuration to all SWIG
237 ``SWIG_INCLUDE_DIRECTORIES``, ``SWIG_COMPILE_DEFINITIONS`` and ``SWIG_COMPILE_OPTIONS``
238 .. versionadded:: 3.12
240 These properties will be applied to all SWIG input files and have same
241 semantic as target properties :prop_tgt:`INCLUDE_DIRECTORIES`,
242 :prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS`.
244 .. code-block:: cmake
246 set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
247 swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
248 set_property(TARGET mymod PROPERTY SWIG_COMPILE_DEFINITIONS MY_DEF1 MY_DEF2)
249 set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb)
251 ``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
252 .. versionadded:: 3.13
254 If set to ``TRUE``, contents of target property
255 :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
256 If set to ``FALSE`` or not defined, target property
257 :prop_tgt:`INCLUDE_DIRECTORIES` will be ignored. This behavior can be
258 overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``.
260 ``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS``
261 .. versionadded:: 3.12
263 These properties will populate, respectively, properties
264 :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
265 :prop_sf:`COMPILE_FLAGS` of all generated C/C++ files.
268 .. versionadded:: 3.12
270 Add dependencies to all SWIG input files.
272 Read-only Target Properties
273 """""""""""""""""""""""""""
275 The following target properties are output properties and can be used to get
276 information about support files generated by ``SWIG`` interface compilation.
278 ``SWIG_SUPPORT_FILES``
279 .. versionadded:: 3.12
281 This output property list of wrapper files generated during SWIG compilation.
283 .. code-block:: cmake
285 set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
286 swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
287 get_property(support_files TARGET mymod PROPERTY SWIG_SUPPORT_FILES)
291 Only most principal support files are listed. In case some advanced
292 features of ``SWIG`` are used (for example ``%template``), associated
293 support files may not be listed. Prefer to use the
294 ``SWIG_SUPPORT_FILES_DIRECTORY`` property to handle support files.
296 ``SWIG_SUPPORT_FILES_DIRECTORY``
297 .. versionadded:: 3.12
299 This output property specifies the directory where support files will be
304 When source property ``OUTPUT_DIR`` is defined, multiple directories can be
305 specified as part of ``SWIG_SUPPORT_FILES_DIRECTORY``.
310 Some variables can be set to customize the behavior of ``swig_add_library``
313 ``UseSWIG_MODULE_VERSION``
314 .. versionadded:: 3.12
316 Specify different behaviors for ``UseSWIG`` module.
318 * Set to 1 or undefined: Legacy behavior is applied.
319 * Set to 2: A new strategy is applied regarding support files: the output
320 directory of support files is erased before ``SWIG`` interface compilation.
323 Add flags to all swig calls.
325 ``CMAKE_SWIG_OUTDIR``
326 Specify where to write the language specific files (swig ``-outdir`` option).
329 .. versionadded:: 3.8
331 Specify an output directory name where the generated source file will be
332 placed. If not specified, ``CMAKE_SWIG_OUTDIR`` is used.
334 ``SWIG_MODULE_<name>_EXTRA_DEPS``
335 Specify extra dependencies for the generated module for ``<name>``.
337 ``SWIG_SOURCE_FILE_EXTENSIONS``
338 .. versionadded:: 3.14
340 Specify a list of source file extensions to override the default
341 behavior of considering only ``.i`` files as sources for the ``SWIG``
344 .. code-block:: cmake
346 set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg")
348 ``SWIG_USE_SWIG_DEPENDENCIES``
349 .. versionadded:: 3.20
351 If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
352 itself. This variable is only meaningful for
353 :ref:`Makefile <Makefile Generators>`,
354 :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and
355 :ref:`Visual Studio <Visual Studio Generators>`
356 (:generator:`Visual Studio 12 2013` and above) generators. Default value is
359 Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be
360 initialized with the value of this variable.
362 .. versionadded:: 3.21
363 Added the support of :generator:`Xcode` generator.
365 .. versionadded:: 3.22
366 Added the support of :ref:`Visual Studio Generators`.
371 .. command:: swig_link_libraries
374 Use :command:`target_link_libraries` with the standard target name,
375 or with ``${SWIG_MODULE_<name>_REAL_NAME}`` for legacy target naming.
377 Link libraries to swig module::
379 swig_link_libraries(<name> <item>...)
381 This command has same capabilities as :command:`target_link_libraries`
385 When policy :policy:`CMP0078` is set to ``NEW``,
386 :command:`swig_add_library` creates a standard target with the
387 specified ``<name>`` and :command:`target_link_libraries` must be used
388 instead of this command.
390 With the legacy behavior (when :policy:`CMP0078` is set to ``OLD`` and
391 the ``UseSWIG_TARGET_NAME_PREFERENCE`` variable is set to ``"LEGACY"``,
392 or in CMake versions prior to 3.12), it is preferable to use
393 ``target_link_libraries(${SWIG_MODULE_<name>_REAL_NAME} ...)``
394 instead of this command.
396 #]=======================================================================]
399 # numbers and boolean constants
400 cmake_policy (SET CMP0012 NEW)
402 cmake_policy (SET CMP0057 NEW)
403 # Ninja generator normalizes custom command depfile paths
404 cmake_policy (SET CMP0116 NEW)
406 set(SWIG_CXX_EXTENSION "cxx")
407 set(SWIG_EXTRA_LIBRARIES "")
409 set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
410 set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
411 set(SWIG_CSHARP_EXTRA_FILE_EXTENSIONS ".cs" "PINVOKE.cs")
412 set(SWIG_PERL_EXTRA_FILE_EXTENSIONS ".pm")
413 set(SWIG_PERL5_EXTRA_FILE_EXTENSIONS ".pm")
415 set(SWIG_MANAGE_SUPPORT_FILES_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/UseSWIG/ManageSupportFiles.cmake")
420 function (__SWIG_COMPUTE_TIMESTAMP name language infile workingdir __timestamp)
421 get_filename_component(filename "${infile}" NAME_WE)
423 "${workingdir}/${filename}${language}.stamp" PARENT_SCOPE)
424 # get_filename_component(filename "${infile}" ABSOLUTE)
425 # string(UUID uuid NAMESPACE 9735D882-D2F8-4E1D-88C9-A0A4F1F6ECA4
426 # NAME ${name}-${language}-${filename} TYPE SHA1)
427 # set(${__timestamp} "${workingdir}/${uuid}.stamp" PARENT_SCOPE)
431 # For given swig module initialize variables associated with it
433 macro(SWIG_MODULE_INITIALIZE name language)
434 string(TOUPPER "${language}" SWIG_MODULE_${name}_LANGUAGE)
435 string(TOLOWER "${language}" SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG)
437 if (NOT DEFINED SWIG_MODULE_${name}_NOPROXY)
438 set (SWIG_MODULE_${name}_NOPROXY FALSE)
440 if ("-noproxy" IN_LIST CMAKE_SWIG_FLAGS)
441 set (SWIG_MODULE_${name}_NOPROXY TRUE)
444 if (SWIG_MODULE_${name}_NOPROXY AND
445 NOT ("-noproxy" IN_LIST CMAKE_SWIG_FLAGS OR "-noproxy" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
446 list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-noproxy")
448 if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "UNKNOWN")
449 message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found")
450 elseif((SWIG_MODULE_${name}_LANGUAGE STREQUAL "PERL" OR SWIG_MODULE_${name}_LANGUAGE STREQUAL "PERL5")
451 AND NOT "-shadow" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)
452 list(APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
457 # For a given language, input file, and output file, determine extra files that
458 # will be generated. This is internal swig macro.
461 function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
463 get_source_file_property(module_basename
464 "${infile}" SWIG_MODULE_NAME)
465 if(NOT module_basename)
467 # try to get module name from "%module foo" syntax
468 if ( EXISTS "${infile}" )
470 cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
471 file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" )
474 if ( module_basename )
475 string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
478 # try to get module name from "%module (options=...) foo" syntax
479 if ( EXISTS "${infile}" )
481 cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
482 file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" )
485 if ( module_basename )
486 string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
489 # fallback to file basename
490 get_filename_component(module_basename "${infile}" NAME_WE)
495 foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
496 set(extra_file "${generatedpath}/${module_basename}${it}")
497 if (extra_file MATCHES "\\.cs$" AND CMAKE_CSharp_COMPILER_LOADED)
498 set_source_files_properties(${extra_file} PROPERTIES LANGUAGE "CSharp")
500 # Treat extra outputs as plain files regardless of language.
501 set_source_files_properties(${extra_file} PROPERTIES LANGUAGE "")
503 list(APPEND files "${extra_file}")
506 if (language STREQUAL "FORTRAN" AND CMAKE_Fortran_COMPILER_LOADED)
507 # Process possible user-supplied extension in flags (obtained via parent
508 # scope variable) to determine the source file name.
509 list(FIND SWIG_COMPILATION_FLAGS "-fext" fext_idx)
510 if (fext_idx EQUAL -1)
511 # Default Fortran generated extension
514 # Get extension from user-provided flag
515 math(EXPR fext_idx "${fext_idx} + 1")
516 list(GET SWIG_COMPILATION_FLAGS "${fext_idx}" fext)
518 set(extra_file "${generatedpath}/${module_basename}.${fext}")
519 set_source_files_properties("${extra_file}" PROPERTIES LANGUAGE "Fortran")
520 list(APPEND files "${extra_file}")
523 set (${outfiles} ${files} PARENT_SCOPE)
527 # Take swig (*.i) file and add proper custom commands for it
529 function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
530 get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
531 get_source_file_property(swig_source_file_cplusplus "${infile}" CPLUSPLUS)
532 get_source_file_property(swig_source_file_outdir "${infile}" OUTPUT_DIR)
533 get_source_file_property(swig_source_file_outfiledir "${infile}" OUTFILE_DIR)
535 if (swig_source_file_outdir)
536 # use source file property
537 set(outdir "${swig_source_file_outdir}")
538 if (NOT swig_source_file_outfiledir)
539 set (swig_source_file_outfiledir "${outdir}")
541 elseif(CMAKE_SWIG_OUTDIR)
542 set(outdir ${CMAKE_SWIG_OUTDIR})
544 set(outdir ${CMAKE_CURRENT_BINARY_DIR})
547 if (swig_source_file_outfiledir)
548 set (outfiledir "${swig_source_file_outfiledir}")
549 elseif(SWIG_OUTFILE_DIR)
550 set(outfiledir ${SWIG_OUTFILE_DIR})
552 set(outfiledir ${outdir})
556 set (workingdir "${SWIG_WORKING_DIR}")
558 set(workingdir "${outdir}")
562 set(target_name ${SWIG_TARGET_NAME})
564 set(target_name ${name})
567 set (use_swig_dependencies ${SWIG_USE_SWIG_DEPENDENCIES})
568 if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])")
569 get_property(use_swig_dependencies_set SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES SET)
570 if (use_swig_dependencies_set)
571 get_property(use_swig_dependencies SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES)
575 set (swig_source_file_flags ${CMAKE_SWIG_FLAGS})
576 # handle various swig compile flags properties
577 get_source_file_property (include_directories "${infile}" INCLUDE_DIRECTORIES)
578 if (include_directories)
579 list (APPEND swig_source_file_flags "$<$<BOOL:${include_directories}>:-I$<JOIN:${include_directories},$<SEMICOLON>-I>>")
581 set (property "$<TARGET_PROPERTY:${target_name},SWIG_INCLUDE_DIRECTORIES>")
582 list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-I>>")
583 set (property "$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>>")
584 get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES)
585 if (use_target_include_dirs)
586 list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
587 elseif(use_target_include_dirs STREQUAL "NOTFOUND")
588 # not defined at source level, rely on target level
589 list (APPEND swig_source_file_flags "$<$<AND:$<BOOL:$<TARGET_PROPERTY:${target_name},SWIG_USE_TARGET_INCLUDE_DIRECTORIES>>,$<BOOL:${property}>>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
592 set (property "$<TARGET_PROPERTY:${target_name},SWIG_COMPILE_DEFINITIONS>")
593 list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-D$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-D>>")
594 get_source_file_property (compile_definitions "${infile}" COMPILE_DEFINITIONS)
595 if (compile_definitions)
596 list (APPEND swig_source_file_flags "$<$<BOOL:${compile_definitions}>:-D$<JOIN:${compile_definitions},$<SEMICOLON>-D>>")
599 list (APPEND swig_source_file_flags "$<TARGET_GENEX_EVAL:${target_name},$<TARGET_PROPERTY:${target_name},SWIG_COMPILE_OPTIONS>>")
600 get_source_file_property (compile_options "${infile}" COMPILE_OPTIONS)
602 list (APPEND swig_source_file_flags ${compile_options})
606 get_source_file_property (swig_flags "${infile}" SWIG_FLAGS)
608 list (APPEND swig_source_file_flags ${swig_flags})
611 get_filename_component(swig_source_file_fullname "${infile}" ABSOLUTE)
613 if (NOT SWIG_MODULE_${name}_NOPROXY)
614 set(SWIG_COMPILATION_FLAGS ${swig_source_file_flags})
615 SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
616 swig_extra_generated_files
618 "${swig_source_file_fullname}")
620 set(swig_generated_file_fullname
621 "${outfiledir}/${swig_source_file_name_we}")
622 # add the language into the name of the file (i.e. TCL_wrap)
623 # this allows for the same .i file to be wrapped into different languages
624 string(APPEND swig_generated_file_fullname
625 "${SWIG_MODULE_${name}_LANGUAGE}_wrap")
627 if(swig_source_file_cplusplus)
628 string(APPEND swig_generated_file_fullname
629 ".${SWIG_CXX_EXTENSION}")
631 string(APPEND swig_generated_file_fullname
635 get_directory_property (cmake_include_directories INCLUDE_DIRECTORIES)
636 list (REMOVE_DUPLICATES cmake_include_directories)
637 set (swig_include_dirs)
638 if (cmake_include_directories)
639 set (swig_include_dirs "$<$<BOOL:${cmake_include_directories}>:-I$<JOIN:${cmake_include_directories},$<SEMICOLON>-I>>")
642 set(swig_special_flags)
643 # default is c, so add c++ flag if it is c++
644 if(swig_source_file_cplusplus)
645 list (APPEND swig_special_flags "-c++")
648 cmake_policy(GET CMP0086 module_name_policy)
649 if (module_name_policy STREQUAL "NEW")
650 get_source_file_property(module_name "${infile}" SWIG_MODULE_NAME)
652 list (APPEND swig_special_flags "-module" "${module_name}")
655 if (NOT module_name_policy)
656 cmake_policy(GET_WARNING CMP0086 _cmp0086_warning)
657 message(AUTHOR_WARNING "${_cmp0086_warning}\n")
661 set (swig_extra_flags)
662 if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "CSHARP")
663 if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
664 # This makes sure that the name used in the generated DllImport
665 # matches the library name created by CMake
666 list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_BASE_NAME:${target_name}>")
669 if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
670 if(SWIG_USE_INTERFACE AND
671 NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
672 # This makes sure that the name used in the proxy code
673 # matches the library name created by CMake
674 list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-interface" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>")
677 list (APPEND swig_extra_flags ${SWIG_MODULE_${name}_EXTRA_FLAGS})
680 set (swig_dependencies DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} $<TARGET_PROPERTY:${target_name},SWIG_DEPENDS>)
681 get_source_file_property(file_depends "${infile}" DEPENDS)
683 list (APPEND swig_dependencies ${file_depends})
686 if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
687 # as part of custom command, start by removing old generated files
688 # to ensure obsolete files do not stay
689 set (swig_file_outdir "${workingdir}/${swig_source_file_name_we}.files")
690 set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=CLEAN -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
691 set (swig_copy_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=COPY -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
693 set (swig_file_outdir "${outdir}")
694 unset (swig_cleanup_command)
695 unset (swig_copy_command)
698 set(swig_depends_flags)
699 if(NOT use_swig_dependencies AND CMAKE_GENERATOR MATCHES "Make")
700 # IMPLICIT_DEPENDS can not handle situations where a dependent file is
701 # removed. We need an extra step with timestamp and custom target, see #16830
702 # As this is needed only for Makefile generator do it conditionally
703 __swig_compute_timestamp(${name} ${SWIG_MODULE_${name}_LANGUAGE}
704 "${infile}" "${workingdir}" swig_generated_timestamp)
705 set(swig_custom_output "${swig_generated_timestamp}")
706 set(swig_custom_products
707 BYPRODUCTS "${swig_generated_file_fullname}" ${swig_extra_generated_files})
708 set(swig_timestamp_command
709 COMMAND ${CMAKE_COMMAND} -E touch "${swig_generated_timestamp}")
710 list(APPEND swig_dependencies IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}")
712 set(swig_generated_timestamp)
713 set(swig_custom_output
714 "${swig_generated_file_fullname}" ${swig_extra_generated_files})
715 set(swig_custom_products)
716 set(swig_timestamp_command)
717 if (use_swig_dependencies)
718 cmake_path(GET infile FILENAME swig_depends_filename)
719 set(swig_depends_filename "${workingdir}/${swig_depends_filename}.d")
720 list(APPEND swig_dependencies DEPFILE "${swig_depends_filename}")
721 set(swig_depends_flags -MF "${swig_depends_filename}" -MD)
725 OUTPUT ${swig_custom_output}
726 ${swig_custom_products}
727 ${swig_cleanup_command}
728 # Let's create the ${outdir} at execution time, in case dir contains $(OutDir)
729 COMMAND "${CMAKE_COMMAND}" -E make_directory "${workingdir}" "${outdir}" "${outfiledir}"
730 ${swig_timestamp_command}
731 COMMAND "${CMAKE_COMMAND}" -E env "SWIG_LIB=${SWIG_DIR}" "${SWIG_EXECUTABLE}"
732 "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
733 "${swig_source_file_flags}"
734 -outdir "${swig_file_outdir}"
735 ${swig_special_flags}
737 ${swig_depends_flags}
738 "${swig_include_dirs}"
739 -o "${swig_generated_file_fullname}"
740 "${swig_source_file_fullname}"
742 MAIN_DEPENDENCY "${swig_source_file_fullname}"
744 COMMENT "Swig compile ${infile} for ${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
745 COMMAND_EXPAND_LISTS)
746 set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
747 PROPERTIES GENERATED 1)
749 ## add all properties for generated file to various properties
750 get_property (include_directories SOURCE "${infile}" PROPERTY GENERATED_INCLUDE_DIRECTORIES)
751 set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY INCLUDE_DIRECTORIES ${include_directories} $<TARGET_GENEX_EVAL:${target_name},$<TARGET_PROPERTY:${target_name},SWIG_GENERATED_INCLUDE_DIRECTORIES>>)
753 get_property (compile_definitions SOURCE "${infile}" PROPERTY GENERATED_COMPILE_DEFINITIONS)
754 set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY COMPILE_DEFINITIONS $<TARGET_GENEX_EVAL:${target_name},$<TARGET_PROPERTY:${target_name},SWIG_GENERATED_COMPILE_DEFINITIONS>> ${compile_definitions})
756 get_property (compile_options SOURCE "${infile}" PROPERTY GENERATED_COMPILE_OPTIONS)
757 set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY COMPILE_OPTIONS $<TARGET_GENEX_EVAL:${target_name},$<TARGET_PROPERTY:${target_name},SWIG_GENERATED_COMPILE_OPTIONS>> ${compile_options})
759 if (SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG MATCHES "php")
760 set_property (SOURCE "${swig_generated_file_fullname}" APPEND PROPERTY INCLUDE_DIRECTORIES "${outdir}")
763 set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files} PARENT_SCOPE)
764 set(swig_timestamp "${swig_generated_timestamp}" PARENT_SCOPE)
767 set (swig_generated_file_fullname "${swig_generated_file_fullname}" PARENT_SCOPE)
773 macro(SWIG_ADD_MODULE name language)
774 message(DEPRECATION "SWIG_ADD_MODULE is deprecated. Use SWIG_ADD_LIBRARY instead.")
775 swig_add_library(${name}
782 function(SWIG_ADD_LIBRARY name)
783 set(options NO_PROXY)
784 set(oneValueArgs LANGUAGE
788 set(multiValueArgs SOURCES)
789 cmake_parse_arguments(_SAM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
791 if (_SAM_UNPARSED_ARGUMENTS)
792 message(FATAL_ERROR "SWIG_ADD_LIBRARY: ${_SAM_UNPARSED_ARGUMENTS}: unexpected arguments")
795 if(NOT DEFINED _SAM_LANGUAGE)
796 message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing LANGUAGE argument")
799 if(NOT DEFINED _SAM_SOURCES)
800 message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing SOURCES argument")
803 if(NOT DEFINED _SAM_TYPE)
804 set(_SAM_TYPE MODULE)
805 elseif(_SAM_TYPE STREQUAL "USE_BUILD_SHARED_LIBS")
809 cmake_policy(GET CMP0078 target_name_policy)
810 if (target_name_policy STREQUAL "NEW")
811 set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
813 if (NOT target_name_policy)
814 cmake_policy(GET_WARNING CMP0078 _cmp0078_warning)
815 message(AUTHOR_WARNING "${_cmp0078_warning}\n")
817 if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
818 set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
819 elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$")
820 message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.")
824 if (NOT DEFINED UseSWIG_MODULE_VERSION)
825 set (UseSWIG_MODULE_VERSION 1)
826 elseif (NOT UseSWIG_MODULE_VERSION MATCHES "^(1|2)$")
827 message (FATAL_ERROR "UseSWIG_MODULE_VERSION: ${UseSWIG_MODULE_VERSION}: invalid value. 1 or 2 is expected.")
830 set (SWIG_MODULE_${name}_NOPROXY ${_SAM_NO_PROXY})
831 swig_module_initialize(${name} ${_SAM_LANGUAGE})
833 # compute real target name.
834 if (UseSWIG_TARGET_NAME_PREFERENCE STREQUAL "LEGACY" AND
835 SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
836 # swig will produce a module.py containing an 'import _modulename' statement,
837 # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32),
838 # unless the -noproxy flag is used
839 set(target_name "_${name}")
841 set(target_name "${name}")
844 if (TARGET ${target_name})
845 # a target with same name is already defined.
846 # call NOW add_library command to raise the most useful error message
847 add_library(${target_name})
851 set (workingdir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target_name}.dir")
852 # set special variable to pass extra information to command SWIG_ADD_SOURCE_TO_MODULE
853 # which cannot be changed due to legacy compatibility
854 set (SWIG_WORKING_DIR "${workingdir}")
855 set (SWIG_TARGET_NAME "${target_name}")
857 set (outputdir "${_SAM_OUTPUT_DIR}")
858 if (NOT _SAM_OUTPUT_DIR)
859 if (CMAKE_SWIG_OUTDIR)
860 set (outputdir "${CMAKE_SWIG_OUTDIR}")
862 if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
863 set (outputdir "${workingdir}/${_SAM_LANGUAGE}.files")
865 set (outputdir "${CMAKE_CURRENT_BINARY_DIR}")
870 set (outfiledir "${_SAM_OUTFILE_DIR}")
871 if(NOT _SAM_OUTFILE_DIR)
872 if (SWIG_OUTFILE_DIR)
873 set (outfiledir "${SWIG_OUTFILE_DIR}")
875 if (_SAM_OUTPUT_DIR OR CMAKE_SWIG_OUTDIR)
876 set (outfiledir "${outputdir}")
878 set (outfiledir "${workingdir}")
882 # set again, locally, predefined variables to ensure compatibility
883 # with command SWIG_ADD_SOURCE_TO_MODULE
884 set(CMAKE_SWIG_OUTDIR "${outputdir}")
885 set(SWIG_OUTFILE_DIR "${outfiledir}")
887 # See if the user has specified source extensions for swig files?
888 if (NOT DEFINED SWIG_SOURCE_FILE_EXTENSIONS)
889 # Assume the default (*.i) file extension for Swig source files
890 set(SWIG_SOURCE_FILE_EXTENSIONS ".i")
893 if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])")
894 # For Makefiles, Ninja, Xcode and Visual Studio generators,
895 # use SWIG generated dependencies if requested
896 if (NOT DEFINED SWIG_USE_SWIG_DEPENDENCIES)
897 set (SWIG_USE_SWIG_DEPENDENCIES OFF)
900 set (SWIG_USE_SWIG_DEPENDENCIES OFF)
903 # Generate a regex out of file extensions.
904 string(REGEX REPLACE "([$^.*+?|()-])" "\\\\\\1" swig_source_ext_regex "${SWIG_SOURCE_FILE_EXTENSIONS}")
905 list (JOIN swig_source_ext_regex "|" swig_source_ext_regex)
906 string (PREPEND swig_source_ext_regex "(")
907 string (APPEND swig_source_ext_regex ")$")
909 set(swig_dot_i_sources ${_SAM_SOURCES})
910 list(FILTER swig_dot_i_sources INCLUDE REGEX ${swig_source_ext_regex})
911 if (NOT swig_dot_i_sources)
912 message(FATAL_ERROR "SWIG_ADD_LIBRARY: no SWIG interface files specified")
914 set(swig_other_sources ${_SAM_SOURCES})
915 list(REMOVE_ITEM swig_other_sources ${swig_dot_i_sources})
917 set(swig_generated_sources)
918 set(swig_generated_timestamps)
919 set(swig_generated_outdirs "${outputdir}")
920 list(LENGTH swig_dot_i_sources swig_sources_count)
921 if (swig_sources_count GREATER "1")
922 # option -interface cannot be used
923 set(SWIG_USE_INTERFACE FALSE)
925 set(SWIG_USE_INTERFACE TRUE)
927 foreach(swig_it IN LISTS swig_dot_i_sources)
928 SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}")
929 list (APPEND swig_generated_sources "${swig_generated_source}")
931 list (APPEND swig_generated_timestamps "${swig_timestamp}")
933 get_source_file_property(swig_source_file_outdir "${swig_it}" OUTPUT_DIR)
934 if (swig_source_file_outdir)
935 list (APPEND swig_generated_outdirs "${swig_source_file_outdir}")
938 list(REMOVE_DUPLICATES swig_generated_outdirs)
939 set_property (DIRECTORY APPEND PROPERTY
940 ADDITIONAL_CLEAN_FILES ${swig_generated_sources} ${swig_generated_timestamps})
941 if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
942 set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${swig_generated_outdirs})
945 add_library(${target_name}
947 ${swig_generated_sources}
948 ${swig_other_sources})
949 if(swig_generated_timestamps)
950 # see IMPLICIT_DEPENDS above
951 add_custom_target(${name}_swig_compilation DEPENDS ${swig_generated_timestamps})
952 add_dependencies(${target_name} ${name}_swig_compilation)
954 if(_SAM_TYPE STREQUAL "MODULE")
955 set_target_properties(${target_name} PROPERTIES NO_SONAME ON)
957 string(TOLOWER "${_SAM_LANGUAGE}" swig_lowercase_language)
958 if (swig_lowercase_language STREQUAL "octave")
959 set_target_properties(${target_name} PROPERTIES PREFIX "")
960 set_target_properties(${target_name} PROPERTIES SUFFIX ".oct")
961 elseif (swig_lowercase_language STREQUAL "go")
962 set_target_properties(${target_name} PROPERTIES PREFIX "")
963 elseif (swig_lowercase_language STREQUAL "java")
965 # System.loadLibrary("LIBRARY");
966 # then JNI will look for a library whose name is platform dependent, namely
967 # MacOS : libLIBRARY.jnilib
968 # Windows: LIBRARY.dll
969 # Linux : libLIBRARY.so
971 set_target_properties (${target_name} PROPERTIES SUFFIX ".jnilib")
973 if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL "MSYS")
974 set_target_properties(${target_name} PROPERTIES PREFIX "")
976 elseif (swig_lowercase_language STREQUAL "lua")
977 if(_SAM_TYPE STREQUAL "MODULE")
978 set_target_properties(${target_name} PROPERTIES PREFIX "")
980 elseif (swig_lowercase_language STREQUAL "python")
981 if (UseSWIG_TARGET_NAME_PREFERENCE STREQUAL "STANDARD" AND NOT SWIG_MODULE_${name}_NOPROXY)
982 # swig will produce a module.py containing an 'import _modulename' statement,
983 # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32),
984 # unless the -noproxy flag is used
985 set_target_properties(${target_name} PROPERTIES PREFIX "_")
987 set_target_properties(${target_name} PROPERTIES PREFIX "")
989 # Python extension modules on Windows must have the extension ".pyd"
990 # instead of ".dll" as of Python 2.5. Older python versions do support
992 # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000
994 # Windows: .dll is no longer supported as a filename extension for extension modules.
995 # .pyd is now the only filename extension that will be searched for.
997 if(WIN32 AND NOT CYGWIN)
998 set_target_properties(${target_name} PROPERTIES SUFFIX ".pyd")
1000 elseif (swig_lowercase_language STREQUAL "r")
1001 set_target_properties(${target_name} PROPERTIES PREFIX "")
1002 elseif (swig_lowercase_language STREQUAL "ruby")
1005 # then ruby will look for a library whose name is platform dependent, namely
1006 # MacOS : LIBRARY.bundle
1007 # Windows: LIBRARY.dll
1008 # Linux : LIBRARY.so
1009 set_target_properties (${target_name} PROPERTIES PREFIX "")
1011 set_target_properties (${target_name} PROPERTIES SUFFIX ".bundle")
1013 elseif (swig_lowercase_language STREQUAL "perl" OR swig_lowercase_language STREQUAL "perl5")
1014 # assume empty prefix because we expect the module to be dynamically loaded
1015 set_target_properties (${target_name} PROPERTIES PREFIX "")
1017 set_target_properties (${target_name} PROPERTIES SUFFIX ".dylib")
1019 elseif (swig_lowercase_language STREQUAL "fortran")
1020 # Do *not* override the target's library prefix
1021 elseif (swig_lowercase_language STREQUAL "csharp")
1022 cmake_policy(GET CMP0122 csharp_naming_policy)
1023 if (csharp_naming_policy STREQUAL "NEW")
1024 # Do *not* override the target's library prefix
1026 if (NOT csharp_naming_policy)
1027 cmake_policy(GET_WARNING CMP0122 _cmp0122_warning)
1028 message(AUTHOR_WARNING "${_cmp0122_warning}\n")
1030 set_target_properties (${target_name} PROPERTIES PREFIX "")
1033 set_target_properties (${target_name} PROPERTIES SUFFIX ".dylib")
1036 # assume empty prefix because we expect the module to be dynamically loaded
1037 set_target_properties (${target_name} PROPERTIES PREFIX "")
1040 # target property SWIG_SUPPORT_FILES_DIRECTORY specify output directories of support files
1041 set_property (TARGET ${target_name} PROPERTY SWIG_SUPPORT_FILES_DIRECTORY ${swig_generated_outdirs})
1042 # target property SWIG_SUPPORT_FILES lists principal proxy support files
1043 if (NOT SWIG_MODULE_${name}_NOPROXY)
1044 string(TOUPPER "${_SAM_LANGUAGE}" swig_uppercase_language)
1045 set(swig_all_support_files)
1046 foreach (swig_it IN LISTS SWIG_${swig_uppercase_language}_EXTRA_FILE_EXTENSIONS)
1047 set (swig_support_files ${swig_generated_sources})
1048 list (FILTER swig_support_files INCLUDE REGEX ".*${swig_it}$")
1049 list(APPEND swig_all_support_files ${swig_support_files})
1051 if (swig_all_support_files)
1052 list(REMOVE_DUPLICATES swig_all_support_files)
1054 set_property (TARGET ${target_name} PROPERTY SWIG_SUPPORT_FILES ${swig_all_support_files})
1057 # to ensure legacy behavior, export some variables
1058 set (SWIG_MODULE_${name}_LANGUAGE "${SWIG_MODULE_${name}_LANGUAGE}" PARENT_SCOPE)
1059 set (SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" PARENT_SCOPE)
1060 set (SWIG_MODULE_${name}_REAL_NAME "${target_name}" PARENT_SCOPE)
1061 set (SWIG_MODULE_${name}_NOPROXY "${SWIG_MODULE_${name}_NOPROXY}" PARENT_SCOPE)
1062 set (SWIG_MODULE_${name}_EXTRA_FLAGS "${SWIG_MODULE_${name}_EXTRA_FLAGS}" PARENT_SCOPE)
1063 # the last one is a bit crazy but it is documented, so...
1064 # NOTA: works as expected if only ONE input file is specified
1065 set (swig_generated_file_fullname "${swig_generated_file_fullname}" PARENT_SCOPE)
1069 # Like TARGET_LINK_LIBRARIES but for swig modules
1071 function(SWIG_LINK_LIBRARIES name)
1072 if (UseSWIG_TARGET_NAME_PREFERENCE STREQUAL "STANDARD")
1073 message(DEPRECATION "SWIG_LINK_LIBRARIES is deprecated. Use TARGET_LINK_LIBRARIES instead.")
1074 target_link_libraries(${name} ${ARGN})
1076 if(SWIG_MODULE_${name}_REAL_NAME)
1077 target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN})
1079 message(SEND_ERROR "Cannot find Swig library \"${name}\".")