<div dir="ltr"><div><div><div>Hi,<br></div>Thanks for the question. I guess not indeed but we are not expert and I'm not 100% sure of my answer. I believe (from what I understand) that this has been done to circumvent export problems (as pointed out in a recent <a href="https://github.com/SimonRit/RTK/pull/117/files">pull-request</a>). I guess we need to make sure that the export and<br>  target_link_libraries(rtkcuda ${CUDA_LIBRARIES} ${CUDA_cufft_LIBRARY} ${CUDA_cublas_LIBRARY} RTK ITKCudaCommon)<br></div>are complete and then we can apply your patch.</div><div>Do you think this would also solve <a href="https://github.com/SimonRit/RTK/issues/118">this issue</a>?</div>Simon<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 22, 2017 at 12:32 PM, Fredrik Hellman <span dir="ltr"><<a href="mailto:fredrik.hellman@gmail.com" target="_blank">fredrik.hellman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>I noticed that RTK_LIBRARIES also contains the paths to the CUDA libaries: cuda, cudart, cufft, cublas.</div><div><br></div><div>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.<br></div><div><br></div><div><div>So, the general question is: Should third-party libraries be included in the variable XXX_LIBRARIES after running find_package?</div><div><br></div><div>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.</div></div><div><br></div><div><div>---</div><div> code/CMakeLists.txt | 2 +-</div><div> 1 file changed, 1 insertion(+), 1 deletion(-)</div><div><br></div><div>diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt</div><div>index 437274ec..a1cdcec3 100644</div><div>--- a/code/CMakeLists.txt</div><div>+++ b/code/CMakeLists.txt</div><div>@@ -62,7 +62,7 @@ target_link_libraries(RTK lpsolve55)</div><div> #============================<wbr>=============================</div><div> # Cuda library stuff</div><div> if (RTK_USE_CUDA)</div><div>-  set (RTK_LIBRARIES ${RTK_LIBRARIES} rtkcuda ITKCudaCommon ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_CUFFT_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES})</div><div>+  set (RTK_LIBRARIES ${RTK_LIBRARIES} rtkcuda ITKCudaCommon)</div><div>   set (rtkcuda_CUDA_FILES</div><div>        rtkCudaCropImageFilter.cu</div><div>        rtkCudaUtilities.cu</div><span class="HOEnZb"><font color="#888888"><div>-- </div></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Best wishes,</div><div>Fredrik</div></font></span></div>
<br>______________________________<wbr>_________________<br>
Rtk-users mailing list<br>
<a href="mailto:Rtk-users@public.kitware.com">Rtk-users@public.kitware.com</a><br>
<a href="http://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/rtk-users</a><br>
<br></blockquote></div><br></div>