How to share precompiled headers via an interface library

The first signature will pass the list of precompile headers into PRECOMPILE_HEADERS or INTERFACE_PRECOMPILE_HEADERS properties.

But only the REUSE_FROM signature of target_precompile_headers will get the targets to reuse the PCH. This sets the PRECOMPILE_HEADERS_REUSE_FROM property.

What you want is a INTERFACE_PRECOMPILE_HEADERS_REUSE_FROM property, but this doesn’t exist. You would have to live with the static library approach.

1 Like