[Buildroot] [PATCH v2] cmake: don't use any header available in $(HOST_DIR)/usr/include

Fabio Porcedda fabio.porcedda at gmail.com
Fri Mar 6 04:22:07 UTC 2015


On Thu, Mar 5, 2015 at 12:52 PM, Baruch Siach <baruch at tkos.co.il> wrote:
> Hi Thomas,
>
> On Thu, Mar 05, 2015 at 12:31:48PM +0100, Thomas Petazzoni wrote:
>> On Thu, 5 Mar 2015 09:02:55 +0200, Baruch Siach wrote:
>> > On Thu, Mar 05, 2015 at 01:45:33AM +0100, Fabio Porcedda wrote:
>> > > +# Get rid of -I* options to prevent that a header avaiable in
>> > > +# $(HOST_DIR)/usr/include is used instead of a cmake one, e.g. lzma*
>> > > +# headers of the xz package
>> > > +HOST_CMAKE_CFLAGS = $(shell echo $(HOST_CFLAGS) | sed s/-I[^\ ]*//)
>> >
>> > How about (untested):
>> >
>> >     HOST_CMAKE_CFLAGS = $(filter-out -I%,$(HOST_CFLAGS))
>>
>> It unfortunately works only if the form:
>>
>>       -I/foo/bar
>>
>> is used. If you use:
>>
>>       -I /foo/bar
>>
>> which is valid for gcc, then filter-out will filter the -I but
>> not /foo/bar.
>
> Right. But the original sed expression doesn't work either. This one seems to
> work:
>
>         s/[[:space:]]-I[[:space:]]*[^\ ]*//

considering that the -I can be at the start of string:

sed -r "s/(^|[[:space:]]+)-I[[:space:]]*[^[:space:]]*//"

I hope using -r is not a problem because i don't like very much the
version without it:

sed "s/\(^\|[[:space:]]\+\)-I[[:space:]]*[^[:space:]]*//"

Thanks
-- 
Fabio Porcedda


More information about the buildroot mailing list