To generate a cube map on the GPU, you would need to do separate draw calls to first generate the cubemap and then use it. That is, you'd bind each cube map render target and draw your scene into it, using a standard vertex shader and a pixel shader that just returns zero (since only depth is important for shadow mapping, not color). You have to do this 6 times, once for each cube face, unless you use a geometry shader to replicate the triangles into the 6 render targets on the GPU.
Then, you'd bind your main render target and draw your scene again using a pixel shader that samples the cubemap to determined how much the pixel is shadowed and incorporate that into the usual lighting/shading calculations.
So you can render the cube map on the GPU, but you do have to do some extra work on the CPU to set everything up. The cubemap cannot be generated and used entirely by shaders without any CPU involvement at all.