Version: 4.1.0 (using KDE 4.5.3) OS: Linux In CMake-based project, If source files is out of build tree, it not shown in project files tree. Reproducible: Always Steps to Reproduce: Place files out of project directory. Define it in CMakeLists.txt. Actual Results: Source files is not shown Expected Results: Must be shown My CMakeLists.txt: cmake_minimum_required(VERSION 2.6) PROJECT(test) FILE(GLOB_RECURSE SOURCES "../../../../sources/test/src/*.cpp" ) INCLUDE_DIRECTORIES( ../../../../sources/test/include )
commit bfd6423e29fb775146b92532d133fc4418ea5022 branch 4.1 Author: Aleix Pol <aleixpol@kde.org> Date: Wed Dec 8 00:18:15 2010 +0100 Properly add relative globs. BUG: 259099 CCBUG: 259135 diff --git a/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp b/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp index 75a8299..c8f0616 100644 --- a/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp +++ b/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp @@ -1418,26 +1418,38 @@ int CMakeProjectVisitor::visit(const FileAst *file) break; case FileAst::Glob: { QStringList matches; - QString relative=file->path(); + QString currentPath=m_vars->value("CMAKE_CURRENT_SOURCE_DIR").first(); + QString relativeto=file->path(); + if(!relativeto.isEmpty()) { + if(KUrl::isRelativeUrl(relativeto)) + currentPath += '/'+relativeto; + else + currentPath = relativeto; + } + foreach(const QString& glob, file->globbingExpressions()) { QStringList globs; - QString current; - if(KUrl::isRelativeUrl(glob)) { - KUrl urlGlob(glob); - current=urlGlob.upUrl().path(); + QString current(currentPath); + int lastSlash = glob.lastIndexOf('/'); + + if(lastSlash>=0) { + QString path = glob.left(lastSlash); + if(KUrl::isRelativeUrl(glob)) + current+='/'+path; + else + current = path; - globs.append(urlGlob.fileName()); - } else if(!relative.isEmpty()) { - current=relative; - globs.append(glob); + globs.append(glob.right(glob.size()-lastSlash-1)); } else { - current=m_vars->value("CMAKE_CURRENT_SOURCE_DIR").first(); globs.append(glob); } QDir d(current); - matches+=d.entryList(globs, QDir::NoDotAndDotDot | QDir::AllEntries); + QStringList matching=d.entryList(globs, QDir::NoDotAndDotDot | QDir::AllEntries); + + foreach(const QString& match, matching) + matches += d.absoluteFilePath(match); } m_vars->insert(file->variable(), matches); kDebug(9042) << "file glob" << file->path() << file->globbingExpressions() << matches;
Bug is not fixed, due to incorrect/incomplete parse of GLOB and GLOB_RECURSE
This patch fix problem completely http://git.reviewboard.kde.org/r/100283/
This was fixed by the revewboard patch. Closing the bug.