File: FindFreeImage.cmake

package info (click to toggle)
perceptualdiff 1.2-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,008 kB
  • ctags: 76
  • sloc: cpp: 948; sh: 100; makefile: 50
file content (83 lines) | stat: -rw-r--r-- 2,540 bytes parent folder | download
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
# Find the FreeImage library.
#
# This module defines
#  FREEIMAGE_FOUND             - True if FREEIMAGE was found.
#  FREEIMAGE_INCLUDE_DIRS      - Include directories for FREEIMAGE headers.
#  FREEIMAGE_LIBRARIES         - Libraries for FREEIMAGE.
#
# To specify an additional directory to search, set FREEIMAGE_ROOT.
#
# Copyright (c) 2010, Ewen Cheslack-Postava
# Based on FindSQLite3.cmake by:
#  Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
#  Extended by Siddhartha Chaudhuri, 2008.
#
# Redistribution and use is allowed according to the terms of the BSD license.
#

SET(FREEIMAGE_FOUND FALSE)
SET(FREEIMAGE_INCLUDE_DIRS)
SET(FREEIMAGE_LIBRARIES)

SET(SEARCH_PATHS
  $ENV{ProgramFiles}/freeimage/include
  $ENV{SystemDrive}/freeimage/include
  $ENV{ProgramFiles}/freeimage
  $ENV{SystemDrive}/freeimage
  )
IF(FREEIMAGE_ROOT)
  SET(SEARCH_PATHS
    ${FREEIMAGE_ROOT}
    ${FREEIMAGE_ROOT}/include
    ${SEARCH_PATHS}
    )
ENDIF()

FIND_PATH(FREEIMAGE_INCLUDE_DIRS
  NAMES FreeImage.h
  PATHS ${SEARCH_PATHS}
  NO_DEFAULT_PATH)
IF(NOT FREEIMAGE_INCLUDE_DIRS)  # now look in system locations
  FIND_PATH(FREEIMAGE_INCLUDE_DIRS NAMES FreeImage.h)
ENDIF(NOT FREEIMAGE_INCLUDE_DIRS)

SET(FREEIMAGE_LIBRARY_DIRS)
IF(FREEIMAGE_ROOT)
  SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_ROOT})
  IF(EXISTS "${FREEIMAGE_ROOT}/lib")
    SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_LIBRARY_DIRS} ${FREEIMAGE_ROOT}/lib)
  ENDIF()
  IF(EXISTS "${FREEIMAGE_ROOT}/lib/static")
    SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_LIBRARY_DIRS} ${FREEIMAGE_ROOT}/lib/static)
  ENDIF()
ENDIF()

# FREEIMAGE
# Without system dirs
FIND_LIBRARY(FREEIMAGE_LIBRARY
  NAMES freeimage
  PATHS ${FREEIMAGE_LIBRARY_DIRS}
  NO_DEFAULT_PATH
  )
IF(NOT FREEIMAGE_LIBRARY)  # now look in system locations
  FIND_LIBRARY(FREEIMAGE_LIBRARY NAMES freeimage)
ENDIF(NOT FREEIMAGE_LIBRARY)

SET(FREEIMAGE_LIBRARIES)
IF(FREEIMAGE_LIBRARY)
  SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY})
ENDIF()

IF(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)
  SET(FREEIMAGE_FOUND TRUE)
  IF(NOT FREEIMAGE_FIND_QUIETLY)
    MESSAGE(STATUS "Found FreeImage: headers at ${FREEIMAGE_INCLUDE_DIRS}, libraries at ${FREEIMAGE_LIBRARY_DIRS} :: ${FREEIMAGE_LIBRARIES}")
  ENDIF(NOT FREEIMAGE_FIND_QUIETLY)
ELSE(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)
  SET(FREEIMAGE_FOUND FALSE)
  IF(FREEIMAGE_FIND_REQUIRED)
    MESSAGE(STATUS "FreeImage not found")
  ENDIF(FREEIMAGE_FIND_REQUIRED)
ENDIF(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)

MARK_AS_ADVANCED(FREEIMAGE_INCLUDE_DIRS FREEIMAGE_LIBRARIES)