I am starting to introduce googletests to our multi-library production codebase and I would like some advice on how to organize better my tests.
We have many internal libraries that we compile as a grand library that executables link against. The structure let's say is something like:
├──LIB_A
| ├──CMakeLists.txt
| ├──src/
| └──include/
├──LIB_B
| ├──CMakeLists.txt
| ├──src/
| └──include/
...
├──LIB_Z
| ├──CMakeLists.txt
| ├──src/
| └──include/
└──CMakeLists.txt
The last CMakeLists will add_subdirectory() the libraries and produce the Grand Library.
In this structure I would like to introduce tests. Most tests I am thinking of, are to test each library rather than the whole thing. I have been advised by a colleague that tests should be introduced to the Grand Library level and not inside each library. To make it graphic, what would be best?
A:
├──LIB_A
| ├──CMakeLists.txt
| ├──src/
| ├──include/
| └──tests/
├──LIB_B
| ├──CMakeLists.txt
| ├──src/
| ├──include/
| └──tests/
...
├──LIB_Z
| ├──CMakeLists.txt
| ├──src/
| ├──include/
| └──tests/
└──CMakeLists.txt
OR B:
├──LIB_A
| ├──CMakeLists.txt
| ├──src/
| └──include/
├──LIB_B
| ├──CMakeLists.txt
| ├──src/
| └──include/
...
├──LIB_Z
| ├──CMakeLists.txt
| ├──src/
| └──include/
├──tests/
└──CMakeLists.txt
Both.