diff options
| author | Allen Winter <allen.winter@kdab.com> | 2011-06-28 17:13:05 -0400 | 
|---|---|---|
| committer | Allen Winter <allen.winter@kdab.com> | 2011-06-28 17:13:05 -0400 | 
| commit | e15ffacc69242c89107afbfda6f8ece9f2b56633 (patch) | |
| tree | 34bed177321c49f883d9d75616947a18f38c037f /modules/FindXine.cmake | |
| parent | 5c79bed7250cb2f854bfb4f20e4d266925d94b54 (diff) | |
| parent | c06badd8d431583071cad638fea082ca0776a0a3 (diff) | |
| download | extra-cmake-modules-e15ffacc69242c89107afbfda6f8ece9f2b56633.tar.gz extra-cmake-modules-e15ffacc69242c89107afbfda6f8ece9f2b56633.tar.bz2  | |
Merge branch 'allen' of /data/kde/trunk/KDE/kdelibs
Diffstat (limited to 'modules/FindXine.cmake')
| -rw-r--r-- | modules/FindXine.cmake | 64 | 
1 files changed, 64 insertions, 0 deletions
diff --git a/modules/FindXine.cmake b/modules/FindXine.cmake new file mode 100644 index 00000000..4ad0c2a8 --- /dev/null +++ b/modules/FindXine.cmake @@ -0,0 +1,64 @@ +# - Try to find the XINE  library +# Once done this will define +# +#  XINE_FOUND - system has the XINE library +#  XINE_VERSION - XINE version +#  XINE_BUGFIX_VERSION - the XINE bugfix version +#  XINE_INCLUDE_DIR - the XINE include directory +#  XINE_LIBRARY - The libraries needed to use XINE +#  XINE_XCB_FOUND - libxine can use XCB for video output + +# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org> +# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (XINE_INCLUDE_DIR AND XINE_LIBRARY) +  # Already in cache, be silent +  set(Xine_FIND_QUIETLY TRUE) +endif (XINE_INCLUDE_DIR AND XINE_LIBRARY) + +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) +   pkg_check_modules(PC_LIBXINE QUIET libxine) +endif (PKG_CONFIG_FOUND) + +find_path(XINE_INCLUDE_DIR NAMES xine.h  +    HINTS                    # HINTS is new in cmake 2.6. These dirs will be preferred over the default ones +    ${PC_LIBXINE_INCLUDEDIR}  +    ${PC_LIBXINE_INCLUDE_DIRS}  +    ) + +find_library(XINE_LIBRARY NAMES xine + HINTS +  ${PC_LIBXINE_LIBDIR} +  ${PC_LIBXINE_LIBRARY_DIRS} + ) + +find_program(XINECONFIG_EXECUTABLE NAMES xine-config  +   HINTS +   ${PC_LIBXINE_PREFIX}/bin +) + +if (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE) +   exec_program(${XINECONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE XINE_VERSION) +   if("${XINE_VERSION}" VERSION_GREATER "1.1.0")   #if (... VERSION_GREATER) is new since cmake 2.6.2 +      set(XINE_VERSION_OK TRUE) +      string(REGEX REPLACE "[0-9]\\.[0-9]\\." "" XINE_BUGFIX_VERSION ${XINE_VERSION}) +   endif("${XINE_VERSION}" VERSION_GREATER "1.1.0") +endif (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE) + + +if( XINE_VERSION_OK) +  include(CheckCSourceCompiles) +  set(CMAKE_REQUIRED_INCLUDES ${XINE_INCLUDE_DIR}) +  set(CMAKE_REQUIRED_LIBRARIES ${XINE_LIBRARY}) +  check_c_source_compiles("#include <xine.h>\nint main()\n{\n  xine_open_video_driver(xine_new(), \"auto\", XINE_VISUAL_TYPE_XCB, NULL);\n  return 0;\n}\n" XINE_XCB_FOUND) +  set(XINE_FOUND TRUE) +endif(XINE_VERSION_OK) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Xine  "Could NOT find XINE 1.1.1 or greater"  XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE  XINE_VERSION_OK) + +mark_as_advanced(XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE)  | 
