Check for an existing out-of-source build dir
Review Request #128012 - Created May 25, 2016 and discarded
|René J.V. Bertin|
When importing a new project, check if it already has a pre-existing out-of-source build directory, and propose that as the build directory in
This is comparable to proposing to put the build folder alongside an existing
srcdirectory (but has priority over that rule).
Builds and behaves as expected.
|I feel really bad with this... Yes - it's powerful, but it's also overkill, no? Who would ever write such ...||Milian Wolff|
In case it's not unusual to store development directories directly in a directory called
proposedBuildDir()could have an optional argument representing a file to check for in the out-of-source build directory (e.g. CMakeCache.txt for CMake projects).
This implements an additional idea inspired by Tomaz Canabrava's contribution on kdevelop-devel.
KDevelop::proposedBuildFolder()now begins by checking if a helper utility with the name
kdevelop-custom-build-direxists in the path. If it does, it uses QProcess to call that utility with the
sourceFolderas its (for now) sole argument. When the helper terminates successfully and returns a non-empty string, this string is returned if it is indeed an existing directory.
This works for me with a helper like this:#!/bin/sh if [ -r $1/CMakeLists.txt ] ;then cd $1 if [ -d ../build -a -r ../build/CMakeCache.txt ] ;then cd ../build echo `pwd` exit fi fi echo `pwd`
Tomaz should be able to write something barely more complicated to return
/path/to/builds/foofor a source directory
I've left in the original check for an existing o-o-s build dir but that's more out of personal convenience.
Revision 2 (+25)