PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDA_TOOLKIT_INCLUDE}
DOC "Path to cuDNN include directory." )
- get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)
- find_library(CUDNN_LIBRARY NAMES libcudnn.so # libcudnn_static.a
- PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDNN_INCLUDE} ${__libpath_hist}
- DOC "Path to cuDNN library.")
+ # dynamic libs have different suffix in mac and linux
+ if(APPLE)
+ set(CUDNN_LIB_NAME "libcudnn.dylib")
+ else()
+ set(CUDNN_LIB_NAME "libcudnn.so")
+ endif()
+ get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)
+ find_library(CUDNN_LIBRARY NAMES ${CUDNN_LIB_NAME}
+ PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDNN_INCLUDE} ${__libpath_hist} ${__libpath_hist}/../lib
+ DOC "Path to cuDNN library.")
+
if(CUDNN_INCLUDE AND CUDNN_LIBRARY)
set(HAVE_CUDNN TRUE PARENT_SCOPE)
set(CUDNN_FOUND TRUE PARENT_SCOPE)