cmake: fix linker deps for CUDA
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Wed, 16 Oct 2013 11:47:51 +0000 (15:47 +0400)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Wed, 16 Oct 2013 14:34:47 +0000 (18:34 +0400)
CMakeLists.txt
apps/CMakeLists.txt

index 97134f4..c30845e 100644 (file)
@@ -457,6 +457,18 @@ if(WITH_OPENCL)
 endif()
 
 # ----------------------------------------------------------------------------
+# Add CUDA libraries (needed for apps/tools, samples)
+# ----------------------------------------------------------------------------
+if(HAVE_CUDA)
+  set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
+  if(HAVE_CUBLAS)
+    set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cublas_LIBRARY})
+  endif()
+  if(HAVE_CUFFT)
+    set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
+  endif()
+endif()
+# ----------------------------------------------------------------------------
 # Solution folders:
 # ----------------------------------------------------------------------------
 if(ENABLE_SOLUTION_FOLDERS)
index 217490b..347dbac 100644 (file)
@@ -1,2 +1,4 @@
+link_libraries(${OPENCV_LINKER_LIBS})
+
 add_subdirectory(haartraining)
 add_subdirectory(traincascade)