File: FindJPEG.cmake

package info (click to toggle)
coda 2.25.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,008 kB
  • sloc: ansic: 121,488; javascript: 6,788; java: 2,369; python: 1,695; yacc: 1,007; makefile: 598; lex: 204; sh: 105; fortran: 60; xml: 5
file content (43 lines) | stat: -rw-r--r-- 1,445 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
# Find the Jpeg library
#
# This module defines
# JPEG_INCLUDE_DIR, where to find jpeglib.h
# JPEG_LIBRARIES, the libraries to link against to use JPEG.
# JPEG_FOUND, If false, do not try to use JPEG
#
# The user may specify JPEG_INCLUDE_DIR and JPEG_LIBRARY_DIR variables
# to locate include and library files
#
include(CheckLibraryExists)
include(CheckIncludeFiles)

set(JPEG_INCLUDE_DIR CACHE STRING "Location of JPEG include files")
set(JPEG_LIBRARY_DIR CACHE STRING "Location of JPEG library files")

if(JPEG_INCLUDE_DIR)
  set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR})
endif(JPEG_INCLUDE_DIR)

check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)

find_library(JPEG_LIBRARY NAMES jpeg libjpeg PATHS ${JPEG_LIBRARY_DIR})
if(JPEG_LIBRARY)
  check_library_exists(${JPEG_LIBRARY} jpeg_start_compress "" HAVE_JPEG_LIBRARY)
endif(JPEG_LIBRARY)
if(HAVE_JPEG_LIBRARY)
  set(JPEG_LIBRARIES ${JPEG_LIBRARY})
endif(HAVE_JPEG_LIBRARY)

if(WIN32 AND HAVE_JPEG_LIBRARY)
get_filename_component(JPEG_LIBRARY_NAME ${JPEG_LIBRARY} NAME_WE)
if(NOT JPEG_LIBRARY_DIR)
  get_filename_component(JPEG_LIBRARY_DIR ${JPEG_LIBRARY} DIRECTORY)
endif(NOT JPEG_LIBRARY_DIR)
file(GLOB JPEG_DLL ${JPEG_LIBRARY_DIR}/../bin/${JPEG_LIBRARY_NAME}*.dll)
if(JPEG_DLL)
set(JPEG_DLLS ${JPEG_DLL})
endif(JPEG_DLL)
endif(WIN32 AND HAVE_JPEG_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JPEG DEFAULT_MSG HAVE_JPEG_LIBRARY HAVE_JPEGLIB_H)