How to handle more than 10 config flags in if statement?

Sorry for picking this up again.
I currently implement a search of those configs to see if any of them is set. The basic idea is:

  • Those flags are passed in via cmake -D in build command
  • Those flags are all prefixed with (assumed) ABC_

So I search those configs with ABC_ prefix in the cache like the code below

get_cmake_property(CACHE_VARS CACHE_VARIABLES)

foreach(CACHE_VAR ${CACHE_VARS})
    string(REGEX MATCH "^ABC.*" _FOUND "${CACHE_VAR}")
    if (_FOUND AND "${${CACHE_VAR}}")
        set(ABC_FLAG ON)
        break()
    endif()
endforeach()

It works well. But my friend told me that CACHE_VARIABLES is “intended for debugging purpose”, according to https://cmake.org/cmake/help/v3.21/prop_dir/CACHE_VARIABLES.html.

Is it proper to use CACHE_VARIABLES in cmake code, not for debug purpose only? Is there any risk that CACHE_VARIABLES may be deprecated later?