I'm not sure why you asked for details but...
Assuming you are using cmake 3.13 then you can do the following in a command shell:
cmake -G "Visual Studio 15 2017" -S path_to_source -B path_to_build
This will then create a solution file. Actually it creates a solution file for every project()
command that is issued in CMakeLists.txt
.
You can then open the solution file in Visual Studio
, and build the project as usual.
You don't even need to do this in the Visual Studio
GUI. After creating the initial project you can also issue the command:
cmake --build path_to_build
Which will kick off the build at the command line.
Now if your CMakeLists.txt
in path_to_source is using Linux specific libraries or gcc
specific compiler settings then the CMakeLists.txt
will have to get updated to the Windows equivalent.
The alternative is to start Visual Studio
and then use File->Open->CMake
and open the CMakeLists.txt
file in path_to_source. It'll then start to generate the project. But I prefer using the command line method.