How to switch off CMake automoc for subdirectories?

797 Views Asked by At

I have directory aaa and aaa/bb. I want CMake to create the moc_compilation.o file only for aaa/*.cxx files, but it scans recursively aaa/bb/*.cxx files also. How can I disable the recursive scan for automoc?

1

There are 1 best solutions below

0
Kevin On BEST ANSWER

You can use the SKIP_AUTOMOC source file property to skip automoc processing for one file, or an entire group of files. This works for header files as well:

file(GLOB MY_EXCLUDED_SOURCES aaa/bb/*.cxx)
set_property(SOURCE ${MY_EXCLUDED_SOURCES} PROPERTY SKIP_AUTOMOC ON)