[CMake] How to place user-specified linked libraries *before* CUDA libraries?

Dmitry Mikushin dmitry at kernelgen.org
Wed Aug 28 14:17:04 EDT 2013


Thanks! Tried option (2), and it helps.

Best,
- D.

2013/8/28 James Bigler <jbigler at nvidia.com>:
> There are a couple of options you can do.
>
> 1. Create your own version of CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE.
> 2. (my vote) Override the value of CUDA_LIBRARIES just before your call to CUDA_ADD_LIBRARY/EXECUTABLE.
>
> set(CUDA_LIBRARIES myoverride_cudart ${CUDA_LIBRARIES})
> cuda_add_library(...)
> # Restore CUDA_LIBRARIES as you see fit
>
> James
>
> -----Original Message-----
> From: Dmitry Mikushin [mailto:dmitry at kernelgen.org]
> Sent: Tuesday, August 27, 2013 8:05 PM
> To: James Bigler; Abe Stephens
> Cc: cmake at cmake.org
> Subject: How to place user-specified linked libraries *before* CUDA libraries?
>
> Dear CUDA-for-CMake Maintainers,
>
> Our package links a shared library, which defines some replacement symbols for CUDA runtime (e.g. redefines cudaLaunch). In order to get our replacements to take precedence over CUDA runtime, we need the user-specified linked library to appear earlier in the link line than ${CUDA_LIBRARIES}. But from what I understand in FindCUDA.cmake (v2.8), it seems that CUDA runtime libraries are currently hardcoded to be always first in the link line. Is there a way to override this behavior?
>
> Thanks,
> - D.
> -----------------------------------------------------------------------------------
> This email message is for the sole use of the intended recipient(s) and may contain
> confidential information.  Any unauthorized review, use, disclosure or distribution
> is prohibited.  If you are not the intended recipient, please contact the sender by
> reply email and destroy all copies of the original message.
> -----------------------------------------------------------------------------------


More information about the CMake mailing list