From 01f7fd13ea3f2b519312900333f9b68847fd1633 Mon Sep 17 00:00:00 2001 From: "nate.crosswhite" Date: Thu, 23 Apr 2015 13:59:34 -0400 Subject: [PATCH] Add cmake option to use external libjpeg on Mac OS --- dlib/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index 71e680c86..8d897e27f 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -70,6 +70,8 @@ if (NOT TARGET dlib) "Disable this if you don't want to link against libpng" ) set (DLIB_LINK_WITH_LIBJPEG_STR "Disable this if you don't want to link against libjpeg" ) + set (DLIB_USE_EXTERNAL_LIBJPEG_STR + "Enable if this if you want to enforce linking to an external libjpeg on Max OS X systems" ) set (DLIB_LINK_WITH_SQLITE3_STR "Disable this if you don't want to link against sqlite3" ) #set (DLIB_LINK_WITH_FFTW_STR "Disable this if you don't want to link against fftw" ) @@ -82,6 +84,7 @@ if (NOT TARGET dlib) option(DLIB_USE_LAPACK ${DLIB_USE_LAPACK_STR} ON) option(DLIB_LINK_WITH_LIBPNG ${DLIB_LINK_WITH_LIBPNG_STR} ON) option(DLIB_LINK_WITH_LIBJPEG ${DLIB_LINK_WITH_LIBJPEG_STR} ON) + option(DLIB_USE_EXTERNAL_LIBJPEG ${DLIB_USE_EXTERNAL_LIBJPEG_STR} OFF) option(DLIB_LINK_WITH_SQLITE3 ${DLIB_LINK_WITH_SQLITE3_STR} ON) #option(DLIB_LINK_WITH_FFTW ${DLIB_LINK_WITH_FFTW_STR} ON) @@ -279,7 +282,7 @@ if (NOT TARGET dlib) 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) + if (JPEG_FOUND AND LIBJPEG_IS_GOOD AND (NOT APPLE OR DLIB_USE_EXTERNAL_LIBJPEG)) include_directories(${JPEG_INCLUDE_DIR}) set (dlib_needed_libraries ${dlib_needed_libraries} ${JPEG_LIBRARY}) else()