diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 90e4485..8457f1e 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -4,7 +4,15 @@
 #
 # Find JPEG
 #
-# Find the native JPEG includes and library This module defines
+# Find the native JPEG includes and library.
+#
+# This modules can be configured with
+#
+# ::
+#
+#   JPEG_ROOT_DIR, a path pointing to a nonstandard jpeg installation.
+#
+# This module defines
 #
 # ::
 #
@@ -31,10 +39,20 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_path(JPEG_INCLUDE_DIR jpeglib.h)
+# Search JPEG_ROOT_DIR first if it is set.
+if(JPEG_ROOT_DIR)
+  set(_JPEG_SEARCH_ROOT PATHS ${JPEG_ROOT_DIR} NO_DEFAULT_PATH)
+  list(APPEND _JPEG_SEARCHES _JPEG_SEARCH_ROOT)
+endif()
 
 set(JPEG_NAMES ${JPEG_NAMES} jpeg)
-find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
+
+foreach(search ${_JPEG_SEARCHES})
+  find_path(JPEG_INCLUDE_DIR jpeglib.h ${${search}} PATH_SUFFIXES include)
+  find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} ${${search}} PATH_SUFFIXES include)
+endforeach()
+
+unset(_JPEG_SEARCHES)
 
 # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
 # all listed variables are TRUE
