[Qt-creator] Have Locate... provide all files in a CMake project

Michael Jackson imikejackson at gmail.com
Fri Jan 9 17:18:02 CET 2015


On Jan 9, 2015, at 10:30 AM, Andreas Pakulat <apaku at gmx.de> wrote:

> Hi,
> 
> On Fri, Jan 9, 2015 at 1:38 PM, Ziller Eike <Eike.Ziller at theqtcompany.com> wrote:
> 
> > On Jan 9, 2015, at 12:57 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> >
> > I'm working with qtcreator on a cmake-based project that has plenty of conditionally-included source files in the CMakeLists.txt. That is various files are only included when building on mac or win32. Hence these files do not end up in the generated codeblocks project file.
> >
> > It seems QtCreator bases its 'files in project' locator solely on this list of files from the codeblocks file and I'm wondering wether there's an easy way to make it consider all files that are part of the git repository or at least all files in directories it has in the projects tree.
> >
> > Even though I don't want to and cannot edit these files since I cannot compile them I regularly read them to check certain things and having to switch to another machine just for that would be quite annoying. Similarly annoying is to have to use the normal file-open dialog to open these after having opened another file in that directory and that does not work at all if a whole subdir is disabled on my platform in cmake.
> 
> Since we do not parse the cmake files ourselves, Qt Creator only knows about the files in the project that are used by the configuration that you use to run cmake to generate the codeblocks project file.
> 
> Please note that the base directory for the “Files in File System (f)” locator filter is the directory of the current editor. That is something that I use very often.
> 
> You can also create your own filter that provides all files from some directory tree(s)
> http://doc.qt.io/qtcreator/creator-editor-locator.html#creating-locator-filters
> though these use a static list of directories and are saved globally. (Possibly it would make sense to have them optionally saved in the session instead.)
> 
> A filter that provides access to all included files from all C++ files in your projects, even if they are not listed in any project, is also in the works
> (https://codereview.qt-project.org/101408) but that will not solve your problem for files that belong to a different configuration.
> 
> Yeah, I'm using the fact that Ctrl+O uses the editor's directory as base as well. So thats my workaround for now for files in a directory thats known to cmake already.
> 
> It would be nice if the 'Projects' view data model had a switch to either consider all vcs-known files in addition to what the projects buildsystem provided (like the generic-project setup) or a mode where it considers everything in the projects directory to be part of the project. I can see how the latter would be an issue for projects building in-source or using special subdirs for their build output, so it would have to be optional I guess.
> 
> Maybe I should check with the cmake list wether there are ways to customize what ends up in the codeblocks file without having to try to build those sources similar to how the VS-generator provides some special things to configure the look of the project in the IDE.
> 
> It seems having a custom filter for the project directory could work, though refreshing it is a little cumbersome (would be nice if that would be hooked up with filesystem-watcher).
> 
> Either way, thanks for confirming that I didn't just overlook something obvious.
> 
> Andreas
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

So I use the "File System View" on the left side to get at files that are not part of the project but are located in my project. Things like .rc, images, CMake files (*.cmake) and some other misc files and I find that is a good workaround for NOT having them just show up in the Project. Eclipse has 2 views for projects. One is the traditional "project" view that only considers the files that the project knows about. The other view is the true "File System" view which is just a tree starting at the level of the Project Root Directory and shows EVERY file no matter what. I think this works really well and is close to the "File System" view that already exists in Creator.


Also, I think part of QtCreator's problems with CMake files is that QtCreator only considers the top level code blocks file that is generated. There are other code block files within the build tree that fully describe all the files for a project, include paths, compiler invocations and things like that. This is leading to other problems with include paths not being found (See bug reports).

Just my 2 Cents
Mike Jackson


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150109/f948caff/attachment.html>


More information about the Qt-creator mailing list