CMake mulitple build projects in single tree

we use several git repos and our build system is cmake. We have several libraries with unit tests (seperate executables) and several applications (release) that we are going to build. In the moment we solve this by having multiple workspaces and a proper Top-Level CMakeLists.txt for the purpose of the current workspace (e.g. test of library A, test of library B, release for application X)

Now we would like to use a single tree (iso multiple workspaces) that includes all libraries, test code and applications, which means we are able to build everything from single tree.

In principle the core problem here is that we need to "merge" our multiple existing Top-Level-CMakeLists into this single tree. This seems on first view rather easy, but the problem starts at the point that we want to build libraries with different flavours based on the same tree (e.g. using different compile flags, linker flags).

I will make a simplfiied example with a common cmake tree:

tree/
CMakeLists.txt
libA/
    CMakeLists.txt
libB/
    CMakeLists.txt
AppA/
    CMakeLists.txt
AppB/
    CMakeLists.txt

So lets say, my both applications are using libA, libB - but in case of AppA I would like to use different flags than in AppB. Somehow I need to tell CMake to compile libA twice and to associate the right version of libA to my corresponding App.

Any ideas or is it in general not possible to have multiple projects in a single tree with CMake?