How to link static libraries together

Hi everyone,
another basic question on windows.
suppose I have 3 directories, say x, y, z under root.
Basically, I want libx and liby to be linked into libz - here is how I do it:
Directories x and y are similar with respectively x and y names - CMakeLists.txt:

add_library(libx STATIC x.cpp)

In directory z we have - CMakeLists.txt:
add_subdirectory(…/x …/x)
add_subdirectory(…/y …/y)
add_library(libz STATIC z.cpp)
target_link_libraries(libz libx liby)

For some reasons lib z is not linked with libx and liby: here is the librarian command executed:

lib.exe /OUT:z.lib /NOLOGO z.cpp

Is there a recommended way to achieve the wanted result?
Thanks,
Serge

Correction in my message. The librarian instruction is:

lib.exe /OUT:z.lib /NOLOGO z.obj

CMake does not have an abstraction for copying static libraries into others when linking. So no, that is not possible with CMake abstractions today. There are, however, others interested in this behavior. I can’t seem to find an issue for it, but there has also been other discussion on Discourse about it.

You can achieve something similar by using OBJECT libraries for libraries in sub-directories.

This is true unless one of the library uses custom rules to generate the object files - for example, complicate assemby rules.

$<TARGET_OBJECTS:libx> will not have the list of object files and
target_link_library(libz $<TARGET_OBJECTS:libx>…) will miss those object files from libx.