A 40 meter dipole does not "need" to be full size and in a straight line and perform "acceptably". An inverted V or dipole with legs not exactly in line may only be something like perhaps a dB or two down from a full size horizontal dipole. A loaded (loading coils, or linear loading) dipole will perform very close to a full size dipole IF it is over or well over half size, say 3/4 size or something like that, possibly only a dB down from a full size dipole. HOWEVER, there is no such thing as a free lunch, any loaded (trap, coils, or linear loading) will have reduced bandwidth. If you only want to operate CW or Phone, probably enough BW, but possibly not if you want the whole band, but with an ATU in the shack, it might be possible, especially if the antenna is near full size.
Multiband trap dipoles are often close to half size, BUT often require adjusting on multiple bands, have limited BW and have significant losses, but are good options for some folks.
If I had your problem, and I had room for a 2/3 or 3/4 size 40 meter dipole, I would construct loading coils and place them about half way out each leg. Ideally, the coils would be nearly square and perhaps two inches or so in diameter, BUT, you could make them a bit slimmer and longer, perhaps 1 inch in diameter and 2, 3 or 4 inches long. Losses would be a bit higher, but I doubt you would lose even a dB. If loading coils out on the legs are too ugly, you could load the dipole with inductance right in the center (feed point) of the dipole, with slightly more loss. Probably not good for very short dipoles, but if it is something like 3/4 size might work fine. If the feed point Z is too low, a hairpin (shunt coil, etc) right at the antenna end of the coax would raise it to 50 ohms.
If you have the money, a remote ATU right at the top of the tower would probably match something like a 3/4 size 40 meter dipole (without loading coils) on all of 40 meters, and "possibly" you would pick up 30 and 60 meters also (not guaranteed on 60 meters). Efficiency would probably be acceptable, and you MIGHT get lucky and it would tune on some WARC bands like 17 and 12 meters...probably not !!
Do your research, there are lots of ideas which might work. One thing not mentioned yet is that if you could only erect say a half size dipole, you could drop the ends down toward the ground (to make it full size), or zig zag them sloped or horizontally, and only degrade the dipole very slightly. Just try and not drop the ends down close to the ground, try for at least 10 feet above the ground, but for sure go high enough so folks cannot touch the end, it is a very high voltage point of the dipole.
I have used roof mounts and many towers on the ground. Personally, I still climb, so favor ground mounted towers since in my 68 years as a ham, I have never put up a permanent antenna. I change bands, experiment with different antennas, etc. so can just climb up and put up a dipole, quad, yagi, HF, VHF, or whatever and do not need to climb all over the roof which is icy and snow covered over half of the year here in Alaska. At one time, decades ago I had multiple roof mounted short towers and poles on the roof. Probably had at least 15 roof penetrations, and never a leak. If there was a significant load, I reinforced the mounting area in the attic, that is not a minor task, but a normal person can do it ! I used lots of a tar like substance. Never had anything fail, but after about 40 years when we added on to the house and installed a new roof, I put all my antennas on my ground mounted towers. If you guy your roof mount tower, there will probably be significant "humming" noise when it is windy. I was lucky, our bedroom was right under the roof towers, but it never bothered my wife or me in the slightest, she said it was just like sleeping in a sailboat, which in our case was even worse, with all the clanking, groaning, and humming from all the boat rigging. There are probably better ideas than mine, I just wanted you to think outside the box for a solution.
Rick KL7CW Palmer, Alaska