I am using cmake (3.5.0) to compile a C++ probject on Ubuntu 14.04, which
depends on Nvidia Cudnn. It seems that the cmake does not provide the
correct paths of cudnn to the linker although I have configured the paths.

File FindCUDNN.cmake:

FIND_PATH(CUDNN_INCLUDE_DIR NAME "cudnn.h" PATHS "$ENV{CMAKE_INCLUDE_PATH}")
FIND_LIBRARY(CUDNN_LIBRARIES NAME "libcudnn.so" PATHS
"$ENV{CMAKE_LIBRARY_PATH}")
INCLUDE(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDNN DEFAULT_MSG CUDNN_INCLUDE_DIR
CUDNN_LIBRARIES)
MARK_AS_ADVANCED(CUDNN_INCLUDE_DIR CUDNN_LIBRARIES)

CMakeLists.txt:

FIND_PACKAGE(CUDNN REQUIRED)
LIST(APPEND LINKER_LIBS ${CUDNN_LIBRARIES})
...
ADD_LIBRARY(myobjects OBJECT ${mysources})
ADD_LIBRARY(mylib SHARED $<TARGET_OBJECTS:myobjects> ${cuda_objs})
TARGET_LINK_LIBRARIES(mylib ${LINKER_LIBS})

CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH are exported to the paths of cudnn5
in my home folder. After cmake .., the paths in CmakeCache.txt are set to
cudnn5. However, the linker (and link.txt) uses -lcudnn without paths to
cudnn5. Consequently, it links the cudnn4 in the system folder, i.e.
/usr/local/cuda/lib64.

Note: If there is no cudnn4 in my system folder, everything is fine. The
link.txt file and the output of make VERBOSE=1 use the absolute paths of
cudnn 5 during linking.


Thanks.

Wei.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to