I’ve taken squirrels (and other small game) with a variety of muzzleloader calibers, from 32 to 62 cal, including 40 caliber. They all seem to work, as the squirrels I hunted were never that difficult to kill or all that dangerous. Any gun that you can consistently hit a target the size of a golf ball will do. We hunted with the larger calibers primarily to practice with them. If one can hit a squirrel (or other small game) in the head……
For a dedicated squirrel gun, I would consider a 40 cal too large, but that’s personal preference. I hunt often enough in relatively populated areas, and have to consider how far a roundball out of a 40 caliber will travel compared to a 32 caliber (which is about half the weight of a 40 roundball) if shooting at squirrels off the ground. There are also local regulations to consider when hunting small game/squirrels that may limit your caliber choice, depending on where you hunt.