The c_cpp_properties.json file supports a customConfigurationVariables property and the plugin provides the cpptools.activeConfigCustomVariable command to access those custom configuration variables for example from the tasks.json. This allows a flexible integration of the C/C++ configurations with the VS Code Tasks.
However, neither the customConfigurationVariables property nor the related cpptools.activeConfigCustomVariable command are documented in the reference https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference.