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_NAMEwill be set to the name of the swig module target library.
-
swig_link_libraries¶ 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:
CPLUSPLUSCall SWIG in c++ mode. For example:
set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON) swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
SWIG_FLAGSAdd custom flags to the SWIG executable.
SWIG_MODULE_NAMESpecify 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_FLAGSAdd flags to all swig calls.
CMAKE_SWIG_OUTDIRSpecify where to write the language specific files (swig
-outdiroption).SWIG_OUTFILE_DIRSpecify an output directory name where the generated source file will be placed. If not specified,
CMAKE_SWIG_OUTDIRis used.SWIG_MODULE_<name>_EXTRA_DEPSSpecify extra dependencies for the generated module for
<name>.