[build2] How do you specify several file extensions possible?

Boris Kolpackov boris at codesynthesis.com
Fri Sep 14 16:30:31 UTC 2018


Klaim - Joël Lamotte <mjklaim at gmail.com> writes:

> Basically while trying to port some code to build2 I need to be able
> to express that header extensions can be either hpp, h or inl.

Are they the same headers or is .hpp for C++ headers, .h for C headers,
and .inl for C++ inline function implementations? If so, then:

h{*}:   extension = h
hxx{*}: extension = hpp
ipp{*}: extension = inl


> I'm not sure if I understood how to do it properly but would something
> like that work?
> 
>     hxx{*}: extension = hxx|hpp|h|inl

No. There can be only be one default extension per header type (i.e.,
"C Header", "C++ header", etc). If you do have different extensions
for the same header type, then you will have to specify one of them
explicitly, for example:

hxx{*}: extension = hxx

exe{hello}: ... hxx{foo bar.hpp} # foo.hxx and bar.hpp

In fact, in such a project, it may make sense not to rely on
default extensions at all and instead always specify them
explicitly to avoid any further confusion:

exe{hello}: ... hxx{foo.hxx bar.hpp}



More information about the users mailing list