[cmake-developers] Some advice

James Bigler jamesbigler at gmail.com
Thu Sep 15 16:22:52 EDT 2011


On Mon, Sep 12, 2011 at 3:35 PM, James Bigler <jamesbigler at gmail.com> wrote:

> I need some advice on how to fix a problem I'm having with files with the
> same name.
>
> I have two CUDA files with the same name in different directories:
>
> CUDA_ADD_EXECUTABLE(test-conflict
>   "path with spaces/conflict.cpp"
>   "path with spaces/conflict.cu"
>   "path with spaces/no-conflict.cpp"
>   "path with spaces/no-conflict.cu"
>   conflict-main.cpp
>   conflict.cpp
>   conflict.cu
>   )
>
> I notice that the cpp files get the following outputs:
>
> path with spaces/no-conflict.cpp: test-conflict.dir\Debug
> path with spaces/conflict.cpp:
> "test-conflict.dir\Debug\/path_with_spaces/conflict.cpp.obj"
> conflict.cpp: "test-conflict.dir\Debug\/conflict.cpp.obj"
>
> This seems to work well and everyone is happy.
>
> The FindCUDA code is a different story, and one I wish to get some more
> input on.  The current implementation takes the basename and merges it in
> with the target name like so (one example given):
>
>
> "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${cuda_target}_generated_${basename}${generated_extension}"
>
> The problem is two files with the same basename can cause collisions in the
> naming scheme.  I'm wondering if the best solution is to keep a per target
> list of basenames as a directory property and when collisions happen, create
> a new sub-directory to be used by the build script.  My question at this
> point is what and how to compute the non-conflicting directories.  Does
> anyone have any good suggestions for how to implement this?
>
> Thanks,
> James
>
>

How about telling me where I can find how CMake does this for the C code?  I
notice that it only puts sub directories when there's a conflict, so there's
logic somewhere that determines this and then determines what the
intermediate directories should be.

Thanks,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110915/a7de15fe/attachment.html>


More information about the cmake-developers mailing list