From 83be120889b05c995c1d518185bf76767863b47b Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Fri, 3 May 2019 13:40:59 -0400 Subject: [PATCH] Fix //tools/cc_toolchain:capture_cc for Bazel 0.25 --- common/test/drake_assert_test_compile_variants.sh | 2 +- tools/cc_toolchain/BUILD.bazel | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/test/drake_assert_test_compile_variants.sh b/common/test/drake_assert_test_compile_variants.sh index d81d38e73626..6afea7183c91 100755 --- a/common/test/drake_assert_test_compile_variants.sh +++ b/common/test/drake_assert_test_compile_variants.sh @@ -19,7 +19,7 @@ if [[ ! -e ./drake ]]; then fi # Confirm that it compiles successfully, whether or not assertions are enabled. -TESTING_CXXFLAGS="-std=c++14 -I . \ +TESTING_CXXFLAGS="$BAZEL_CC_FLAGS -std=c++14 -I . \ -c $drake_assert_test_compile_cc \ -o /dev/null" "$BAZEL_CC" $TESTING_CXXFLAGS diff --git a/tools/cc_toolchain/BUILD.bazel b/tools/cc_toolchain/BUILD.bazel index 734f1e8ba30a..8ae21ae80fc9 100644 --- a/tools/cc_toolchain/BUILD.bazel +++ b/tools/cc_toolchain/BUILD.bazel @@ -38,7 +38,11 @@ filegroup( genrule( name = "capture_cc", outs = ["capture_cc.env"], - cmd = "echo \"BAZEL_CC=$(CC)\" > '$@'", + cmd = "printf \"BAZEL_CC=$(CC)\nBAZEL_CC_FLAGS=$(CC_FLAGS)\n\" > '$@'", + toolchains = [ + "@bazel_tools//tools/cpp:cc_flags", + "@bazel_tools//tools/cpp:current_cc_toolchain", + ], visibility = ["//common:__pkg__"], )