Hi, 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 pull-request <https://github.com/SimonRit/RTK/pull/117/files>). I guess we need to make sure that the export and target_link_libraries(rtkcuda ${CUDA_LIBRARIES} ${CUDA_cufft_LIBRARY} ${CUDA_cublas_LIBRARY} RTK ITKCudaCommon) are complete and then we can apply your patch. Do you think this would also solve this issue <https://github.com/SimonRit/RTK/issues/118>? Simon
On Wed, Nov 22, 2017 at 12:32 PM, Fredrik Hellman <[email protected] > wrote: > 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 > > _______________________________________________ > Rtk-users mailing list > [email protected] > http://public.kitware.com/mailman/listinfo/rtk-users > >
_______________________________________________ Rtk-users mailing list [email protected] http://public.kitware.com/mailman/listinfo/rtk-users
