Precompiled headers with Autotools
Asked Answered
T

2

9

Is it possible to use gcc precompiled headers in projects using automake / libtool?

Adding new make rules to build precompiled headers is not difficult. The issue is that you also have to add compilation flags introduced by libtool and AFAIK it can't handle header input files.

How can you do that?

Toul answered 3/9, 2009 at 9:57 Comment(1)
I think there was a support for it planned for autotools las time I've checked (quite a while ago). I wonder how far it's gotten too.Subgenus
B
2

Problem is that solution does not work on all systems; libtool will use a different compiler command line than $(CXXCOMPILE), so when using libtool on some systems you wind up with not being able to use the precompiled header.

I have not yet found a way to work around this; I tried to use $(LTCXXCOMPILE), but it complains that it does not know how to deal with a header file (saying libtool: compile: cannot determine name of library object from 'project.hxx'). Of course, what it should do is use project.hxx.gch as the output file, but I don't see a way to make it do that short of modifying the libtool script, and that would defeat the purpose of using the GNU build system…

Buddybuderus answered 4/10, 2010 at 15:33 Comment(0)
A
-2

Yes - although AFAIK there's still no built-in support for them in automake.

I followed these instructions and got precompiled headers working in one of my projects, cutting build times in half :-)

Alenealenson answered 13/9, 2009 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.