简体   繁体   中英

Qt Creator won't open CMake C++ Project in OSX

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.

空Qt Creator窗口甚至不显示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.

在此输入图像描述

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. 构建和运行 - > CMake选项卡显示手动设置为/Applications/CMake.app/Contents/bin/cmake的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). 构建和运行 - >已找到显示CMake和CMake生成器的工具包。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM