'Excluding thirdparties from CMake generated Visual Studio solution

I'm building a project that includes my own source code, but also includes a number of thirdparties e.g googletest. I'm including third parties as source and adding them to my own CMakeLists.txt (via add_subdirectory) file so they get built alongside my libraries.

Is it possible to exclude the thirdparty projects from the generated Visual Studio solution? I don't want developers of my own code to see the thirdparty projects/source when they open the solution, I just want it there at build time.

I'm aware I can move them so a separate folder in Visual Studio using the FOLDER property, but ideally don't want them showing at all.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source