The Leica M mount is the Leica M mount. Whether the camera is film or digital, a Leica M lens should work with a Leica M mount camera.
In the other hand, Leica L mount lenses (introduced in 2014) will only work on recent Leica L mount cameras, all of which are digital.
In the early 1970s Leica released an M mount camera named the CL. It used M mount lenses.
The current L mount lenses are for the Leica TL , Leica CL (2017) and Leica SL systems.
There were also Leicaflex and Leica R series SLR cameras that use the Leica R mount. The medium format Leica S series also have their own S and SL mount lenses, as well as adapters that allow the use of many other mechanical only lenses from other systems. There are also Leica C lenses made to be used by PL mount cinema cameras.
It's all covered at the Wikipedia entry for Leica.
From a comment:
I read that the new Leica lenses for M mount are optimized for digital. I don't know what that means.
It mostly means they are coated on the back as well as the front of elements to reduce internal reflections that are more problematic for digital than film. It can also mean they are sharper to hold up to the increased scrutiny that 'pixel peeping' in the digital era places on the expectations of lens quality. Please see Does high reflectiveness of digital sensor lead to poor lens performance? and Is there a real difference between “digital” and “film” lenses? for more.