File: FindLibyaml.cmake

package info (click to toggle)
getdns 1.7.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,752 kB
  • sloc: ansic: 57,351; sh: 407; xml: 38; makefile: 22
file content (62 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download | duplicates (4)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#[=======================================================================[.rst:
FindLibyaml
----------

Find the Libyaml library

Imported targets
^^^^^^^^^^^^^^^^

This module defines the following :prop_tgt:`IMPORTED` targets:

``Libyaml::Libyaml``
  The Libyaml library, if found.

Result variables
^^^^^^^^^^^^^^^^

This module will set the following variables in your project:

``Libyaml_FOUND``
  If false, do not try to use Libyaml.
``LIBYAML_INCLUDE_DIR``
  where to find getdns/getdns.h, etc.
``LIBYAML_LIBRARIES``
  the libraries needed to use Libyaml.

#]=======================================================================]

find_path(LIBYAML_INCLUDE_DIR yaml.h
  HINTS
  "${LIBYAML_DIR}"
  "${LIBYAML_DIR}/include"
  )

find_library(LIBYAML_LIBRARY NAMES yaml libyaml
  HINTS
  "${LIBYAML_DIR}"
  "${LIBYAML_DIR}/lib"
  )

set(LIBYAML_LIBRARIES "")

if (LIBYAML_INCLUDE_DIR AND LIBYAML_LIBRARY)
  if (NOT TARGET Libyaml::Libyaml)
    add_library(Libyaml::Libyaml UNKNOWN IMPORTED)
    set_target_properties(Libyaml::Libyaml PROPERTIES
      INTERFACE_INCLUDE_DIRECTORIES "${LIBYAML_INCLUDE_DIR}"
      INTERFACE_LINK_LIBRARIES "${LIBYAML_LIBRARIES}"
      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
      IMPORTED_LOCATION "${LIBYAML_LIBRARY}"
      )
  endif ()
endif ()

list(APPEND LIBYAML_LIBRARIES "${LIBYAML_LIBRARY}")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libyaml
  REQUIRED_VARS LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR
  )

mark_as_advanced(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES LIBYAML_LIBRARY)