Disable building x86 targetPlatform on x64 Linux host


I have a native project that is built using gradle. It has x86 and x64 targetPlatforms defined. This works fine on Windows but on linux the GCC tries to build x86 executables on x64 host Linux OS which fails.

I could install g+±multilib but actually I don’t want the x86 variant to be buildable on this particular OS since I have dependencies which cannot coexist (i386 and x64 variants).

I have separate docker images anyway for x86 and x64 host.

Why is x86 variant detected as buildable anyway?

The problematic thing here is GoogleTest integration - the test executables are trying to be built for every platform even though it shouldn’t try to build x86 when multilib is not present.

Any workaround/fix/solution for this issue exists?

I found this topic but this doesn’t seem clean solution, also the topic is quite old maybe some new approaches are recommended?