Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I build an executable AND a library?
is it possible to build an executable AND a library in one project?
It seems like when I add TEMPLATE = lib to my .pro file it no longer builds an executable.
You need to use the subdir template and create one project for your executable and one for your library.
I will take a look at the subdir template and how to use it.
My question refers to an earlier post of mine "Link":http://qt-project.org/forums/viewthread/31923/#140602
My project is not finished so the executable and the library are changed often and my unittest depend on the library my project generates. So I'm looking for a way to generate an executable and a library at once.
Then subdir is the way to go.
One project for your library with all unit tests within and the other for your application that will use that library. You'll need
@CONFIG += ordered@
to start building your library then your application. It will be done in one go.
Actually it's the other way around.
My unit test project needs to include the library that my other (application) project builds. So my application project needs to build an executable and then the library. That library needs to be included in my unit test project.
Then you're going the wrong way, what you should have is:
- Build the library
- Build the unit test
- Build the application
The unit test building could even be done as part of the library building
And I can realize that with 2 .pro files? And with the use of subdirs?