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)
13 if(PlayerFactory_FIND_VERSION)
14 if(PlayerFactory_FIND_VERSION_EXACT)
15 set(PlayerFactory_FIND_SPEC "=${PlayerFactory_FIND_VERSION_COMPLETE}")
17 set(PlayerFactory_FIND_SPEC ">=${PlayerFactory_FIND_VERSION_COMPLETE}")
21 pkg_check_modules(PC_PLAYERFACTORY libpf-1.0${PlayerFactory_FIND_SPEC} QUIET)
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}")
42 if(PlayerFactory_FIND_REQUIRED)
43 message(FATAL_ERROR "PlayerFactory library not found.")