Can gl_WorkGroupSize be set outside the compute shader?
Core OpenGL has no mechanism for this. The ARB_compute_variable_group_size extension provides such a feature. It doesn't allow for indirect compute operations though.

It doesn't seem to have much AMD support though (outside of open source Linux drivers). And Intel support is nil.