[Rtk-users] Question on the definition of RTK_LIBRARIES from FindRTK.cmake
Fredrik Hellman
fredrik.hellman at gmail.com
Wed Nov 22 06:32:44 EST 2017
Hi,
I have been using the CMake find_package()-function to set the
RTK_LIBRARIES variable in order to link my application with RTK, rtkcuda
etc.
I noticed that RTK_LIBRARIES also contains the paths to the CUDA libaries:
cuda, cudart, cufft, cublas.
I have had some problems with this, since my application (forced by a bug
in FindCUDA for my CMake-version) needs to link with the static CUDA
libraries, while RTK links with the dynamic (or static, I am not sure).
Regardless, I end up with duplicate symbols for some cuda runtime API
functions when linking with ${RTK_LIBRARIES} and ${CUDA_LIBRARIES} for my
application.
So, the general question is: Should third-party libraries be included in
the variable XXX_LIBRARIES after running find_package?
I am not sure, but I believe not. The patch below in RTK fixed the problems
for me. Then, of course, I need to always link with CUDA from my
independent project (an application in my case) when linking with RTK. But
I guess that's the way it is typically done.
---
code/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index 437274ec..a1cdcec3 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -62,7 +62,7 @@ target_link_libraries(RTK lpsolve55)
#=========================================================
# Cuda library stuff
if (RTK_USE_CUDA)
- set (RTK_LIBRARIES ${RTK_LIBRARIES} rtkcuda ITKCudaCommon
${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_CUFFT_LIBRARIES}
${CUDA_CUBLAS_LIBRARIES})
+ set (RTK_LIBRARIES ${RTK_LIBRARIES} rtkcuda ITKCudaCommon)
set (rtkcuda_CUDA_FILES
rtkCudaCropImageFilter.cu
rtkCudaUtilities.cu
--
Best wishes,
Fredrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20171122/d905dd62/attachment.html>
More information about the Rtk-users
mailing list