A single project that builds multiple executables
-
wrote 18 days ago last edited by
Hello. I'm new to this so forgive any errors in terminology.
So I have two Qt projects, one project that builds as server, and one project that builds a client.
Until now I've been using "Build all projects"But after some changes I see that the two projects share a few C++ classes.
Can I in some way merge these two projects into one project that builds both the server and the client.
The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?
So, how can I accomplish this?
I use CMake -
Simply use a second add_executable()
-
Simply use a second add_executable()
wrote 17 days ago last edited by@Christian-Ehrlicher
Thanks, I'll have a go and see if I can figure that out. -
Hello. I'm new to this so forgive any errors in terminology.
So I have two Qt projects, one project that builds as server, and one project that builds a client.
Until now I've been using "Build all projects"But after some changes I see that the two projects share a few C++ classes.
Can I in some way merge these two projects into one project that builds both the server and the client.
The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?
So, how can I accomplish this?
I use CMakewrote 15 days ago last edited by@Noobish said in A single project that builds multiple executables:
The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?
Put common code into a library (which would be yet another project) and link against this library for these two executables.
Or, like @Christian-Ehrlicher said, combine all projects into one. Even then, it would make sense to have one library and two executables as build targets.
4/4