UseSWIG

Defines the following macros for use with SWIG:

swig_add_library

Define swig module with given name and specified language:

swig_add_library(<name>
                 [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
                 LANGUAGE <language>
                 SOURCES <file>...
                 )

The variable SWIG_MODULE_<name>_REAL_NAME will be set to the name of the swig module target library.

Link libraries to swig module:

swig_link_libraries(<name> [ libraries ])

Source file properties on module files can be set before the invocation of the swig_add_library macro to specify special behavior of SWIG:

CPLUSPLUS

Call SWIG in c++ mode. For example:

set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
SWIG_FLAGS
Add custom flags to the SWIG executable.
SWIG_MODULE_NAME

Specify the actual import name of the module in the target language. This is required if it cannot be scanned automatically from source or different from the module file basename. For example:

set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)

Some variables can be set to specify special behavior of SWIG:

CMAKE_SWIG_FLAGS
Add flags to all swig calls.
CMAKE_SWIG_OUTDIR
Specify where to write the language specific files (swig -outdir option).
SWIG_OUTFILE_DIR
Specify an output directory name where the generated source file will be placed. If not specified, CMAKE_SWIG_OUTDIR is used.
SWIG_MODULE_<name>_EXTRA_DEPS
Specify extra dependencies for the generated module for <name>.

© 2000–2019 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/v3.11/module/UseSWIG.html