My C++ project is growing larger. We are also moving to using cmake for building now. I want to divide the application into libraries so that they can be linked for testing, preparing the application package, etc. Right now I would divide my code into libraries as follows:
- core
- GUI
- utilities (these are used by core and other components)
- io (xml parsing/outputing using print functions of classes in core)
- tests (unit tests)
- simulator (tests the core)
An alternative would be to divide based on the directory structure - one library for each directory. But from my past experience it leads to too many libraries and then library dependencies become tough to handle during linking.
Are there any best practices in this regard?