[cmake-developers] Bug in Visual Studio generators

Josh Green inbilla at gmail.com
Wed Apr 9 20:16:51 EDT 2014

Hi Brad,

Firstly, thanks for your attention and I really appreciate you're
working through the issue with me.

Thanks for your explanation of cmLocalGenerator::Convert.
My source tree roughly looks like this:
C:\dev\root\src\CMakeLists.txt -- root cmake lists file
C:\dev\root\src\build\ -- This is the target location for build files
to be placed.

I think by your definition, that means the build tree is inside the source tree.
Indeed, if I send the build files out to the 'root' directory, then
absolute paths are generated.

A few questions arise from this information then...

Is there any documentation that describes this behaviour?
Why would cmake want to generate relative files by default? (indeed
why in the case of build tree inside source tree? the only reason I
can think of would be to have 'portable' build files... but that isn't
supported by CMAKE, and certainly doesn't work with the visual studio
generators anyway).
What is the difference between having the build tree inside the source
tree, that it means the path generation behaviour needs to change?

Revisiting cmLocalGenerator::convert - It certainly looks like a
function that is all about creating a relative path.
Perhaps using this method isn't the best choice for the Visual Studio
I think, under Visual Studio the choice of absolute/relative paths
should be mostly driven by this 260 character limit, since the build
files are never going to be 'portable' anyway. What is the reason for
making them use relative paths 'when they can'? I'd imagine that under
VisualStudio, using an absolute path 'when they can' would actually be

Thanks for your time


More information about the cmake-developers mailing list