Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add CMake project as subproject in CMake project in Qt Creator

I have a directory layout like the following

projectA/
|-- CMakeLists.txt
|-- src/
    |-- main.cpp
projectB/
|-- CMakeLists.txt
|-- src/
    |-- file1.cpp
    |-- file1.hpp
    |-- file2.hpp
    |-- main.cpp
|-- third_party/
    |-- include
        |-- lib1

I opened both project successfully in Qt Creator (using Ctrl+O and open the CMakeLists.txt file) and they're are able to build and run independently.

I need to gain access to file1.Xpp and file2.hpp from projectA. Is there a way in Qt Creator to add projectB as a subproject in projectA? And One might keep in mind that file1.Xpp and file2.hpp might depend on the third party library.

Using Ctrl+N -> Other Project -> Subdirs Project I can add a subproject, but only an empty one, if I'm not mistaken.

like image 567
SemtexB Avatar asked Jun 19 '17 15:06

SemtexB


People also ask

Does Qt Creator support CMake?

You can use CMake from Qt Creator to build applications for the desktop, as well as mobile and embedded devices. You can also build single files to test your changes. Qt Creator automatically detects the CMake executable specified in the PATH .

Should I use qmake or CMake?

Both are build systems, but they're not very similar at all. If your project uses Qt, you're probably best off using qmake. CMake is more generic, and fits pretty much any type of project. Both qmake and CMake generate a Makefile, which is read by make to build the project.


1 Answers

No, you can't add a CMake subject as a sub project.

Sub project is based of qmake.

like image 133
Creepercdn Avatar answered Oct 17 '22 02:10

Creepercdn