Reputation: 41
I have a library in C which can be built with both autotools and CMake. In CMake, it is possible to define public and private headers (.h), so that the public ones are then installed (to be used in client code), while the private ones are used only to build the library itself. Can this be done in autotools?
What I see so far is that the nameinc_HEADERS
must contain all the headers (public and private), otherwise, if any header is skipped, make distcheck
fails. Can, for instance, the private C headers be specified in another way (so that make distcheck
is happy, but the private headers are not installed)?
Upvotes: 1
Views: 81
Reputation: 181199
In CMake, it is possible to define public and private headers (.h), so that the public ones are then installed (to be used in client code), while the private ones are used only to build the library itself. Can this be done in autotools?
Yes.
There are two main ways of doing this in an Autotools build system using Automake (such as yours, apparently):
Headers may be included in one or more *_SOURCES
lists. Automake recognizes them by filename extension and ignores them, except for including them in distribution packages.
Headers that should be included in distribution packages but not installed as part of make install
can be designated in a noinst_HEADERS
variable.
Headers listed in a *_HEADERS
variable without a noinst
prefix will be installed by make install
, as that is exactly the significance of such variables.
You can read more about this in the Automake manual, especially, but not exclusively, in its section about headers.
Upvotes: 3