Shadow cube map: Comparing the depth value

Hello,

I have a scene rendered into the six sides of a depth cube map from an omni light position using a 90°FOV.

So far so good.

Now in the fragment shader I somehow need to compare
A) the distance between fragment position and light position (direction vector length) with
B) the distance/depth stored in the depth cube map

Problem is, the distance B in the cube map cannot be directly
compared with the “real world” distance A, right?

How can I get comparable distance values?

I know how to lookup B but not how to transform the returned
deoth value into something I can compare with A.

Help is really appreciated!

Probably I just found the answer here:
http://stackoverflow.com/questions/10786951/omnidirectional-shadow-mapping-with-depth-cubemap

Can somebody confirm this is how it is done usually?

See this post:

for some working code showing how.