/[gentoo-x86]/dev-util/cmake/files/FindSWIG.cmake
Gentoo

Contents of /dev-util/cmake/files/FindSWIG.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sat Apr 4 12:39:26 2009 UTC (5 years, 4 months ago) by scarabeus
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Revision bump. Introduce some fixes. Remove old.
(Portage version: 2.2_rc26/cvs/Linux i686)

1 # - 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)

  ViewVC Help
Powered by ViewVC 1.1.20