Creating a library split into multiple sub-modules

I’m trying to create a huge library and have decided to modularize that project by developing it component by component so that I can easily test and develop each component separately.
But in the end all these components need to be compiled into one single library.
So my root CMakeLists.txt has a couple of add_subdirectory() calls.
Each sub-component is compiled as a STATIC lib.

My challenge now is how do I make the root CMakeLists.txt compile everything into one single lib.

How do I call add_library() in such a case?

One option would be to create two CMake targets for each of the submodules: an OBJECT library which will contain the actual source files, settings, etc.; and a STATIC library which will only link the object library and be used for tests etc.

Then, in the root file, you can link all the object libraries into your final huge library.