Hot to make add_subdirectory() prevent install but still build as part of ALL

The “common wisdom” to prevent add_subdirectory() from running install() rules from inside it is to use add_subdirectory(dir EXCLUDE_FROM_ALL). This works fine, except it also removes all targets from building as part of ALL (naturally), except when they are explicitly referenced.

We have sub-projects, added with add_subdirectory() and want to prevent install() rules from running in them, but we have to build the targets explicitly, because some are executables and modules (so not referenced anywhere), and install them in a custom way in the parent project. The trick we use is to create a dummy custom target part of ALL and make it depend on the subdir targets:

add_subdirectory(subproj EXCLUDE_FROM_ALL) # targets: subproj.target1, subproj.target2, etc.
add_custom_target(do_build_subproj ALL)
add_dependencies(do_build_subproj subproj.target1 subproj.target2)

Needless to say this is not ideal and just smells bad.
Is there any easier way to make this happen?
If not, would it make sense to make a feature request to support this use-case?

EDIT:
Well one other way to do it would be to set the EXCLUDE_FROM_ALL target property to false for the subproj targets, like:

set_target_properties(subproj.target1 subproj.target2 PROPERTIES EXCLUDE_FROM_ALL 0)

but it’s still tedious to list the targets individually.

I don’t see a way to do this right now. I think components would be the easiest way right now, but some way to control install(EXCLUDE_FROM_ALL) from a scoped variable would probably be sufficient too.

Thanks for the hint.
BTW, I haven’t really seen it documented explicitly anywhere that add_subdirectory(... EXCLUDE_FROM_ALL) prevents install rules from running from the added dir.
Or is it simply because of the side-effect that running install rules on excluded targets is undefined behavior, and hence they’re disabled?

I’m not sure of the history there, sorry.