c++modules: discover synth targets for all configs

Fixes: #26312
8 files changed