[Buildroot] [PATCH 1/1] package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

Samuel Martin s.martin49 at gmail.com
Mon Sep 5 21:49:51 UTC 2016


On Mon, Sep 5, 2016 at 11:39 PM, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> Hello,
>
> On Mon,  5 Sep 2016 23:00:56 +0200, Bernd Kuhls wrote:
>
>> +# Uses __atomic_fetch_add_4
>> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
>> +OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
>> +endif
>
> Isn't this overriding the flags already passed? Shouldn't it be:
>
>         -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -latomic"
>
> or something like that?

Nope, this is correct because, by default, CMAKE_CXX_FLAGS is not set
by Buildroot (except for
host-package), and for the target ones, the toolchainfile.cmake allows
defining package specific
CMAKE_CXX_FLAGS (see [1]).

Besides, doing:
  -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -latomic"
may allow take into account the CMAKE_CXX_FLAGS variable set in the
Buildroot environment; I'm
not sure we want this...

So, the original code from Bernd should behave as expected.

[1] https://github.com/buildroot/buildroot/blob/master/support/misc/toolchainfile.cmake.in#L17

Regards,

-- 
Samuel


More information about the buildroot mailing list