I'm working on a CMake project that uses Qt. To automatically generate MOC and UI files, I've set the CMAKE_AUTOMOC and CMAKE_AUTOUIC options to ON in my CMakeLists file. As a result, Visual Studio displays automatically generated files with names like "autoic_", "moc_" and "ui_" and some automatic generated directories that contain files I don't need to edit.
My question is, how can I hide these directories and files in Visual Studio without disabling CMAKE_AUTOMOC and CMAKE_AUTOUIC? I need to keep these options on to build my project correctly.

I tried to set CMAKE_AUTOMOC and CMAKE_AUTOUIC to OFF but in this case my project can't build.
I met the same problem in vs2017,haven't found a solution to this problem yet。 Here's how to hide a folder:
Not sure how to hide files。