I have a project which uses Qt quite extensively. For the targets that use MOC/RCC/UIC I have corresponding variables set. We also manually include moc files to reduce reduce compilation times.
I want have a clang-tidy run before building project on the CI. Reason being is that some errors (such as use-after-move) are a deal breaker and the code shouldn’t even be built at all. This approach will also save time because we didn’t waste it by building known broken code. If I am running clang-tidy before the build, moc files will not be generated and clang-tidy will flag every such occurrence as an error.
I’ve tried to use autogen targets and this works to some extent: moc files will be generated only for targets without any dependencies. If the target has dependency, CMake will also build the dependency and thus will waste time.
Any ideas on how to solve this?