Commit bfbca424 authored by Davis King's avatar Davis King

Changed the cmake code for finding libjpeg and libpng slightly

to avoid a cmake error on some platforms when one of these libraries
can't be found.
parent 2e5d2c46
......@@ -219,8 +219,10 @@ if (NOT TARGET dlib)
find_package(PNG QUIET)
# Make sure there isn't something wrong with the version of LIBPNG
# installed on this system.
set(CMAKE_REQUIRED_LIBRARIES ${PNG_LIBRARY})
CHECK_FUNCTION_EXISTS(png_create_read_struct LIBPNG_IS_GOOD)
if (PNG_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${PNG_LIBRARY})
CHECK_FUNCTION_EXISTS(png_create_read_struct LIBPNG_IS_GOOD)
endif()
if (PNG_FOUND AND LIBPNG_IS_GOOD)
include_directories(${PNG_INCLUDE_DIR})
set (dlib_needed_libraries ${dlib_needed_libraries} ${PNG_LIBRARY})
......@@ -272,8 +274,10 @@ if (NOT TARGET dlib)
# Make sure there isn't something wrong with the version of libjpeg
# installed on this system. Also don't use the installed libjpeg
# if this is an APPLE system because apparently it's broken (as of 2015/01/01).
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY})
CHECK_FUNCTION_EXISTS(jpeg_read_header LIBJPEG_IS_GOOD)
if (JPEG_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY})
CHECK_FUNCTION_EXISTS(jpeg_read_header LIBJPEG_IS_GOOD)
endif()
if (JPEG_FOUND AND LIBJPEG_IS_GOOD AND NOT APPLE)
include_directories(${JPEG_INCLUDE_DIR})
set (dlib_needed_libraries ${dlib_needed_libraries} ${JPEG_LIBRARY})
......
Markdown is supported
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