[cmake-developers] Some advice

James Bigler jamesbigler at gmail.com
Mon Sep 12 17:35:31 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110912/c51d1834/attachment.html>


More information about the cmake-developers mailing list