Annotation of /trunk/cmake/FindSWIG.cmake
Parent Directory | Revision Log
Revision 433 -
(hide annotations)
(download)
Sat Dec 15 17:13:09 2007 UTC (16 years, 10 months ago) by niro
File size: 2263 byte(s)
Sat Dec 15 17:13:09 2007 UTC (16 years, 10 months ago) by niro
File size: 2263 byte(s)
-patch not working
1 | niro | 433 | # - Find SWIG |
2 | # This module finds an installed SWIG. It sets the following variables: | ||
3 | # SWIG_FOUND - set to true if SWIG is found | ||
4 | # SWIG_DIR - the directory where swig is installed | ||
5 | # SWIG_EXECUTABLE - the path to the swig executable | ||
6 | # SWIG_VERSION - the version number of the swig executable | ||
7 | # | ||
8 | # All informations are collected from the SWIG_EXECUTABLE so the | ||
9 | # version to be found can be changed from the command line by | ||
10 | # means of setting SWIG_EXECUTABLE | ||
11 | # | ||
12 | |||
13 | SET(SWIG_FOUND FALSE) | ||
14 | |||
15 | FIND_PROGRAM(SWIG_EXECUTABLE swig) | ||
16 | |||
17 | IF(SWIG_EXECUTABLE) | ||
18 | EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib | ||
19 | OUTPUT_VARIABLE SWIG_swiglib_output | ||
20 | ERROR_VARIABLE SWIG_swiglib_error | ||
21 | RESULT_VARIABLE SWIG_swiglib_result) | ||
22 | |||
23 | IF(SWIG_swiglib_result) | ||
24 | MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") | ||
25 | ELSE(SWIG_swiglib_result) | ||
26 | STRING(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) | ||
27 | # force the path to be computed each time in case SWIG_EXECUTABLE has changed. | ||
28 | SET(SWIG_DIR SWIG_DIR-NOTFOUND) | ||
29 | FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) | ||
30 | IF(SWIG_DIR) | ||
31 | SET(SWIG_FOUND 1) | ||
32 | SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) | ||
33 | EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version | ||
34 | OUTPUT_VARIABLE SWIG_version_output | ||
35 | ERROR_VARIABLE SWIG_version_output | ||
36 | RESULT_VARIABLE SWIG_version_result) | ||
37 | IF(SWIG_version_result) | ||
38 | MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}") | ||
39 | ELSE(SWIG_version_result) | ||
40 | STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" | ||
41 | SWIG_version_output "${SWIG_version_output}") | ||
42 | SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE) | ||
43 | ENDIF(SWIG_version_result) | ||
44 | ENDIF(SWIG_DIR) | ||
45 | ENDIF(SWIG_swiglib_result) | ||
46 | ENDIF(SWIG_EXECUTABLE) | ||
47 | |||
48 | IF(NOT SWIG_FOUND) | ||
49 | IF(NOT SWIG_FIND_QUIETLY) | ||
50 | IF(SWIG_FIND_REQUIRED) | ||
51 | MESSAGE(FATAL_ERROR "SWIG was not found. Please specify Swig executable location") | ||
52 | ELSE(SWIG_FIND_REQUIRED) | ||
53 | MESSAGE(STATUS "SWIG was not found. Please specify Swig executable location") | ||
54 | ENDIF(SWIG_FIND_REQUIRED) | ||
55 | ENDIF(NOT SWIG_FIND_QUIETLY) | ||
56 | ENDIF(NOT SWIG_FOUND) |