The only other thing I can think of at all is that you could theoretically have an old tqt.pc (or similar) file floating around in an obscure directory. I would search the entire system for such a file, just in case an old one without the include directories is being picked up by CMake and pkg-config together.
Only one tqt.pc found.
ld.so.conf was messed up, however, probably from so much experimenting.
Assuming you don't find a stale tqt.pc file there are a few options open to you: 1.) Manually extract the pkg-config information and patch the build on-the-fly as you are doing now. Just make sure to add a Nasty Hack Warning Message to your build scripts stating that this is only to work around a puzzling problem in CMake on Slackware for now.
Well here is an interesting turn of events. I added the following to my ugly script function hack:
pkg-config --cflags-only-I tqt
The command returns no results.
When directly in a terminal the command returns the expected -I/usr/lib/qt3/include -I/usr/include/tqt.
So perhaps the problem is right there. For whatever reason pkg-config is not running from within scripts. Or is dumping the results to the bit bucket.
Anybody have ideas why? I haven't yet found anything on the web.
Darrell