Looking for a workaround for handling gcc cross-compilers which all have different names/libs/headers

MinGW-x64 cross compilers on Linux have specialized names like i686-w64-mingw-gcc (instead of just gcc). These cross compilers are specific to 32 or 64 bit builds. For example, the i686 compiler can only build 32-bit EXEs, and the x86_64 compiler can only build 64-bit EXEs.

In one of Daz’s posts, he referred to a design doc which calls out the issue as something you’re aware of – to be addressed in the future:


In the mean time, I have to separate my cross-compile projects into x86 and an x64, which is fine.

However, I’d like to share the source code rather than duplicating it. I want to source code to be in the x64 project, and the x86 project should reference it.

I’ve been tinkering with source sets, but I can’t get it to work. Can you show me how to do this?

Thanks for your help!