4 # Finds the GNU FriBidi library
6 # This will define the following target:
8 # ${APP_NAME_LC}::Fribidi - The FriBidi library
10 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
11 find_package(PkgConfig)
13 if(PKG_CONFIG_FOUND AND NOT (WIN32 OR WINDOWS_STORE))
14 pkg_check_modules(FRIBIDI fribidi IMPORTED_TARGET GLOBAL QUIET)
16 get_target_property(FRIBIDI_LIBRARY PkgConfig::FRIBIDI INTERFACE_LINK_LIBRARIES)
17 get_target_property(FRIBIDI_INCLUDE_DIR PkgConfig::FRIBIDI INTERFACE_INCLUDE_DIRECTORIES)
20 find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi.h
22 HINTS ${DEPENDS_PATH}/include)
23 find_library(FRIBIDI_LIBRARY NAMES fribidi libfribidi
24 HINTS ${DEPENDS_PATH}/lib)
27 include(FindPackageHandleStandardArgs)
28 find_package_handle_standard_args(FriBidi
29 REQUIRED_VARS FRIBIDI_LIBRARY FRIBIDI_INCLUDE_DIR
30 VERSION_VAR FRIBIDI_VERSION)
33 if(TARGET PkgConfig::FRIBIDI)
34 add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} ALIAS PkgConfig::FRIBIDI)
36 add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
37 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
38 IMPORTED_LOCATION "${FRIBIDI_LIBRARY}"
39 INTERFACE_INCLUDE_DIRECTORIES "${FRIBIDI_INCLUDE_DIR}")
42 if(FriBidi_FIND_REQUIRED)
43 message(FATAL_ERROR "FriBidi library was not found.")