Partial build, even for a single top-level target?

Hi!
I really like how modern CMake allows adding sources to a top-level target, from within a subdirectory. Before this, (I think) I needed to have per-subdirectory library targets defined, to have subdir CMakeLists.txt for a top-level executable.

However, now I’m missing the advantage, especially for very large projects, of being able to compile the sources for a subdirectory only (useful e.g. when working on a widely used header): running make in the (binary) subdirectory doesn’t trigger any compiles at all.

How can I trigger rebuilding sources within a subdir only, even when I have a single top-level target?
Thanks

ps: working on Linux, have tried this with makefile and ninja targets

Only the Makefiles targets supported this before (though maybe the Ninja generator has it now?). But these are tied to where the add_subdirectory happens and targets are “anchored” to the directory where they are defined. If you want something in between, I suggest OBJECT libraries.