问题
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.
回答1:
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 .
回答2:
Here is the offical doc http://qt-project.org/doc/qtcreator-2.8/creator-project-cmake.html My project have a similar structure, just open the top-most CMakeLists.txt file of the project, and qtcreator will import your project.
来源:https://stackoverflow.com/questions/19466141/how-to-load-cmake-script-with-more-than-one-project-with-qt-creator