Hi All,
I am trying to create a custom toolchain for gcc and clang and have created platforms for the same as well. So in my command line if I use
bazel build ... --platforms=@toochains//clang:clang_platform
bazel build ... --platforms=@toochains//gcc:gcc_platform
It uses clang and gcc respectively.
Now I want to specify this dependency in target itself So that if I have two targets 1 should be built with gcc and second should be built with clang without specifying --platforms option.
Is there a way to achieve the same.
I have tried specifying
target_compatible_with = [
"@toolchains//clang:clang_platform",
]
But it gives me an error
in target_compatible_with attribute of cc_binary rule //:hello-world: '@@toolchains//clang:clang_platform' does not have mandatory providers: 'ConstraintValueInfo'
Is there a way in bazel that we can achieve this
Best,
Tushar