[Qt-creator] Generating QtCreator cmake project for given CMakeLists.txt from command line

Tobias Hunger Tobias.Hunger at qt.io
Fri Jun 3 10:26:38 CEST 2016


On Fr, 2016-06-03 at 07:40 +0000, Tobias Hunger wrote:
> On Do, 2016-06-02 at 18:07 +0200, René J.V. Bertin wrote:
> > Hi,
> > 
> > Reviving an older thread after, well to honest, not having had a reason to
> > use
> > Creator for a while ...
> > 
> > So I updated to git/master, and discover that it's become even more
> > complicated to import a CMake-based project for which you already have a
> > (lengthy) cmake command line. Have I missed a place to input the commandline
> > "as is" during the import procedure, or does one really have to cut it up
> > and
> > create the entries one by one through a WYSIAYG interface?
> 
> So for there is no import procedure yet:-(

With "import procedure" I mean a way to generate a kit in Qt Creator base on the
settings found in your cmake build directory (e.g. one with the right cmake tool
configured, the right generator, Qt, toolchain, etc. all set up ready to go).

Why is it now important to have a properly configured kit?

What is new in Qt Creator 4.0 is that creator settings actually are passed on to
CMake. So your kit configuration now effects the CMake calls creator does! This
is basically what most users expect (at least I had lots of bug reports that
changing the Qt version in a kit did not effect the cmake builds in any way,
etc.), and it also makes sure that the code model and the compiler have a
similar view of your project.

In general Creator will simply call cmake without passing any parameters that
will effect configuration.



Creator may *change your cmake configuration* of your build directory, when it
detects minor mismatches between what is configured in Creator and what is used
to build the code.

E.g. if creator detects you use a compiler that does not match what you
configured in Tools>Options>Build & Run>Kits>CMake Configuration, then it will
run cmake passing the options from there plus any change you did to the project
cmake configuration. If you want to avoid this: Clear the CMake Configuration
settings of the kit.

It will also pass all the cmake configuration items configured in Creator when
the build environment changes (which might effect e.g. compilers to be picked
up), or the build directory changes.



Creator will *wipe* your CMake configuration completely and start over with the
settings configured inside Creator if it thinks the build directory has a
fundamentally different setup than what is configured in the kit. The occassions
where it does this are:

* When you used a cmake binary to set up the build directory that is not the one
configured in your kit.
* When you used a generator to set up that build directory that is different
from the one configured in your kit.
* When you "Clear CMake Configuration" from the Build menu.

If Creator does something else, then that needs fixing:-)

Best Regards,
Tobias

-- 
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B


More information about the Qt-creator mailing list