aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindFriBidi.cmake
blob: 91f3994e811b67a5d2fc9014d322cca09d7f1d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#.rst:
# FindFribidi
# -----------
# Finds the GNU FriBidi library
#
# This will define the following variables::
#
# FRIBIDI_FOUND - system has FriBidi
# FRIBIDI_INCLUDE_DIRS - the FriBidi include directory
# FRIBIDI_LIBRARIES - the FriBidi libraries
#
# and the following imported targets::
#
#   FriBidi::FriBidi   - The FriBidi library

if(PKG_CONFIG_FOUND)
  pkg_check_modules(PC_FRIBIDI fribidi QUIET)
endif()

find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h
                              PATHS ${PC_FRIBIDI_INCLUDEDIR})
find_library(FRIBIDI_LIBRARY NAMES fribidi libfribidi
                             PATHS ${PC_FRIBIDI_LIBDIR})

set(FRIBIDI_VERSION ${PC_FRIBIDI_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FriBidi
                                  REQUIRED_VARS FRIBIDI_LIBRARY FRIBIDI_INCLUDE_DIR
                                  VERSION_VAR FRIBIDI_VERSION)

if(FRIBIDI_FOUND)
  set(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
  set(FRIBIDI_INCLUDE_DIRS ${FRIBIDI_INCLUDE_DIR})
  if(PC_FRIBIDI_CFLAGS)
    set(FRIBIDI_DEFINITIONS ${PC_FRIBIDI_CFLAGS})
  endif()

  if(NOT TARGET FriBidi::FriBidi)
    add_library(FriBidi::FriBidi UNKNOWN IMPORTED)
    set_target_properties(FriBidi::FriBidi PROPERTIES
                                           IMPORTED_LOCATION "${FRIBIDI_LIBRARY}"
                                           INTERFACE_INCLUDE_DIRECTORIES "${FRIBIDI_INCLUDE_DIR}"
                                           INTERFACE_COMPILE_OPTIONS "${FRIBIDI_DEFINITIONS}")
  endif()
endif()

mark_as_advanced(FRIBIDI_INCLUDE_DIR FRIBIDI_LIBRARY)