use different compiler based off extension

69 views
Skip to first unread message

Daniel Moody

unread,
Jun 15, 2023, 12:08:15 AM6/15/23
to bazel-discuss
So apparently bazel does not support differentiating a c and c++ compiler in the same toolchain: https://github.com/bazelbuild/bazel/issues/4644

But anyways is it possible to configure two different toolchains, one for c and one for c++ then create rules which pick the correct toolchain based of the source file extensions? I am pretty new to bazel but I guess this would done in the form of a macro?

Daniel Moody

unread,
Jun 15, 2023, 12:26:33 AM6/15/23
to Daniel Moody, bazel-discuss
it looks like the best solution would be to just write custom rules for all my own c and c++ needs? This guide https://ltekieli.com/writing-custom-bazel-c-rules/ seems to cover the basic and I can extrapolate writing c and cxx rules for compile and link and work in using the correct c or c++ toolchain into the respective rules?

 

{ name     : "Daniel Moody",
  title    : "Sen Server Development Platform Eng",
  phone    : "321-506-6255",
  location : "Cedar Rapids, IA",
  twitter  : "@MongoDB",
  facebook : "MongoDB" }



--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/6e45446b-f19f-40a3-a59b-2d97892a4b7fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages