[CMake] CUDA OBJECT libraries?

James Bigler jamesbigler at gmail.com
Fri Jun 19 04:53:31 EDT 2015


I looked at it briefly one day, and I couldn't figure out a way to tie the
output of custom commands to the list of objects that add_library(OBJECTS)
produces.

Alternatively since all you want is a list of objects, FindCUDA can produce
this just as well.

Use the CUDA_WRAP_SRCS macro.  It produces a list of object files from .cu
files.  You can use this list and link multiple libraries from the same
objects.  Look at the documentation for CUDA_WRAP_SRCS too see how to call
it.

On Wed, Jun 17, 2015 at 5:01 PM, JR Cary <cary at txcorp.com> wrote:

>  I would like to use OBJECT libraries with CUDA.
>
> If I try
>
> cuda_add_library(foo OBJECT <some .cpp files> <some .cu files>)
>
> I get
>
> CMake Error at
> /opt/contrib-clangcxx11/cmake-3.2.2-ser/share/cmake-3.2/Modules/FindCUDA.cmake:1518
> (add_library):
>   OBJECT library "txsbaseobj" contains:
>
>     txsbaseobj_generated_TxsGpuInterpolator.cu.o
>     txsbaseobj_generated_TxsBaseTestKernels.cu.o
>     txsbaseobj_intermediate_link.o
>
>
> Is there a standard way of dealing with this?
>
> Thx.......
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150619/ba60b4af/attachment-0001.html>


More information about the CMake mailing list