The Lieb-Schultz-Mattis (LSM) theorem states that a spin system with translation and spin rotation symmetry and half-integer spin per unit cell does not admit a gapped symmetric ground state lacking fractionalized excitations. That is, the ground state must be gapless, spontaneously break a symmetry, or be a gapped spin liquid. Thus, such systems are natural spin-liquid candidates if no ordering is found. In this work, we give a much more general criterion that determines when an LSM-type theorem holds in a spin system. For example, we consider quantum magnets with arbitrary space group symmetry and/or spin-orbit coupling. Our criterion is intimately connected to recent work on the general classification of topological phases with spatial symmetries and also allows for the computation of an anomaly associated with the existence of an LSM theorem. Moreover, our framework is also general enough to encompass recent works on SPT-LSM theorems where the system admits a gapped symmetric ground state without fractionalized excitations, but such a ground state must still be non-trivial in the sense of symmetry-protected topological (SPT) phases.