diff options
Diffstat (limited to 'cmake/modules/FindSWIG.cmake')
| -rw-r--r-- | cmake/modules/FindSWIG.cmake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/modules/FindSWIG.cmake b/cmake/modules/FindSWIG.cmake new file mode 100644 index 0000000..523b49b --- /dev/null +++ b/cmake/modules/FindSWIG.cmake | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindSWIG | ||
| 3 | # -------- | ||
| 4 | # Finds the SWIG executable | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # SWIG_FOUND - system has SWIG | ||
| 9 | # SWIG_EXECUTABLE - the SWIG executable | ||
| 10 | |||
| 11 | find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig | ||
| 12 | PATH_SUFFIXES swig) | ||
| 13 | if(SWIG_EXECUTABLE) | ||
| 14 | execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib | ||
| 15 | OUTPUT_VARIABLE SWIG_DIR | ||
| 16 | ERROR_VARIABLE SWIG_swiglib_error | ||
| 17 | RESULT_VARIABLE SWIG_swiglib_result) | ||
| 18 | execute_process(COMMAND ${SWIG_EXECUTABLE} -version | ||
| 19 | OUTPUT_VARIABLE SWIG_version_output | ||
| 20 | ERROR_VARIABLE SWIG_version_output | ||
| 21 | RESULT_VARIABLE SWIG_version_result) | ||
| 22 | string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" | ||
| 23 | SWIG_VERSION "${SWIG_version_output}") | ||
| 24 | endif() | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | find_package_handle_standard_args(SWIG | ||
| 28 | REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR | ||
| 29 | VERSION_VAR SWIG_VERSION) | ||
