[Qt-creator] importing "foreign" cmake projects remains problematic

Tobias Hunger tobias.hunger at gmail.com
Tue Jun 20 10:57:31 CEST 2017


Hi René,

sorry, this somehow ended up in my spam folder and I only noticed your
mail just now.

On Sat, Jun 10, 2017 at 12:54 PM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> To make another (more succinct) case for having a way to configure a cmake configuration step:
>
> - there are moments in the lifetime of a project you're working on where you need to reset the build. Sometimes that means discarding the whole build directory, sometimes you only need to discard the CMakeCache.txt file, and sometimes it's proven to be a good compromise to discard "CMake*" in the build.dir toplevel.

Build > Clear CMake Configuration nukes your CMakeCache.txt file.

It does auto-set the configuration you have made via creator, so that
you do not have to start from scratch. Maybe that is not what you
want?

> - consider a project that can be built for Mac, MSWindows, X11 and why not Wayland, each with their own set of included source files and possibly build targets. In an IDE like KDevelop you can simply add a new build directory to the project and configure all aspects of the details cmake invocation - aspects which will be saved and used each time cmake needs to be run.

You can set the generator and all the related things via the kit. I
think that is the place where that makes the most sense.

You can set generic settings you want for all projects, also via the kit.

Once that has gone through you have a UI to configure the project in
more details.

What is missing?

> In both cases I'd typically want to be able to get the project layout displayed appropriately in the IDE before I run a build. IOW, Creator's feature where you launch the build via `cmake --build <here> --target <foo>` is not exactly what I'd expect even if it probably does the job (just kill the build when it starts, right?).

cmake --build . --target <foo> is how cmake says you should build
cmake projects. Why do you think using that is a problem?

It will do the right thing for all generators, so following what cmake
says you should do as a developer makes creator work with all possible
generator and spares it from hard-coding a mapping of cmake generators
and actual build commands to call.

> I've managed to support "server" mode via my cmake2port wrapper. With that I indeed get the entire project in view, including files generated in the build.dir. But there appears to be no way to specify the usual -DCMAKE_FOO arguments in that mode so I'm a bit suspicious of the whole thing.

Everything you set in the kit configuration or in the project
configuration will be set in server mode. No worry:-)

Best Regards,
Tobias



More information about the Qt-creator mailing list