Are you setting up the include directories correctly? Since you’re specifying the file to be included as test/test.h, it means that ${TEST_INCLUDE_DIR} must be a directory which contains directory test (which then contains test.h). Is that the case?
Also note that the result of the check is cached, i.e. the symbol existence is only checked in the first CMake run. If you want to force re-evaluation, delete the usage_flag_exists cache variable (e.g. by passing -Uusage_flag_exists on CMake command line).
You’re right, apparently the module sets the variable as INTERNAL. So you will have to run CMake with -U from the command line, or manually delete the variable from the CMakeCache.txt.
Yes, this will remove the cache variable at the start of each CMake run. Which means that the compilation check for the existence of USAGE_QUALITY will be performed during every CMake run too. It is up to you to decide if that is what you want; note that it visibly slows down the configure step.
It’s not really “without being updated,” it’s just that the check fails to find the symbol. You can try running CMake with --debug-trycompile to force it to leave the buildsystem generated by the last try_compile() on disk. So, the steps would be:
Ensure that check_symbol_exists(USAGE_QUALITY ...) is the only symbol check, try_compile(), or try_run() command which will run in your configure step (e.g. comment out all others, if any, or ensure they have their result already cached).
Run cmake -Uusage_flag_exists --debug-trycompile . in your top-level binary directory.
Look into CMakeFiles/CMakeScratch/TryCompile-* for the buildsystem CMake used to check the symbol’s existence, and manually inspect why it’s failing to find the symbol.