[Qt-creator] QtCreator 4.3/4.4 + CMake likes to "rebuild" my project, a lot.

Michael Jackson mike.jackson at bluequartz.net
Thu Sep 28 14:42:26 CEST 2017

-----Original Message-----
From: Tobias Hunger <tobias.hunger at gmail.com>
Date: Wednesday, September 27, 2017 at 6:11 PM
To: Michael Jackson <mike.jackson at bluequartz.net>
Cc: qt-creator <qt-creator at qt-project.org>
Subject: Re: [Qt-creator] QtCreator 4.3/4.4 + CMake likes to "rebuild" my project, a lot.

    Hi Michael,
    On Wed, Sep 27, 2017 at 3:58 PM, Michael Jackson
    <mike.jackson at bluequartz.net> wrote:
    > I have seen this problem more than a few times and with a 45 minute build time for our project it is starting to get in the way. Our project is CMake based (I am using CMake 3.8 or 3.9 depending on the particular workstation that I am using at the time) and also uses Qt 5.9.1 64 bit. All the code is C++. What will happen is that I load the project, QtCreator properly configures for the build (Debug) and I build the project successfully. I quit QtCreator. Relaunch QtCreator and when I click Debug for our application QtCreator will pretty much rebuild the entire project. NOTHING changed between when I last built, quit QtCreator and relaunched QtCreator. I use ninja as the build tool.
    When you open the project, then cmake will go through the
    configure/generate steps again. Is that what you are referring to?
    That is how cmake wants this to be handled, so there is nothing I can
    do there.
    Or does the actual build rebuild huge parts of the project? That could
    be triggered by cmake configur/generate mentioned above: Do you create
    some central header file or something from cmake? That would be a bug
    that I'd need to file with upstream cmake:-/
    Best Regards,

  Figured it out! When you change versions of CMake in the "Kits" QtCreator will re-run CMake with that changed version BUT it looks like QtCreator deletes the current CMakeCache.txt file and completely starts over which will basically force a mostly clean build. If I change versions of CMake on the command line the current CMakeCache.txt file is used and I don't get the "rebuild" issue.

So is there an explicit piece of code in QtCreator that deletes the CMakeCache.txt when the version of CMake is changed in the Kits? Is this the recommended thing to do from the CMake Devs?

Mike Jackson

More information about the Qt-creator mailing list