CMake Server: Reuse existing build directory path when available
Summary:
When the build dir is accessible via multiple (symlinked) paths,
we should reuse whatever the current CMakeCache is using. This
ensures that we don't trigger a needless cache invalidation leading
to a full project rebuild. E.g. I have:
/home/milian/projects/kf5/src/frameworks/kdesu
kdesrc-build will build this in:
/home/milian/projects/kf5/build-dbg/frameworks/kdesu
To enable quick build dir selection by kdevelop, I also
created this symlink:
/home/milian/projects/kf5/build -> /home/milian/projects/kf5/build-dbg
Thus KDevelop is running the cmake server configuration job with
this path instead of the one chosen by kdesrc-build above:
/home/milian/projects/kf5/build/frameworks/kdesu
In the end, this lead to me having to recompile every project after
I ran kdesrc-build and opening the project in kdevelop...
This patch looks up the existing CMAKE_CACHEFILE_DIR variable
and reuses that if available. I.e. now KDevelop will actually use
/home/milian/projects/kf5/build-dbg/frameworks/kdesu automatically,
and I don't need to recompile everything all the time.
Reviewers: KDevelop, rjvbb
Subscribers: kdevelop-devel
Differential Revision: https://phabricator.kde.org/D11921