summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSilk.cmake
blob: 9ed746a5fdfebc31811a3c9bf7a70ab057696a12 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This file is part of Mixxx, Digital DJ'ing software.
# Copyright (C) 2001-2020 Mixxx Development Team
# Distributed under the GNU General Public Licence (GPL) version 2 or any later
# later version. See the LICENSE file for details.

#[=======================================================================[.rst:
FindSilk
--------

Finds the Silk library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``Silk::Common``
  The Silk common library

``Silk::Fixed``
  The Silk fixed library

``Silk::Float``
  The Silk float library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``Silk_FOUND``
  True if the system has the Silk library.
``Silk_LIBRARIES``
  Libraries needed to link to Silk.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``Silk_Common_LIBRARY``
  The path to the Silk common library.

``Silk_Fixed_LIBRARY``
  The path to the Silk fixed library.

``Silk_Float_LIBRARY``
  The path to the Silk float library.

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

find_library(Silk_Common_LIBRARY
  NAMES silk_common
  DOC "Silk common library"
)
mark_as_advanced(Silk_Common_LIBRARY)

find_library(Silk_Fixed_LIBRARY
  NAMES silk_fixed
  DOC "Silk fixed library"
)
mark_as_advanced(Silk_Fixed_LIBRARY)

find_library(Silk_Float_LIBRARY
  NAMES silk_float
  DOC "Silk float library"
)
mark_as_advanced(Silk_Float_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  Silk
  DEFAULT_MSG
  Silk_Common_LIBRARY
  Silk_Fixed_LIBRARY
  Silk_Float_LIBRARY
)

if(Silk_FOUND)
  set(Silk_LIBRARIES
    "${Silk_Common_LIBRARY}"
    "${Silk_Fixed_LIBRARY}"
    "${Silk_Float_LIBRARY}"
  )

  if(NOT TARGET Silk::Common)
    add_library(Silk::Common UNKNOWN IMPORTED)
    set_target_properties(Silk::Common
      PROPERTIES
        IMPORTED_LOCATION "${Silk_Common_LIBRARY}"
    )
  endif()

  if(NOT TARGET Silk::Fixed)
    add_library(Silk::Fixed UNKNOWN IMPORTED)
    set_target_properties(Silk::Fixed
      PROPERTIES
        IMPORTED_LOCATION "${Silk_Fixed_LIBRARY}"
        INTERFACE_LINK_LIBRARIES Silk::Common
    )
  endif()

  if(NOT TARGET Silk::Float)
    add_library(Silk::Float UNKNOWN IMPORTED)
    set_target_properties(Silk::Float
      PROPERTIES
        IMPORTED_LOCATION "${Silk_Float_LIBRARY}"
        INTERFACE_LINK_LIBRARIES Silk::Common
    )
  endif()
endif()