[PATCH] FindXine: Make version detection work with xine >= 1.2.0.

Alexander Neundorf neundorf at kde.org
Thu Jan 26 19:36:50 UTC 2012


On Wednesday 25 January 2012, Raphael Kubo da Costa wrote:
> Starting with the recently released version 1.2.0, xine has its version
> number macros in xine/version.h instead of xine.h itself.
> 
> Account for this case by checking if xine/version.h exists and falling
> back to xine.h if it doesn't when reading the version numbers.

Looks good.
Another idea would be to try_compile() a small binary and turn the version 
numbers into a string by doing this, and the parsing that string out of the 
executable.
This is what cmake does e.g. for determining the type sizes.

Alex


> ---
>  cmake/modules/FindXine.cmake |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/cmake/modules/FindXine.cmake b/cmake/modules/FindXine.cmake
> index 0319b7d..7dd08be 100644
> --- a/cmake/modules/FindXine.cmake
> +++ b/cmake/modules/FindXine.cmake
> @@ -47,7 +47,13 @@ FIND_PROGRAM(XINECONFIG_EXECUTABLE NAMES xine-config
> 
>  # Get the version number from xine.h and store it in the cache:
>  IF(XINE_INCLUDE_DIR  AND NOT  XINE_VERSION)
> -  FILE(READ ${XINE_INCLUDE_DIR}/xine.h XINE_VERSION_CONTENT)
> +  IF(EXISTS ${XINE_INCLUDE_DIR}/xine/version.h) # xine 1.2.0+
> +    SET(XINE_VERSION_FILE ${XINE_INCLUDE_DIR}/xine/version.h)
> +  ELSE(EXISTS ${XINE_INCLUDE_DIR}/xine/version.h)
> +    SET(XINE_VERSION_FILE ${XINE_INCLUDE_DIR}/xine.h)
> +  ENDIF(EXISTS ${XINE_INCLUDE_DIR}/xine/version.h)
> +
> +  FILE(READ ${XINE_VERSION_FILE} XINE_VERSION_CONTENT)
>    STRING(REGEX MATCH "#define *XINE_MAJOR_VERSION *([0-9]+)"  _dummy
> "${XINE_VERSION_CONTENT}") SET(XINE_VERSION_MAJOR "${CMAKE_MATCH_1}")



More information about the Kde-buildsystem mailing list