Because I sense (maybe) a lingering bit of uncertainty, I'm going to restate what everyone else has already stated correctly. I think I'm also going to make a tutorial about this. I'm consciously ignoring stuff about CP shift at Mach, angle of attack, and such. Sticking with the basics here.
1) Stability of the rocket is determined by the stability margin (CP - CG) of the rocket in its full flight configuration. Period.
This is ironclad, and dictates that the CG measurement includes the motor. If you want you can stop reading right here: put the motor in, adjust your nose weight to achieve desired stability margin, and fly the rocket. QED.
However, there are at least two other approaches. All are designed with the same end goal: achieving desired stability according to equation (1). Even if you use one of the methods below, you can still measure CG of your fully-loaded rocket just before launch, just to be sure.
2) Use a sim program.
For this approach you weigh and measure CG of the fully-built rocket *without* the motor, and then enter those values into the sim program (as overrides for the entire rocket). When you tell the sim program what motor you want to use, it can then figure out the CG (and therefore stability) of the full flight configuration, because it knows the weight of each motor, and the location of the motor in the rocket. This way you can check the stability with different motors, including ones that you don't even own but are considering. You can also, of course, do a ton of other useful stuff (e.g. calculate altitude and delays), but just focusing on stability here.
This is where the confusion comes from with regard to with or without motor. In this approach *you* are measuring the CG without the motor, but the sim is then finishing the calculation and determining CG (and stability margin) *with* the motor, which is ultimately what matters.
Note that the sim program will still report stability margin even when you have not configured a motor. Generally this should be ignored, it's not relevant to anything.
3) Measure rocket with heaviest planned motor.
Let's say you're not using a sim program, but you want to configure your rocket to fly safely with a variety of motors. What you can do is load up the heaviest motor you plan to fly, and measure CG. Adjust nose weight as needed to achieve desired stability margin. Fly happily on all different motors.
This works because the heaviest motor is going to be the worst case, with CG furthest back, and therefore the worst stability. Lighter motors will yield higher stability margin, which generally is fine (unless it gets way out of hand, but that's not usually a results of swapping motors).
Also, this method requires that (a) you *know* the heaviest motor you'll want to fly, and (b) you have one to measure.