D7930: Kdevelop CMake plugin : use canonical paths to build.dir
René J.V. Bertin
noreply at phabricator.kde.org
Fri Sep 22 01:08:01 UTC 2017
rjvbb updated this revision to Diff 19767.
rjvbb added a comment.
It wasn't clear if you wanted to add a method to CMake or to KDevelop::Path so I went with the former which I find gives more readable code.
Why is this needed? Did you read the commit message of Milian's commit I referenced?
Take a working dir that's somewhere hidden behind a long access path (like what Linux will give to auto-mounted external drives), let's assume that you're using an out-of-source build approach where the source dir and the build dir live under a same parent. (Not crucial for the argument but I just work that way.)
You do the initial cmake run using the actual path, and then at some point you get tired of typing the long path so you create a symlink from a regular work directory under your $HOME to that working dir on the external.
KDevelop's build tree will contain auto-generated files that include headerfiles with paths like ../../../kdevelop-source/kdevplatform/interfaces which are representative for the actual locations on disk. Accessing that build directory via `(cd link-to-work/build ; make)` will lead to all kinds of failures if make (and thus potentially cmake) finds itself executing under `/home/joe/work/coding/link-to-work/build` instead of something like `/media/joe/JoesExternal/coding/KDE/KDevelop/build`. Headerfiles expected under relative paths may not longer be found.
It's taken me a few days to realise why I kept getting those non-canonical shortcut paths in my compile commands after I rewrote my wrapper scripts to use canonical paths
There's another argument why this is a good idea: cross-platform consistency. On Mac it's impossible to avoid path normalisation and there may be other platforms where this is true too.
CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D7930?vs=19763&id=19767
REVISION DETAIL
https://phabricator.kde.org/D7930
AFFECTED FILES
plugins/cmake/cmakecommitchangesjob.cpp
plugins/cmake/cmakeimportjsonjob.cpp
plugins/cmake/cmakemanager.cpp
plugins/cmake/cmakemodelitems.cpp
plugins/cmake/cmakeserverimportjob.cpp
plugins/cmake/cmakeutils.cpp
plugins/cmake/cmakeutils.h
plugins/cmake/settings/cmakepreferences.cpp
To: rjvbb, #kdevelop, apol
Cc: apol, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170922/b2b045cf/attachment.html>
More information about the KDevelop-devel
mailing list