Approximation in weighted Lebesgue and Smirnov classes with variable exponent