On 9/16/2011 12:22 PM, James Bigler wrote: > 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.
CMake computes object file names deterministically for each source file compiled in each target. There is no clash detection. The deterministic algorithm guarantees that there will be no conflicts except in pathological cases. > 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). CMake uses "__/" instead of "../". > And what if I had an absolute file path? What do I do then? CMake takes of leading slashes and places ":" with "_". After the above transformations CMake then does a bunch more magic to prevent the paths from getting too long for Windows path length limits. The C++ code that computes object names is here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v2.8.5#l2580 -Brad _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers