Cross platform in the IDE.

I know cmake can generate makefiles for linux and vcproj and a sln for windows.

Is there a way to create a project that opens and builds for windows in Visual Studio that also lets you use wsl:ubuntu to genrate makefile in the wsl container and let me debug in the windows IDE?

I believe this is what you are looking for:

TLRD: Visual Studio has CMake support that facilitates what you want.

Not what I was asking.
Cmake contains generators. I want the generator to create the project and sln as they are NEVER checked in.

CMAKE ----->sln, vcproj, makefile, etc

The difference here is that the config will contain a bit of both at the same time so the debug can be started in wsl and remotely debugged in IDE.

I’m not sure about remote debugging, but in terms of generating an sln, makefile, or XCode project, etc, this is CMake’s normal operation and main design goal.

Please read carefully the request. I have been using cmake since 2.x days

I am absolutly not an expert, but I have a general understanding.

What I guess I was asking, befor looking into writing it myself, was if the current generator is wsl aware and can write the bits to make such a project.

Yes. If you read the article linked above, the Visual Studio project generator can integrate with WSL.

Sorry I think that is the ssh connection to remotes host purchased from (crap cannot remmeber the name) it is a wsl1 methodolgy and not the CMake commands that generate a project that alows the integration they use now that has direct access to file system of wsl2 and no longer needs the ssh and all the file copying.
I belive that is "Visual Studio generating project from it’s template anyway and not what I was thinking.

I think I may have a way.
It would need to generate the windows into build 1 then generate the makefile into build2 the write the launch.json to or little glue file that lets Visual studio tell wsl were to build and debug

I will sleep on it. I think I can call cmake twice in a wrapping script running one in windows and one in wsl

That sounds like a valid solution.

It’s still unclear to me exactly what you’re trying to do, though.

You might be interested in

and