The CHECK_C_COMPILER_FLAG() and CHECK_CXX_COMPILER_FLAG() functions
from CMake return the result of the test in a variable passed as an
argument.
This variable is cached internally, so that subsequent calls of the
function with the same variable return the result without performing the
test again.
The add_c_compiler_flag() and add_cxx_compiler_flag() functions are
calling CHECK_C_COMPILER_FLAG() and CHECK_CXX_COMPILER_FLAG() with
the same variable FLAG_IS_SUPPORTED, making the test ineffective.
This diffs fixes the issue by generating a new variable name based on
the flag name. This allow for keeping advantage of the caching
mechanisme while having a different variable for each flag, making the
test working as expected.