I am going to assume that angle, speed, and vertical position are fixed, and horizontal position is variable.

zᵢ is initial height (meters),

(x, y, z) is the target position (meters),

Vᵢ is the initial velocity of the cannonball (meters per second),

ω is the angular velocity (radians per second),

θ is the angle relative to the positive x axis that the cannon is turned to, to face the target (radians),

and φ is the angle above the ground the cannon is raised to, arbitrarily (radians).

First do the z direction:

Vᵢ sin φ is the initial z velocity.

S ω Vᵢ - 9.8 m/s is the acceleration in the z direction.

Since Δd = Vᵢt + ½at²,

z - zᵢ = (Vᵢ sin φ) t + ½ (S ω Vᵢ - 9.8) t², or

½ (S ω Vᵢ - 9.8) t² + (Vᵢ sin φ) t - (z - zᵢ) = 0.

Using the quadratic formula to solve for t should give you two time values.

Which one you use depends on whether you want to hit the target on the way up or on the way down.

Once you know at what time the projectile will have the same z coordinate as the target, you can calculate how far in the x and y directions it will travel in that amount of time.

Vᵢ cos φ cos θ is the initial x velocity,

Vᵢ cos φ sin θ is the initial y velocity.

Since Δd = Vt,

Δx = (Vᵢ cos φ cos θ) t

Δy = (Vᵢ cos φ sin θ) t

So the cannon should be at (x - Δx, y - Δy, zᵢ).