On Fri, Sep 16, 2011 at 5:11 AM, Alexander Neundorf <neund...@kde.org>wrote:
> On Thursday, September 15, 2011 10:22:52 PM James Bigler wrote: > > On Mon, Sep 12, 2011 at 3:35 PM, James Bigler <jamesbig...@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. > > CMake creates a directory for every target, and inside that directory, it > creates subdirectories for every subdirectory present in the input files. > To avoid clashes between foo.c and foo.cpp, the .o is simply appended, so > we > get foo.c.o and foo.cpp.o. > > Alex > Thanks for the response Alex, but that's not quite it. From my experiments, CMake only puts object files in sub directories (below the target sub-directory) when it detects the clash (see the original email). I also have clashes on file names and not just extensions. I'm trying to figure out how to best handle the partial paths. If you had this then I can compute the relative path with respect to CMAKE_CURRENT_SOURCE_DIR. dir1/file.cpp dir2/file.cpp What if I had this: ../dir1/file.cpp ../../dir2/file.cpp What do I use as the sub directory? I can't use ../ in the path as this will totally put things in the wrong directory (CMAKE_CURRENT_BINARY_DIR/CMakeFiles/target.dir/../dir1 would generally be a bad idea). And what if I had an absolute file path? What do I do then? James
_______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers