[cosmetic] separate c-lang format commit
[xbmc.git] / cmake / modules / FindPlayerFactory.cmake
blob3ddf13a70bbe7b6b5bccae3129205baa7d74232d
1 #.rst:
2 # FindPlayerFactory
3 # --------
4 # Finds the PlayerFactory library
6 # This will define the following target:
8 #   ${APP_NAME_LC}::PlayerFactory   - The PlayerFactory library
10 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
11   find_package(PkgConfig)
12   if(PKG_CONFIG_FOUND)
13     if(PlayerFactory_FIND_VERSION)
14       if(PlayerFactory_FIND_VERSION_EXACT)
15         set(PlayerFactory_FIND_SPEC "=${PlayerFactory_FIND_VERSION_COMPLETE}")
16       else()
17         set(PlayerFactory_FIND_SPEC ">=${PlayerFactory_FIND_VERSION_COMPLETE}")
18       endif()
19     endif()
21     pkg_check_modules(PC_PLAYERFACTORY libpf-1.0${PlayerFactory_FIND_SPEC} QUIET)
22   endif()
24   find_path(PLAYERFACTORY_INCLUDE_DIR NAMES player-factory/common.hpp
25                                       HINTS ${PC_PLAYERFACTORY_INCLUDEDIR})
26   find_library(PLAYERFACTORY_LIBRARY NAMES pf-1.0
27                                      HINTS ${PC_PLAYERFACTORY_LIBDIR})
29   set(PLAYERFACTORY_VERSION ${PC_PLAYERFACTORY_VERSION})
31   include(FindPackageHandleStandardArgs)
32   find_package_handle_standard_args(PlayerFactory
33                                     REQUIRED_VARS PLAYERFACTORY_LIBRARY PLAYERFACTORY_INCLUDE_DIR
34                                     VERSION_VAR PLAYERFACTORY_VERSION)
36   if(PLAYERFACTORY_FOUND)
37     add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
38     set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
39                                                                      IMPORTED_LOCATION "${PLAYERFACTORY_LIBRARY}"
40                                                                      INTERFACE_INCLUDE_DIRECTORIES "${PLAYERFACTORY_INCLUDE_DIR}")
41   else()
42     if(PlayerFactory_FIND_REQUIRED)
43       message(FATAL_ERROR "PlayerFactory library not found.")
44     endif()
45   endif()
46 endif()