Marking as advanced in bulk based on directory
It would be great to have a setting that, if set to ON, defaults new cache variables appearing after it to ADVANCED. When setting it back to OFF, this disables the feature. The use case for this is when I use add_subdirectory()
to pull in third party submodules with CMake projects into my own. I do not want settings & cache variables to be listed in the GUI. The user should not control these libraries with settings, I make sure settings are explicitly set prior to doing add_subdirectory()
. I want to be able to mark configuration added by that library as advanced without having to care about the CMake code.
Right now I have to use the mark_as_advanced()
command on individual cache entries to hide them. This is error prone and high maintenance since if I upgrade that library, and they change their configuration variables, I have to make sure that list is updated.
Example of what I'd like:
set( CMAKE_MARK_AS_ADVANCED ON )
add_subdirectory( ThirdPartyLibrary )
Or:
set_property( DIRECTORY PROPERTY MARK_AS_ADVANCED ON )
add_subdirectory( ThirdPartyLibrary )