On Thu, 2020-05-14 at 05:33 +0100, Ken Moffat via lfs-dev wrote:
> I notice that in some places people have overridden any existing
> CFLAGS when adding -fcommon.  In most places, for those of us who
> care the fix is obvious (CFLAGS="$CFLAGS -fcommon").  One or two
> packages will turn out to be more painful.
> 
> The first I've found is freeglut, where the book uses
>       -DCMAKE_C_FLAGS=-fcommon
> 
> For people without any existing CFLAGS, that does the right thing
> and respects the -O3 etc from specifying a Release build (seen by
> using 'make VERBOSE=1') but for people who have extra flags such as
> "-march=native -D_FORTIFY_SOURCE=2" those just get thrown away.
> 
> I'd assumed I could add
>      -DCMAKE_CFLAGS="$CFLAGS -fcommon"
> 
> but if I do that, cmake tells me that CFLAGS was not referenced.
> 
> In this case, I am getting the right results (testing on a gcc-9
> system) with:
> 
> CFLAGS="${CFLAGS} -fcommon" \
> cmake -DCMAKE_INSTALL_PREFIX=/usr      \
>       -DCMAKE_BUILD_TYPE=Release       \
>       -DFREEGLUT_BUILD_DEMOS=OFF       \
>       -DFREEGLUT_BUILD_STATIC_LIBS=OFF \
>       -Wno-dev ..
> 
> Can I ask people to at least *consider* not trashing a user's
> specified CFLAGS ?

Sorry about that Ken. As you noted in another post, cmake semantics is
not always easy to understand. I thought that doing like that was
preserving user's CFLAGS... And for some reason I thought CFLAGS where
not passed when doing the above (CFLAGS in the environment).

Will fix the book, and add "$CFLAGS" before -fcommon at other places I
have put them.

Pierre

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to