Is there no way to load a project into CMake GUI?

Hi all. Just getting started with CMake (in Qt 5).

I was happy to discover that there’s an official GUI for CMake, but disappointed to find that there’s no apparent way to load a CMakeLists.txt file into it. Is that true?

Thanks!

The cmake-gui program is a “cache editor” and allows you to edit build options for a project. You can load a directory containing a CMakeLists.txt into the Where is the source code box and then select where you want the build tree to go in the Where to build the binaries box.

Thanks. I did point the GUI to an existing directory containing a CMakeLists.txt file, but I didn’t see the GUI populated with any of the settings or information from that file. Is this supposed to occur?

You’ll need to “Configure” the project before CMake will actually read the file. Since this involves writing out to the binary directory even in the simplest case, you’ll need to set a binary directory first.

Thanks. This is a Qt project, so you don’t run Configure manually. But its “run CMake” menu item might do that.

What file is it trying to read, then?

What do you mean “you don’t run Configure manually”? Without that, CMake reads basically nothing (other than the directory listings maybe to determine if the required files exist).

I don’t know. You select the “Run CMake” option in Qt Creator, which does not create makefiles, at least not in the source directory where CMake would normally. I don’t know where it squirrels things away. It also defaults to its own build-products directory, derived from I don’t know what. If you copy a project, you’ll find it builds into the original project’s location and I could find no place that this was specified.

Sorry, I’m not familiar enough with Qt Creator to know what to say there. Maybe others would have some input here.

These are really QtCreator questions for the QtCreator email list but here are some general answers:

QtCreator will initially configure your project into some temp directory somewhere. When you actually decide to build your project then a build directory will be created and the build products placed in there.

You can set your build directory on a per project or globally through QtCreator’s preferences.

You can tell QtCreator what to use for the “Generator”. I personally use ninja instead of Makefiles.

Tell QtCreator you want to “Open A Project”, point it to your Top level CMakeLists.txt directory. QtCreator will then do a “test” configure where it puts stuff down in some “temp” directory. If the configure works then hit the “build” button and compile your project.

If you need to specify various CMake arguments you can do that through the project settings.

Thanks to both of you for the replies, and the QtCreator insights. I’ll take further questions to the Qt forum.