Contents of /trunk/cmake/patches/cmake-2.4.7-FindSWIG.patch
Parent Directory | Revision Log
Revision 432 -
(show annotations)
(download)
Sat Dec 15 12:03:06 2007 UTC (16 years, 9 months ago) by niro
File size: 3934 byte(s)
Sat Dec 15 12:03:06 2007 UTC (16 years, 9 months ago) by niro
File size: 3934 byte(s)
-some fixes for cmake
1 | diff -Naur cmake-2.4.7/Modules/FindSWIG.cmake cmake-2.4.7-fixed/Modules/FindSWIG.cmake |
2 | --- cmake-2.4.7/Modules/FindSWIG.cmake 2007-07-16 23:12:30.000000000 +0200 |
3 | +++ cmake-2.4.7-fixed/Modules/FindSWIG.cmake 2007-12-15 13:04:16.000000000 +0100 |
4 | @@ -3,46 +3,54 @@ |
5 | # SWIG_FOUND - set to true if SWIG is found |
6 | # SWIG_DIR - the directory where swig is installed |
7 | # SWIG_EXECUTABLE - the path to the swig executable |
8 | +# SWIG_VERSION - the version number of the swig executable |
9 | +# |
10 | +# All informations are collected from the SWIG_EXECUTABLE so the |
11 | +# version to be found can be changed from the command line by |
12 | +# means of setting SWIG_EXECUTABLE |
13 | +# |
14 | |
15 | -SET(SWIG_FOUND FOOBAR) |
16 | -FIND_PATH(SWIG_DIR |
17 | - SWIGConfig.cmake |
18 | - /usr/share/swig1.3 |
19 | - /usr/lib/swig1.3 |
20 | - /usr/local/share/swig1.3) |
21 | -FIND_PATH(SWIG_DIR |
22 | - swig.swg |
23 | - /usr/share/swig1.3 |
24 | - /usr/lib/swig1.3 |
25 | - /usr/local/share/swig1.3) |
26 | -IF(EXISTS ${SWIG_DIR}) |
27 | - IF("x${SWIG_DIR}x" STREQUAL "x${CMAKE_ROOT}/Modulesx") |
28 | - MESSAGE("SWIG_DIR should not be modules subdirectory of CMake") |
29 | - ENDIF("x${SWIG_DIR}x" STREQUAL "x${CMAKE_ROOT}/Modulesx") |
30 | +SET(SWIG_FOUND FALSE) |
31 | |
32 | - IF(EXISTS ${SWIG_DIR}/SWIGConfig.cmake) |
33 | - INCLUDE(${SWIG_DIR}/SWIGConfig.cmake) |
34 | - SET(SWIG_FOUND 1) |
35 | - ELSE(EXISTS ${SWIG_DIR}/SWIGConfig.cmake) |
36 | - FIND_PROGRAM(SWIG_EXECUTABLE |
37 | - NAMES swig-1.3 swig |
38 | - PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ) |
39 | - SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) |
40 | - ENDIF(EXISTS ${SWIG_DIR}/SWIGConfig.cmake) |
41 | -ENDIF(EXISTS ${SWIG_DIR}) |
42 | +FIND_PROGRAM(SWIG_EXECUTABLE swig) |
43 | |
44 | -IF("x${SWIG_FOUND}x" STREQUAL "xFOOBARx") |
45 | - SET(SWIG_FOUND 0) |
46 | - IF(EXISTS ${SWIG_DIR}) |
47 | - IF(EXISTS ${SWIG_USE_FILE}) |
48 | - IF(EXISTS ${SWIG_EXECUTABLE}) |
49 | - SET(SWIG_FOUND 1) |
50 | - ENDIF(EXISTS ${SWIG_EXECUTABLE}) |
51 | - ENDIF(EXISTS ${SWIG_USE_FILE}) |
52 | - ENDIF(EXISTS ${SWIG_DIR}) |
53 | - IF(NOT ${SWIG_FOUND}) |
54 | - IF(${SWIG_FIND_REQUIRED}) |
55 | - MESSAGE(FATAL_ERROR "Swig was not found on the system. Please specify the location of Swig.") |
56 | - ENDIF(${SWIG_FIND_REQUIRED}) |
57 | - ENDIF(NOT ${SWIG_FOUND}) |
58 | -ENDIF("x${SWIG_FOUND}x" STREQUAL "xFOOBARx") |
59 | +IF(SWIG_EXECUTABLE) |
60 | + EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib |
61 | + OUTPUT_VARIABLE SWIG_swiglib_output |
62 | + ERROR_VARIABLE SWIG_swiglib_error |
63 | + RESULT_VARIABLE SWIG_swiglib_result) |
64 | + |
65 | + IF(SWIG_swiglib_result) |
66 | + MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") |
67 | + ELSE(SWIG_swiglib_result) |
68 | + STRING(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) |
69 | + # force the path to be computed each time in case SWIG_EXECUTABLE has changed. |
70 | + SET(SWIG_DIR SWIG_DIR-NOTFOUND) |
71 | + FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) |
72 | + IF(SWIG_DIR) |
73 | + SET(SWIG_FOUND 1) |
74 | + SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) |
75 | + EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version |
76 | + OUTPUT_VARIABLE SWIG_version_output |
77 | + ERROR_VARIABLE SWIG_version_output |
78 | + RESULT_VARIABLE SWIG_version_result) |
79 | + IF(SWIG_version_result) |
80 | + MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}") |
81 | + ELSE(SWIG_version_result) |
82 | + STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" |
83 | + SWIG_version_output "${SWIG_version_output}") |
84 | + SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE) |
85 | + ENDIF(SWIG_version_result) |
86 | + ENDIF(SWIG_DIR) |
87 | + ENDIF(SWIG_swiglib_result) |
88 | +ENDIF(SWIG_EXECUTABLE) |
89 | + |
90 | +IF(NOT SWIG_FOUND) |
91 | + IF(NOT SWIG_FIND_QUIETLY) |
92 | + IF(SWIG_FIND_REQUIRED) |
93 | + MESSAGE(FATAL_ERROR "SWIG was not found. Please specify Swig executable location") |
94 | + ELSE(SWIG_FIND_REQUIRED) |
95 | + MESSAGE(STATUS "SWIG was not found. Please specify Swig executable location") |
96 | + ENDIF(SWIG_FIND_REQUIRED) |
97 | + ENDIF(NOT SWIG_FIND_QUIETLY) |
98 | +ENDIF(NOT SWIG_FOUND) |