Depending on how you define meaning, I believe that it's impossible to live a meaningless life in the truest sense. It's like how 'zero' is a concept that does not have direct physical manifestation.
The biggest concern about life's meaning is whether your life reflects the requirements of your ego. When the current life does not match it, individual has the impression that their life is "meaningless". They feel like there would have been no difference whether they were born or not, because their emotional makeup only values a narrow aspects of life that they are unable to fulfill. Since they are unable to fulfill their desired role, the logical course of action is committing suicide to free resources for another individual who would actually wish to be in their situation, rather than suffering for free by dedicating everything to another.
Of course, let's exclude individuals who think they live "for" something/ someone else but disguising their egoism behind a veil of deception or ignorance. (Which isn't inherently bad, like any role in society)
With this premise in mind, I will adress the question you address to us:
If you cannot live a life for yourself, but you live it for someone or something else, does that mean your life has a meaning?
Yes, but actually no, but maybe yes.
"Live for someone else": I suspect that not a lot of people would want to surrender all their resources (time, wealth, skills) and their freedom of choice (expression of the self and free thoughts) for another individual, because humans were designed as autonomous agents like most living beings.
However, it's completely opposite for the option "Live for something else", because you keep all your resources and freedom and use your own discretion towards a cause your ego chose. So in fact, by living for that thing, you actually live for yourself. That
thing can be the projection/idealization/conceptualization of a real person. Like how you can live "for your family" without being their slave by serving them on your own terms (and comically "serving" them in a completely unwanted way).