[Qt-creator] Refactoring the CMake plugin

Ziller Eike Eike.Ziller at digia.com
Fri Jun 20 10:27:38 CEST 2014


On Jun 20, 2014, at 10:10 AM, Hunger Tobias <Tobias.Hunger at digia.com> wrote:

> On 19.06.2014 23:29, Benjamin Zeller wrote:
>> Am 19.06.2014 00:13, schrieb Miller Henry:
>>> On question 3:
>>> 
>>> When switching project configurations, if the build is at all out of date the first thing I'm going to do is re-run make anyway.   The only other option that makes sense it to completely blow away the build directory and re-run cmake.  I would go so far as making it an option to just run a full build anytime I switch my build configuration (default to true as it is what the user wants even though it violates some purists expectation that no files will be written).  I find it very annoying to have this cmake dialog pop up when I open an out of date build, as I'm just going to hit run and wait for it to complete.  So long as no build option is being changed, I want qt creator to write the files it needs and not bother me.
>> Thats almost what my current patch is doing, it runs cmake in the
>> background when you change
>> configurations, always,  without popping up the dialog.
>> If you want to change arguments you can do so in the build settings.
>> CMake will then
>> be run automatically in the background when you leave the lineedit you
>> changed your settings in.
>> However this does create files without notice which is really a problem
>> when for example you change
>> the builddir many times, you might end up with n buildfolders on your
>> harddisk.
> 
> You could only run cmake if the builddir already exists and have the 
> user go through the run cmake dialog otherwise.

It must exist and already “be a cmake build directory”, at least. But even that might not be sufficient. All this only works if the user currently pretty much knows the correct build dir s/he wants to set, before fiddling around with the build directory setting. Situations where files could be generated at places where they shouldn’t:
* User temporarily sets the value to an existing directory (like a common project root), and then uses the browse button or an external file browser to actually find out the right subdirectory. In that case the directory exists, but Qt Creator should not put any files there
* User copies the path from an existing project into the line edit, to later change it from there to the correct one. In this case the directory exists and actually might *be* a “cmake build directory”, just for a different project. No files should be generated.

In both cases it is perfectly valid for the user to “leave the line edit” before correcting the setting to its actual value.

Br, Eike

>> I think it would probably be possible to run cmake automatically when
>> you finished editing a cmake
>> file, because in that case you did not change any builddir settings. You
>> can again say that there might
>> be cases when new files are created on the harddisk, but only in the
>> builddirectory you specified anyway
>> so I think that should be acceptable, right?
> 
> I think so, yes. I am not the maintainer though:-)
> 
> My personal opinion is that the builddir is property of the build system 
> and it is basically free to do in there what it wants. Creator just 
> should not add random directories (build directories and of course 
> others as well) without being very explicit about it doing that.
> 
>>> Now if the cmake dialog acted more like ccmake and let me change cached options that might be useful: the only thing valid to do from the cmake dialog in an existing build directory is change options that ccmake could change for you, but since I only have access to the command line of cmake this isn't convenient. I'm not sure if the cmake cache files are in a stable format where it would be valid for qt creator to do this, but it would be ideal.
>> Hm i wonder if cmake has some embeddable tool we could use for that.
>>> 
>>> One annoyance I have is once in a while an automated build fails, when I open qt creator it tries to run cmake, which fails because of a syntax error.  There is no easy way to open the offending file in qt creator so I can fix the error(s).   If you can do something about this I'd be grateful.  At least I'd like it if an outdated project configuration could be used because that will have 95% of what I need.
>> Also almost what the patch does, but what will not work of course is
>> when you open the project for the
>> first time and the project file is invalid, then you will only see the
>> "root" project file.
>> Once the project is open it will not remove the files from the tree when
>> you somehow change your
>> project file and add a error to it.
> 
> Ideally a cmake error would be listed as a build issue, so that you can 
> get to the right file/line from there. That is independent of whether 
> the file is actually in the project tree already.
> 
> Best Regards,
> Tobias
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Senior Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 144331 B 




More information about the Qt-creator mailing list