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

René J.V. Bertin rjvbertin at gmail.com
Fri Jun 3 10:39:55 CEST 2016


On Friday June 03 2016 07:40:50 Tobias Hunger wrote:

>Even if there was: I doubt Creator will figure out which values were previously
>set on the command line and which where generated by the build system on the
>fly. I just do not see any way to get that information from cmake. So that
>information will need to be supplied by the user somehow as part of the import.

Yes, true. I'm not sure how necessary it is, but as long as CMake itself doesn't store its exact commandline in the CMakeCache header it will be required to let the user provide that information.

I recall that's exactly what we could do a couple of releases ago: there was a text input field in the cmake configuration dialog during the open procedure. The only issue at the time was that the commandline was not saved anywhere.

It shouldn't be hard to bring that back - *with* the saving. I think the things are complementary, and I don't really see why you'd call that a batch input. There is no real need to specify variable types on the cmake commandline, as cmake itself is quite capable of figuring those out (at least I don't have any counter-examples). It's not even required for adding things to CMakeCache, but there it cannot hurt either.
What I see is this:
- add variables to CMakeCache, potentially re-run cmake *without* arguments to refresh the build directory
- use the full user commandline for "warm reset" which will restore the CMakeCache file to its initial state. This would possibly include removing that cache file first.

That "warm reset" mode with removal of the cache could then be used when the user requests running cmake explicitly, or for instance when there are changes to the environment variables. I discovered the need for that the hard way yesterday, when after hours of debugging why something didn't work. I finally realised that my CMakeCache had apparently been generated without the proper preprocessor tokens defined through CFLAGS and CXXFLAGS, which thus had never made it into my Makefiles despite the fact cmake had been rerun using that initial CMakeCache.

Cheers,
R.



More information about the Qt-creator mailing list