Might also consider a few deep muscle massages. Spotting around the neck and traps muscles. Even the lower back could be involved. That could cause a tension headache. Thinking that the bar on the shoulders when squatting may pinch one of the nerves in that area, but you said headaches can happen when rowing and leg pressing. May also be that the spine is out of line, including neck (very common), which may need adjustments now and than. Something simple like stretching the neck from side to side, neck circles or back and forth may help before hitting a set.
Extended, heavy or forced breathing can cause headaches (some poor guy's get headaches when into heavy sex..worth the pain I would think). Might want to take 2 or 3 deep breaths between each rep of squats, for example, so a oxygen debt is not the problem. Actually too many deep breaths can make some people dizzy and blackout. A few find that happens when doing heavy breathing while doing the 20 rep breathing squat exercise. Like most every thing in life, some where in the middle can offer the best solution. Good Luck.