Skip to content

Commit 2375e1d

Browse files
authored
Do not clobber user environment variables in Meson script (#1255)
1 parent 509b5aa commit 2375e1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

foreign_cc/meson.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ def _create_meson_script(configureParameters):
8787
cxxopts = (ctx.fragments.cpp.copts + ctx.fragments.cpp.cxxopts + getattr(ctx.attr, "copts", [])) or []
8888

8989
if copts:
90-
script.append("##export_var## CFLAGS \"{}\"".format(" ".join(copts).replace("\"", "'")))
90+
script.append("##export_var## CFLAGS \"{} ${{CFLAGS:-}}\"".format(" ".join(copts).replace("\"", "'")))
9191
if cxxopts:
92-
script.append("##export_var## CXXFLAGS \"{}\"".format(" ".join(cxxopts).replace("\"", "'")))
92+
script.append("##export_var## CXXFLAGS \"{} ${{CXXFLAGS:-}}\"".format(" ".join(cxxopts).replace("\"", "'")))
9393

9494
flags = get_flags_info(ctx)
9595
if flags.cxx_linker_executable:
96-
script.append("##export_var## LDFLAGS \"{}\"".format(" ".join(flags.cxx_linker_executable).replace("\"", "'")))
96+
script.append("##export_var## LDFLAGS \"{} ${{LDFLAGS:-}}\"".format(" ".join(flags.cxx_linker_executable).replace("\"", "'")))
9797

9898
script.append("##export_var## CMAKE {}".format(attrs.cmake_path))
9999
script.append("##export_var## NINJA {}".format(attrs.ninja_path))

0 commit comments

Comments
 (0)