c++ – Cross-compiling a Linux binary from VS2022


I have been working with an existing VS2022 project to compile C++ code to generate .exe files for targeting Windows. I now need to cross-compile for a Linux target (using WSL). I’ve been following this walkthrough on the MS website: https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2?view=msvc-170 . This walkthrough says I need to create a CMake project from scratch so that I can build Linux binaries directly on WSL. However, a brand new project is causing me problems because I need re-configure all my external dependencies to match my Windows build environment. I have hundreds of dependencies so I don’t have the time to re-do this manually. Can someone please recommend a way for me to replicate my Linux build environment to match my Windows project? Reading online, I can see some people use vcpkg for this but haven’t been able to figure this out yet! Is this the right tool for the job?

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *