diff options
author | Brad King <brad.king@kitware.com> | 2018-02-01 13:04:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-02-01 13:04:52 (GMT) |
commit | 3ffc9b99bb20b56d5dc232fee8c988aa34474a2f (patch) | |
tree | 5fff8953619c195e0812db6189a822419fec2351 /Modules | |
parent | f04cc45850bf0eab1abe75680e3f6794830d0003 (diff) | |
parent | b844a414c7c0e7b32a43e14b71f30088ec473f46 (diff) | |
download | CMake-3ffc9b99bb20b56d5dc232fee8c988aa34474a2f.zip CMake-3ffc9b99bb20b56d5dc232fee8c988aa34474a2f.tar.gz CMake-3ffc9b99bb20b56d5dc232fee8c988aa34474a2f.tar.bz2 |
Merge topic 'UseSWIG-doc-clarify'
b844a414 UseSWIG: Clarify documentation of SWIG_OUTFILE_DIR
315b0927 UseSWIG: Improve documentation markup
ce130c7a UseSWIG: Convert docs to a bracket comment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1733
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/UseSWIG.cmake | 116 |
1 files changed, 64 insertions, 52 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b8bcd92..b38e2b7 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -1,58 +1,70 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# UseSWIG -# ------- -# -# Defines the following macros for use with SWIG: -# -# :: -# -# 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 -# -# Source files properties on module files can be set before the invocation -# of the SWIG_ADD_LIBRARY macro to specify special behavior of SWIG. -# -# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.:: -# -# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON) -# swig_add_library(mymod LANGUAGE python SOURCES mymod.i) -# -# The source file property SWIG_FLAGS adds custom flags to the SWIG executable. -# -# 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.:: -# -# set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname) -# -# To get the name of the swig module target library, use: ${SWIG_MODULE_${name}_REAL_NAME}. -# -# Also some variables can be set to specify special behavior of SWIG. -# -# CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls. -# -# CMAKE_SWIG_OUTDIR allows one to specify where to write -# the language specific files (swig -outdir option). -# -# 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. -# -# If the source file generated by swig need some special flag you can use:: -# -# set_source_files_properties( ${swig_generated_file_fullname} -# PROPERTIES COMPILE_FLAGS "-bla") +#[=======================================================================[.rst: +UseSWIG +------- + +Defines the following macros for use with SWIG: + +.. command:: 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. + +.. command:: 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: + +``CPLUSPLUS`` + Call SWIG in c++ mode. For example: + + .. code-block:: cmake + + 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: + + .. code-block:: cmake + + 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>``. +#]=======================================================================] set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") |