[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 13:44:37 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,
    Tobias
  

Tobias,
	I am trying to figure out the difference between the following 2 workflows.

1:
 + From a terminal, configure project with CMake
 + Build project. [ All files are compiled ]
 + rerun CMake on the current build folder.
 + Build project. NO files are rebuilt. Ninja takes about 4 seconds to 4 run.

2:
  + Open QtCreator and "Open Project" by pointing at the Top Level CMakeLists.txt file
  + QtCreator configures the project into a temp directory.
  + Click the "Build Project" Hammer Icon. QtCreator then reconfigures project into the proper build directory and proceeds to build the entire project.
  + Quit QtCreator.
  + Open QtCreator and load the project. QtCreator loads the project by running CMake again on the build directory.
  + Click the Hammer Icon to build the project. A VERY Large portion of the project is rebuilt (1100 files out of 1900 files total).

I can't get this to recreate often. I had it happen on my macOS machine when I was running QtCreator 4.3 a lot. That seems to have settled down but then I had it happen yesterday on my Windows 10, running VS2015 tooling with Ninja as the build system. CMake version on the Windows 10 machine was 3.8.x.

And yes, I do create more than a few header files that are included in many of the files BUT I wrote specific CMake code to generate the header into a temp file, compare that file with any existing file via an MD5 hash and if the contents are different only then is the new header file copied into place. I did this specifically because I was having this same issue with *all* the build systems that I was using.

Is QtCreator doing any kind of file stat or file copy before/during/after the CMake phase? I just can not figure out what is triggering the full builds.

Thanks
Mike Jackson

PS: I like the adjustments to the CMake projects in QtCreator 4.4. Easier to navigate around the project structure.





More information about the Qt-creator mailing list