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()