
message(STATUS "Looking for cuDNN install...")
# Look for cudnn, we will look in the same place as other CUDA
# libraries and also a few other places as well.
find_path(cudnn_include cudnn.h
    HINTS ${CUDA_INCLUDE_DIRS} ENV CUDNN_INCLUDE_DIR  ENV CUDNN_HOME
    PATHS /usr/local /usr/local/cuda "C:/Program Files/NVIDIA/CUDNN/*/include/${CUDA_VERSION}" "C:/Program Files/NVIDIA/CUDNN/*/include/*" ENV CPATH
    PATH_SUFFIXES include
    )
get_filename_component(cudnn_hint_path "${CUDA_CUBLAS_LIBRARIES}" PATH)
find_library(cudnn cudnn
    HINTS ${cudnn_hint_path} ENV CUDNN_LIBRARY_DIR  ENV CUDNN_HOME 
    PATHS /usr/local /usr/local/cuda "C:/Program Files/NVIDIA/CUDNN/*/lib/${CUDA_VERSION}" "C:/Program Files/NVIDIA/CUDNN/*/lib/*" ENV LD_LIBRARY_PATH
    PATH_SUFFIXES lib64 lib x64
    )
mark_as_advanced(cudnn cudnn_include)

if (cudnn AND cudnn_include)
    message(STATUS "Found cuDNN: " ${cudnn})
else()
    message(STATUS "*** cuDNN V5.0 OR GREATER NOT FOUND.                                                       ***")
    message(STATUS "*** Dlib requires cuDNN V5.0 OR GREATER.  Since cuDNN is not found DLIB WILL NOT USE CUDA. ***")
    message(STATUS "*** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNN's folder.                ***")
endif()
