summaryrefslogtreecommitdiff
path: root/src/FindMad.cmake
blob: f05f469c8ec74aed1479a8e03cbd71deafb1041a (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
#  MAD_INCLUDE_DIRS - where to find curl/curl.h, etc.
#  MAD_LIBRARIES    - List of libraries when using curl.
#  MAD_FOUND        - True if curl found.

# Look for the header file.
FIND_PATH(MAD_INCLUDE_DIR NAMES mad.h)
MARK_AS_ADVANCED(MAD_INCLUDE_DIR)

# Look for the library.
FIND_LIBRARY(MAD_LIBRARY NAMES mad)
MARK_AS_ADVANCED(MAD_LIBRARY)

# Copy the results to the output variables.
IF(MAD_INCLUDE_DIR AND MAD_LIBRARY)
  SET(MAD_FOUND 1)
  SET(MAD_LIBRARIES ${MAD_LIBRARY})
  SET(MAD_INCLUDE_DIRS ${MAD_INCLUDE_DIR})
ELSE(MAD_INCLUDE_DIR AND MAD_LIBRARY)
  SET(MAD_FOUND 0)
  SET(MAD_LIBRARIES)
  SET(MAD_INCLUDE_DIRS)
ENDIF(MAD_INCLUDE_DIR AND MAD_LIBRARY)

# Report the results.
IF(NOT MAD_FOUND)
  SET(MAD_DIR_MESSAGE
    "libmad was not found. Make sure MAD_LIBRARY and MAD_INCLUDE_DIR are set.")
  IF(NOT MAD_FIND_QUIETLY)
    MESSAGE(STATUS "${MAD_DIR_MESSAGE}")
  ELSE(NOT MAD_FIND_QUIETLY)
    IF(MAD_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "${MAD_DIR_MESSAGE}")
    ENDIF(MAD_FIND_REQUIRED)
  ENDIF(NOT MAD_FIND_QUIETLY)
ENDIF(NOT MAD_FOUND)