summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-31 19:09:19 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-31 19:20:17 (GMT)
commit315b0927e951019b43714f654f7b039b32ae14a9 (patch)
tree008b6021b312d62fb350296c9c2b3573938d507c
parentce130c7a6bce84a9af3859c6f58a8d6c9f16afc7 (diff)
downloadCMake-315b0927e951019b43714f654f7b039b32ae14a9.zip
CMake-315b0927e951019b43714f654f7b039b32ae14a9.tar.gz
CMake-315b0927e951019b43714f654f7b039b32ae14a9.tar.bz2
UseSWIG: Improve documentation markup
-rw-r--r--Modules/UseSWIG.cmake73
1 files changed, 42 insertions, 31 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 91f9cf7..9a6d046 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -7,52 +7,63 @@ UseSWIG
Defines the following macros for use with SWIG:
-::
+.. command:: swig_add_library
- SWIG_ADD_LIBRARY(<name>
- [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
- LANGUAGE <language>
- SOURCES <file>...
- )
- - Define swig module with given name and specified language
- SWIG_LINK_LIBRARIES(name [ libraries ])
- - Link libraries to swig module
+ Define swig module with given name and specified language::
-Source files properties on module files can be set before the invocation
-of the SWIG_ADD_LIBRARY macro to specify special behavior of SWIG.
+ swig_add_library(<name>
+ [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
+ LANGUAGE <language>
+ SOURCES <file>...
+ )
-The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.::
+ The variable ``SWIG_MODULE_<name>_REAL_NAME`` will be set to the name
+ of the swig module target library.
- set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
- swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+.. command:: swig_link_libraries
-The source file property SWIG_FLAGS adds custom flags to the SWIG executable.
+ Link libraries to swig module::
-The source-file property SWIG_MODULE_NAME have to be provided to specify the actual
-import name of the module in the target language if it cannot be scanned automatically
-from source or different from the module file basename.::
+ swig_link_libraries(<name> [ libraries ])
- set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+Source file properties on module files can be set before the invocation
+of the ``swig_add_library`` macro to specify special behavior of SWIG:
-To get the name of the swig module target library, use: ${SWIG_MODULE_${name}_REAL_NAME}.
+``CPLUSPLUS``
+ Call SWIG in c++ mode. For example:
-Also some variables can be set to specify special behavior of SWIG.
+ .. code-block:: cmake
-CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls.
+ set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
+ swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
-CMAKE_SWIG_OUTDIR allows one to specify where to write
-the language specific files (swig -outdir option).
+``SWIG_FLAGS``
+ Add custom flags to the SWIG executable.
-SWIG_OUTFILE_DIR allows one to specify where to write the output file
-(swig -o option). If not specified, CMAKE_SWIG_OUTDIR is used.
-The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
-dependencies for the generated modules.
+``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:
-If the source file generated by swig need some special flag you can use::
+ .. code-block:: cmake
- set_source_files_properties( ${swig_generated_file_fullname}
- PROPERTIES COMPILE_FLAGS "-bla")
+ 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 where to write the output file (swig ``-o`` option).
+ If not specified, ``CMAKE_SWIG_OUTDIR`` is used.
+
+``SWIG_MODULE_<name>_EXTRA_DEPS``
+ Specify extra dependencies for the generated module for ``<name>``.
#]=======================================================================]
set(SWIG_CXX_EXTENSION "cxx")