[CMake] Don't LTO optimize targets that aren't part of any distribution
When using distributions, targets that aren't included in any
distribution don't need to be as optimized as targets that are
included since those targets are typically only used for tests.
We might consider avoiding LTO for these targets altogether, see
Differential Revision: https://reviews.llvm.org/D102732