3
votes

I'm trying to work on an open-source project in Qt Creator on OSX. When I open the CMakeLists.txt like other CMake projects in Qt Creator it doesn't open the project. No folders, source files, not even the CMakeList.txt shows up in Qt Creator, just a completely blank project.

Empty Qt Creator Window doesn't even show CMakeLists.txt.

What could cause a project to do this?

Edit: the project opens properly in Ubuntu. It shows the CMakeLists.txt, source files, and everything. It even builds properly when I CMake in the command line on OSX. Qt Creator in OSX just does not open this project properly.

Eit 2: My build settings are completely empty too. There are no General Messages or messages of any kind.

enter image description here

1
Did you get an error during generation? CMake does create empty solutions/IDE projects when something goes wrong during (re-)building the project. Check again from command line, I suspect some syntax problem in your CMakeLists.txt file.Florian
When I run CMake in Creator nothing happens. When I run CMake in the command line the project builds with a few minor errors that don't even stop the build.Daniel Arnett
What version of Qt Creator are you using? Can you confirm in Qt Creator's settings whether it is using the cmake executable you expect it to (look in the Build & Run section)? Also show the General Messages output pane (click the up-down icon in the status bar at the bottom of the window to get a context menu allow you to show it) and check for any helpful messages there.Craig Scott
See Edit 2, Nothing in build settings.Daniel Arnett

1 Answers

4
votes

Open your Preferences (Cmd+, on Mac) and go to the Build & Run and then CMake tab, do you see any CMake version listed there? For me, I have to add a manual entry because it doesn't automatically find my CMake. My manual entry is set to /Applications/CMake.app/Contents/bin/cmake so compare that with what you have in your settings. Build & Run -> CMake tab showing the CMake path manually set to /Applications/CMake.app/Contents/bin/cmake Then restart Qt Creator and reopen your project. Go to Build & Run again and make sure the Kit you have selected for your project has a CMake Tool set (should be automatic if you have just the one CMake entry listed on the CMake tab). Build & Run -> Kits showing CMake and the CMake generator have been found.

Background Information

It looks like you are using Qt Creator 4.0. With that version, they changed a number of things related to how CMake projects are handled. When you first open a project, it won't create the build directory if it doesn't exist. Instead, it will run CMake in a temporary directory. This would be shown in the General Messages output pane if you had it open. Once you manually create the output directory as it appears in your project's Build Settings, Qt Creator will switch to running CMake in there instead. There's no indication this is happening apart from what is logged in the General Messages output pane, even if there's a problem with your CMakeLists.txt.

In your case, if there's genuinely nothing appearing in your General Messages output pane and CMake is working fine from the command line, that suggests something may be wrong with your Qt Creator settings.