Reduce number of targets in IDEs

I typically use (git) submodules into third party libraries I need for my projects. Most of the time, these third party libraries provide several targets, and for my current project, I have 8 submodules. This results in 87 targets which Visual Studio needs to load and unload, 87 schemas for Xcode to load an manage, etc etc.

As an example, SPIRV-Cross from the Khronos group generates at least 14 targets, but I only need the statically linked library. I do understand that this statically linked library depends on other things, but I never want to build them separately.

Furthermore, I never rebuild the third party libraries if I don’t do a clean build or change build type from Debug to RelWithDebInfo or back.

Is there a CMake-y way to either suppress or, preferably, remove, unnecessary targets?

You’ll have to forgive me if I come off as uninitiated, but even as an intermediate level cpp-programmer I find, at times, that CMake is difficult. Thank you.

There’s nothing really CMake knows about this. I think the namespacing proposal might be able to help someday, but as far as CMake knows, those targets are part of your project too.

I’ll note that not every project is set up to be included via add_subdirectory; projects which are may have options you can set to hide “internal” details (though beware how they may differ from “official” setups and tested scenarios).