How to hide the automatic generated moc_, autouic_ and ui_ files in VisualStudion 2022?

89 Views Asked by At

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. The automatic generated files

I tried to set CMAKE_AUTOMOC and CMAKE_AUTOUIC to OFF but in this case my project can't build.

1

There are 1 best solutions below

2
edwin.zhu On

I met the same problem in vs2017,haven't found a solution to this problem yet。 Here's how to hide a folder:

source_group("CMake Rules" REGULAR_EXPRESSION"^$")
source_group("Header Files" REGULAR_EXPRESSION"^$")
source_group("Source Files" REGULAR_EXPRESSION"^$")

Not sure how to hide files。