aboutsummaryrefslogtreecommitdiff
path: root/modules/FindGIF.cmake
blob: a4316362cf46e09d8ab38b133de2ee0f5b98ba4e (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
# - Try to find GIF
# Once done this will define
#
#  GIF_FOUND - system has GIF
#  GIF_INCLUDE_DIR - the GIF include directory
#  GIF_LIBRARIES - Libraries needed to use GIF
#  GIF_DEFINITIONS - Compiler switches required for using GIF
#

IF (CACHED_GIF)

  # in cache already
  IF ("${CACHED_GIF}" STREQUAL "YES")
    SET(GIF_FOUND TRUE)
  ENDIF ("${CACHED_GIF}" STREQUAL "YES")

ELSE (CACHED_GIF)

  FIND_PATH(GIF_INCLUDE_DIR gif_lib.h
    /usr/include
    /usr/local/include
  )
  
  FIND_LIBRARY(GIF_LIBRARIES NAMES gif libgif ungif libungif giflib
    PATHS
    /usr/lib
    /usr/local/lib
  )
  
  if (GIF_INCLUDE_DIR AND GIF_LIBRARIES)
     set(GIF_FOUND TRUE)
     set(CACHED_GIF "YES")
  else (GIF_INCLUDE_DIR AND GIF_LIBRARIES)
     set(CACHED_GIF "NO")
  endif (GIF_INCLUDE_DIR AND GIF_LIBRARIES)
  
  if (GIF_FOUND)
    if (NOT GIF_FIND_QUIETLY)
      message(STATUS "Found GIF: ${GIF_LIBRARIES}")
    endif (NOT GIF_FIND_QUIETLY)
  else (GIF_FOUND)
    if (GIF_FIND_REQUIRED)
      message(FATAL_ERROR "Could NOT find GIF")
    endif (GIF_FIND_REQUIRED)
  endif (GIF_FOUND)
  
  set(CACHED_GIF ${CACHED_GIF} CACHE INTERNAL "If gif was checked")
  MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARIES)
  
ENDIF (CACHED_GIF)