FindSWIGΒΆ
Find the Simplified Wrapper and Interface Generator (SWIG) executable.
This module finds an installed SWIG and determines its version. If a
COMPONENTS or OPTIONAL_COMPONENTS argument is given to find_package,
it will also determine supported target languages. The module sents the
following variables:
SWIG_FOUNDWhether SWIG and any required components were found on the system.
SWIG_EXECUTABLEPath to the SWIG executable.
SWIG_DIRPath to the installed SWIG
Libdirectory (result ofswig -swiglib).SWIG_VERSIONSWIG executable version (result of
swig -version).SWIG_<lang>_FOUNDIf
COMPONENTSorOPTIONAL_COMPONENTSare requested, each available target language<lang>(lowercase) will be set to TRUE.
Any COMPONENTS given to find_package should be the names of supported
target languages as provided to the LANGUAGE argument of swig_add_library,
such as python or perl5. Language names must be lowercase.
All information is collected from the SWIG_EXECUTABLE, so the version
to be found can be changed from the command line by means of setting
SWIG_EXECUTABLE.
Example usage requiring SWIG 4.0 or higher and Python language support, with optional Fortran support:
find_package(SWIG 4.0 COMPONENTS python OPTIONAL_COMPONENTS fortran)
if(SWIG_FOUND)
message("SWIG found: ${SWIG_EXECUTABLE}")
if(NOT SWIG_fortran_FOUND)
message(WARNING "SWIG Fortran bindings cannot be generated")
endif()
endif()