How does AUTOMOC and CMake determine which sources toscan?
-
This is somewhatrelated to my previous post here: https://forum.qt.io/topic/162686/cmake-and-automoc-syntax-error-constant-when-using-fetchcontent. The subject says it all: I'm trying to understand how CMake/AUTOMOC work.
I was having an issue where AUTOMOC was being used on a FetchContent dependency. I think the reason for this was that I was using
include_directories()
to add a directory to this FetchContent dependency. I fixed this by usingtarget_link_libraries(mylib PRIVATE sqlite)
and then usingmylib
with myQt
app.Can someone explain how CMake/AUTOMOC work together in deciding which files to scan/include?
-
It simply scans all source files.
-
It simply scans all source files.
@Christian-Ehrlicher What do you mean by "all files", I mean, it's not scanning my home dir :). I think there is more to it then that because how would adding
include_directories()
trigger automoc on an external dependency (FetchContent). -
All files you added to the target
-
@Christian-Ehrlicher What do you mean by "all files", I mean, it's not scanning my home dir :). I think there is more to it then that because how would adding
include_directories()
trigger automoc on an external dependency (FetchContent).@snoriman said in How does AUTOMOC and CMake determine which sources toscan?:
think there is more to it then that because how would adding include_directories() trigger automoc on an external dependency (
It does not.