Ok, thatβs what I found. The idea is to use CMakeCache.txt, which is in the source tree. We go up, looking for a cache file. After detection, we retrieve the source directory, which is stored in CMAKE_HOME_DIRECTORY varible.
function cdoos2src () { path=$(pwd) while [[ $path != "/" ]]; do if [[ -f $path/CMakeCache.txt ]]; then break; fi
source share