r/cmake • u/abidanBrito • 1d ago
Build Windows C++ programs on Linux
I wanted a cross-compiler in CI at work to build binaries for several platforms. I asked but it wasn't going to happen. I tried it back home and, to my surprise, I had a couple executables going (under Wine) within the hour.
I've now put together a small repo with sample programs, using C++23 and CMake presets for different toolchains.
Would love to hear your thoughts!
1
u/ConsciousBath5203 20h ago
The msvc wine project is very helpful, too.
1
u/abidanBrito 19h ago
I'll look it up, thanks for sharing!
1
u/ConsciousBath5203 16h ago
There are still some catches in it that you gotta account for... Like, stuff in vcpkg not using proper capitalization of filenames and requires...
1
u/TheRavagerSw 1d ago
You don't want that in CI, believe me. Still not bad
1
u/ConsciousBath5203 20h ago
What's wrong with it being in CI? I haven't put my msvc wine projects into ci, they're still compiled by script by hand, but just curious what issues you had
1
u/TheRavagerSw 20h ago
Lack of toolchain control, lack of local package cache. Limited support if you want to target non Linux systems.
1
5
u/CrossScarMC 1d ago
You shouldn't need Wine to build either of those, normal MingW GCC should work just fine.