Workaround cmake server bug that gets confused on symlinks

Authored by mwolff on Mar 22 2017, 2:43 PM.

Description

Workaround cmake server bug that gets confused on symlinks

When we open a symlinked project with a pre-existing build directory,
we could end up with an error:

Failed to activate protocol version: "CMAKE_HOME_DIRECTORY" is set but
incompatible with configured source directory value.

This happens, when the build directory uses a non-canonicalized
version of the path, while KDevelop passes the canonical path. These
then trigger the mismatch since CMake is not smart enough to check
for symlinks (cf. https://gitlab.kitware.com/cmake/cmake/issues/16736)

This patch now checks whether a pre-existing CMAKE_HOME_DIRECTORY
value can be obtained from the cache. If so, that value is used in
preference of the source directory.

When the two values actual mismatch for real, we now simply emit a
warning and continue to open the existing build directory as-is.
This can lead to issues further down the road. I suggest we add
better error handling to the cmake server mode, most notably users
must be notified when something breaks. So far, we only see something
on the command line, which may not be obvious enough for newcomers.

Details

Committed
mwolffMar 22 2017, 2:43 PM
Parents
R32:e1500e1f382e: Use canonical paths for file-specific information from cmake server
Branches
Unknown
Tags
Unknown