Yes, it works if I list the headers explicitly for the target with the command “add_libraray”/“qt5_wrap_cpp”.
What I want to do is separate the interface files from the implementation files, the interface files will not appear in the IDE project list. CMake organizes interface files paths for implementation files references.
But the interface files contain Q_OBJECT, and AutoMoc does not recognize the Q_OBJECT of the interface files while listing in the Project’s CMakeLists, so the link error occurs.
I meant if you listed the headers explicitly in the source list without any qt5_wrap_cpp usage. If not, it sounds like something that autogen would need a new feature in order to support.