Commit bf91e926 authored by Stefano Sinigardi's avatar Stefano Sinigardi
Browse files

update FindJPEG tu support debug configurations

parent a4e7538a
Pipeline #92427 passed with stage
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#
#.rst:
# FindJPEG
# --------
#
# Find JPEG
#
# Find the native JPEG includes and library This module defines
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# The following variables will be defined:
#
# ``JPEG_FOUND``
# True if JPEG found on local system
#
# ``JPEG_INCLUDE_DIR``
# Location of JPEG header files
#
# ``JPEG_LIBRARY``
# List of JPEG libraries
#
# ::
# For compatibility with existing scripts, also this variable is defined but should not be used:
#
# JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
# JPEG_LIBRARIES, the libraries needed to use JPEG.
# JPEG_FOUND, If false, do not try to use JPEG.
# ``JPEG_LIBRARIES``
# List of JPEG libraries
#
# also defined, but not for general use are
# Hints
# ^^^^^
#
# ::
# ``JPEG_ROOT``
# Set this variable to a directory that contains a JPEG installation
#
# JPEG_LIBRARY, where to find the JPEG library.
#
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
find_path(JPEG_INCLUDE_DIR jpeglib.h)
# If the user has provided ``JPEG_ROOT``, use it! Choose items found
# at this location over system locations.
if( EXISTS "$ENV{JPEG_ROOT}" )
file( TO_CMAKE_PATH "$ENV{JPEG_ROOT}" JPEG_ROOT )
set( JPEG_ROOT "${JPEG_ROOT}" CACHE PATH "Prefix for JPEG installation." )
elseif(EXISTS "$ENV{JPEG_DIR}" )
file( TO_CMAKE_PATH "$ENV{JPEG_DIR}" JPEG_ROOT )
set( JPEG_ROOT "${JPEG_ROOT}" CACHE PATH "Prefix for JPEG installation." )
endif()
set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
list(APPEND JPEG_H_NAMES jpeglib.h jpeg.h)
list(APPEND JPEG_NAMES jpeg libjpeg)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
foreach (jpeg_name ${JPEG_NAMES})
list(APPEND JPEG_NAMES_DEBUG ${jpeg_name}d)
endforeach()
if(JPEG_FOUND)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
if(NOT JPEG_INCLUDE_DIR)
find_path(JPEG_INCLUDE_DIR NAMES ${JPEG_H_NAMES} PATHS ${JPEG_ROOT}/include ${JPEG_INCLUDE_DIRS} PATH_SUFFIXES jpeg Release Debug)
endif()
# Deprecated declarations.
set (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
if(JPEG_LIBRARY)
get_filename_component (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
if(NOT JPEG_LIBRARY)
find_library(JPEG_LIBRARY_RELEASE NAMES ${JPEG_NAMES} PATHS ${JPEG_ROOT} PATH_SUFFIXES jpeg )
find_library(JPEG_LIBRARY_DEBUG NAMES ${JPEG_NAMES_DEBUG} PATHS ${JPEG_ROOT} PATH_SUFFIXES debug jpeg )
select_library_configurations(JPEG)
endif()
mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR )
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
find_package_handle_standard_args(JPEG REQUIRED_VARS JPEG_LIBRARY JPEG_INCLUDE_DIR)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment