Commit 01f030dd authored by Davis King's avatar Davis King

Made cmake check that libpng and libjpeg actually contain the link symbols they

are supposed to since, on some systems, these libraries aren't installed
correctly and will cause linker errors if used.
parent fa60632d
...@@ -213,11 +213,16 @@ if (NOT TARGET dlib) ...@@ -213,11 +213,16 @@ if (NOT TARGET dlib)
) )
endif() endif()
INCLUDE (CheckFunctionExists)
if (DLIB_LINK_WITH_LIBPNG) if (DLIB_LINK_WITH_LIBPNG)
# try to find libpng # try to find libpng
find_package(PNG QUIET) find_package(PNG QUIET)
if (PNG_FOUND) # 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 AND LIBPNG_IS_GOOD)
include_directories(${PNG_INCLUDE_DIR}) include_directories(${PNG_INCLUDE_DIR})
set (dlib_needed_libraries ${dlib_needed_libraries} ${PNG_LIBRARY}) set (dlib_needed_libraries ${dlib_needed_libraries} ${PNG_LIBRARY})
else() else()
...@@ -265,7 +270,11 @@ if (NOT TARGET dlib) ...@@ -265,7 +270,11 @@ if (NOT TARGET dlib)
if (DLIB_LINK_WITH_LIBJPEG) if (DLIB_LINK_WITH_LIBJPEG)
# try to find libjpeg # try to find libjpeg
find_package(JPEG QUIET) find_package(JPEG QUIET)
if (JPEG_FOUND) # Make sure there isn't something wrong with the version of libjpeg
# installed on this system.
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY})
CHECK_FUNCTION_EXISTS(jpeg_read_header LIBJPEG_IS_GOOD)
if (JPEG_FOUND AND LIBJPEG_IS_GOOD)
include_directories(${JPEG_INCLUDE_DIR}) include_directories(${JPEG_INCLUDE_DIR})
set (dlib_needed_libraries ${dlib_needed_libraries} ${JPEG_LIBRARY}) set (dlib_needed_libraries ${dlib_needed_libraries} ${JPEG_LIBRARY})
else() else()
......
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