Can CMAKE be used to directly build a - pre-existing - Visual Studio solution (.sln) without generating it?
01:25 11 Dec 2025

I have a Visual Studio 2019 solution with multiple projects inside, that currently is built with MsBuild.exe.

I have some pre-build and post-build scripts, that I need to ditch because they became tedious to support, and CMAKE would be perfect for those roles:

  • pulling in git submodules

  • fetching additional binary dependencies

  • performing various post-build checks on the binaries

  • packing binaries into zip files

Sadly for various reasons - the main problem is that Windows Driver project generation in CMAKE is fiddly/unreliable at best - I cannot use it to generate the .sln/.proj files themselves, the already existing files (generated by Visual Studio) must be used.

I tried to set up a configuration, but sadly so far found dead ends:

  • the Visual Studio generators are not really an option

  • there is NMAKE support in CMAKE, but that is basically an older build system by Microsoft?

My question is: is it possible to build my solution directly (or indirectly) trough CMAKE?

cmake msbuild solution