Elegant way to enable-disable RTX from C++

How do games handle enabling-disabling RTX setting from the Menu? So the ideal flow could be to detect at the beginning/first run if the user has RTX capable (IsRayTracingEnabled() function does this and checks almost everything which can enable RTX). Now despite the machine supporting RTX, there’s a possibility that the user may still choose NOT to use it. In that case, if it’s disabled via the menu, then the game needs to be restarted, but am not sure what all flags to be modified after restarting so that RTX is OFF. Also, if user decides to turn it on, am assuming those same set of flags can be enabled?

Extending to this, if user system doesn’t support RTX, then how do you take the non-RTX path for the game using C++?

Any help would be appreciable.