There seems to be a known bug using private slots and the Automoc function in CMake, after upgrading CMake to 3.28.3 it compiles fine. See here: https://discourse.cmake.org/t/a-bug-with-auto-moc-and-object-libraries-that-has-been-fixed-or-not/4582