I have an existing Qt Creator project which is not a Subdirs project. I have now reached a point where I want to add a unit test project to it. When I create the new unit test project, the "Add as a subproject to..." combo is disabled.
How can I do it? I'm thinking about creating a brand new Subdirs project and adding my existing project to it, and then adding the unit test project as well.
Is that how it should be done or is there a better way?
It's not a problem to change the project type to a subdir project (even for a gui app). That's the only way to add a unit test sub project to it. Steps:
As mentioned, make your project a subdir project:
TEMPLATE = subdirs
SUBDIRS = gui logic
Select File > New file or project ... > Other Project > Qt Unit Test
Your .pro file will be updated as follows:
SUBDIRS = gui logic tests
Note: If you're manually restructuring the project hierarchy, make sure the name of the sub directory matches the name of .pro file within that sub directory.
For example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With