[CMake] Generating stand-alone Visual Studio projects?

Magnus Therning magnus at therning.org
Tue Oct 15 05:39:42 EDT 2013


On Tue, Oct 15, 2013 at 10:56 AM, Petr Kmoch <petr.kmoch at gmail.com> wrote:
> Hi Magnus.
>
> I am afraid that's not really possible (safely). CMake uses absolute paths
> all over the place (by design), so all output file paths etc. are hardcoded
> in the .sln and .vc[x]proj files to the paths applicable where they were
> generated. You can experiment with the variable CMAKE_USE_RELATIVE_PATHS,
> but even its documentation warns that it's unreliable.

Well, my quick test suggests that CMAKE_USE_RELATIVE_PATHS is fairly
good, but since the documentation is worded that way there are
probably corner cases that I don't hit :)

However, one thing that I didn't notice before is that the use of the
CMake executable is deeply embedded in the solution+project
files--`cmake -E` is used very widely for obvious reasons.  Also the
path to the CMake executable is absolute and unaffected by the use of
CMAKE_USE_RELATIVE_PATHS.

I think I'll just have to give up on the idea and dig in my heels in
preparation for the inevitable discussion/complaint when introducing
CMake ;)

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus


More information about the CMake mailing list