File: FindJPEG.cmake

package info (click to toggle)
coda 2.21.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,320 kB
  • sloc: ansic: 125,785; javascript: 6,732; java: 2,391; yacc: 1,007; python: 872; makefile: 615; lex: 204; sh: 99; fortran: 60; xml: 5
file content (40 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download | duplicates (6)
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
# 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(CheckIncludeFile)

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_file(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)
find_file(JPEG_DLL NAMES ${JPEG_LIBRARY_NAME}.dll PATHS ${JPEG_LIBRARY_DIR} ${JPEG_LIBRARY_DIR}/../bin)
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_LIBJPEG_H)