问题描述
我有一个CMake项目,直到现在,我一直在使用Visual C ++进行开发。
使用CMake-gui生成VC ++的解决方案,它在同一解决方案中生成多个项目。
但是,当将脚本加载到qt-creator中时,仅定义了一个项目,其中包含所有代码和文件夹树,因此我无法编译它(或者我不知道该怎么做)。 / p>
如何加载cmake文件以加载所有项目?
更多信息:
第一个CMakeList.txt具有一些通用配置。然后,使用 add_subdirectory功能,添加一个项目以创建一个库,并添加另一个项目以创建一个使用该库的示例应用程序。
您应该在 add_subdirectory()的帮助下将多个项目添加到根cmake文件中。然后,在Qt Creator中,您应该打开根cmake文件。之后,您可以在选择要运行的工具包(3)或调试(4)应用程序窗格中选择要运行的项目(检查)。
很遗憾,您无法(或我不知道如何)仅构建一个项目。您必须将所有项目都添加到根cmake文件中,然后选择要运行的项目之一。
我使用Qt Creator 4.0。
I have a CMake project, and until now, I was using Visual C++ for developing.
Using CMake-gui to generate a solution for VC++, it generates more than one project in the same solution.But when the script is loaded in qt-creator, only one project is defined, with all the code and folder tree inside, so I can not compile it (or I don't know how to do it).
How can I load the cmake file to load all the projects?
More info:
The first CMakeList.txt has some common configuration. Then, with 'add_subdirectory' function, I add a project to make a library, and another project to make a sample application to use this library.
You should add multiple projects to the root cmake file with help of "add_subdirectory()". Then in Qt Creator you should open the root cmake file. After that you could choose which project to run in the select a kit for running (3) or debugging (4) application pane (check the link).
It sad that you can't (or I don't know how) build only one project. You have to build all projects are added to the root cmake file and then choose which one of them you want to run.
I use Qt Creator 4.0 .
这篇关于如何使用Qt Creator在多个项目中加载cmake脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!