Subject: Re: [Fenics-ufc] [Branch ~ufc-core/ufc/main] Rev 331: Another attempt at fixing swig2.0

From: Johannes Ring <[email-masked]>
Date: Mon, 14 Mar 2011 14:34:31 +0100

Is it necessary to include this file? Isn't it easy enough to set
SWIG_EXECUTABLE when building?

Johannes

On Mon, Mar 14, 2011 at 2:27 PM,  <[email-masked]> wrote:
> ------------------------------------------------------------
> revno: 331
> committer: Garth N. Wells <[email-masked]>
> branch nick: ufc
> timestamp: Mon 2011-03-14 13:20:34 +0000
> message:
>  Another attempt at fixing swig2.0
> modified:
>  cmake/modules/FindSWIG.cmake
>
>
> --
> lp:ufc
> https://code.launchpad.net/~ufc-core/ufc/main
>
> You are subscribed to branch lp:ufc.
> To unsubscribe from this branch go to https://code.launchpad.net/~ufc-core/ufc/main/+edit-subscription
>
> === modified file 'cmake/modules/FindSWIG.cmake'
> --- cmake/modules/FindSWIG.cmake        2011-03-14 13:10:11 +0000
> +++ cmake/modules/FindSWIG.cmake        2011-03-14 13:20:34 +0000
> @@ -5,9 +5,6 @@
>  #  SWIG_EXECUTABLE - the path to the swig executable
>  #  SWIG_VERSION   - the version number of the swig executable
>  #
> -# The minimum required version of SWIG can be specified using the
> -# standard syntax, e.g. FIND_PACKAGE(SWIG 1.1)
> -#
>  # 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
> @@ -23,10 +20,13 @@
>  # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>  # See the License for more information.
>  #=============================================================================
> -# (To distribute this file outside of CMake, substitute the full
> +# (To distributed this file outside of CMake, substitute the full
>  #  License text for the above reference.)
>
> -FIND_PROGRAM(SWIG_EXECUTABLE NAMES swig swig2.0)
> +SET(SWIG_FOUND FALSE)
> +
> +FIND_PROGRAM(SWIG_EXECUTABLE swig)
> +FIND_PROGRAM(SWIG_EXECUTABLE swig2.0)
>
>  IF(SWIG_EXECUTABLE)
>   EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib
> @@ -34,7 +34,7 @@
>     ERROR_VARIABLE SWIG_swiglib_error
>     RESULT_VARIABLE SWIG_swiglib_result)
>
> -  IF(SWIG_swiglib_result)
> +  IF(SWIG_swiglib_result)
>     IF(SWIG_FIND_REQUIRED)
>       MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
>     ELSE(SWIG_FIND_REQUIRED)
> @@ -46,6 +46,7 @@
>     SET(SWIG_DIR SWIG_DIR-NOTFOUND)
>     FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output})
>     IF(SWIG_DIR)
> +      SET(SWIG_FOUND 1)
>       SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake)
>       EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
>         OUTPUT_VARIABLE SWIG_version_output
> @@ -62,7 +63,12 @@
>   ENDIF(SWIG_swiglib_result)
>  ENDIF(SWIG_EXECUTABLE)
>
> -#INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
> -INCLUDE(FindPackageHandleStandardArgs)
> -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG  REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
> -                                        VERSION_VAR SWIG_VERSION )
> +IF(NOT SWIG_FOUND)
> +  IF(NOT SWIG_FIND_QUIETLY)
> +    IF(SWIG_FIND_REQUIRED)
> +      MESSAGE(FATAL_ERROR "SWIG was not found. Please specify Swig executable location")
> +    ELSE(SWIG_FIND_REQUIRED)
> +      MESSAGE(STATUS "SWIG was not found. Please specify Swig executable location")
> +    ENDIF(SWIG_FIND_REQUIRED)
> +  ENDIF(NOT SWIG_FIND_QUIETLY)
> +ENDIF(NOT SWIG_FOUND)
>
>
>

---

From: "Garth N. Wells" <[email-masked]>
Date: Mon, 14 Mar 2011 14:45:19 +0000

> SWIG_EXECUTABLE when building?

I wanted the configuration to be automatic on 'major' platforms (e.g.
Debian and Ubuntu).

I've changed things to a simpler fix - just a

  find_program(SWIG_EXECUTABLE swig2.0)

line in the top-level CMakeLists.cmake.  When 'swig2.0' -> 'swig', we
can remove the hack.

Garth

> _______________________________________________
> Mailing list: https://launchpad.net/~fenics-ufc
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~fenics-ufc
> More help   : https://help.launchpad.net/ListHelp

---

From: Johannes Ring <[email-masked]>
Date: Mon, 14 Mar 2011 15:50:31 +0100

> line in the top-level CMakeLists.cmake.  When 'swig2.0' -> 'swig', we

OK, sounds good.

Johannes