Startec
Startec

Reputation: 13206

How to add a CMAKE generator to the Linux version of CMAKE?

I am on a Windows machine running the Windows Subsystem for Linux. When I installed the CLI version of CMAKE on the WSL it did not come with any generators for visual studio (i.e. Visual Studio 15 2017 Win64).

How do I add these to the Linux version of CMAKE?

Upvotes: 2

Views: 2282

Answers (2)

Roland Sarrazin
Roland Sarrazin

Reputation: 1345

I ended up installing CMake on Windows (just extracting the zip file to my user folder as I don't have admin rights) but run the Windows CMake from the WSL2 bash after adding a vs2022 preset to my repository cloned in my WSL Linux:

my_user@MY_PC ~/wsl_workspace (main) $
/mnt/c/Users/my_user/Documents/cmake-3.29.2-windows-x86_64/bin/cmake.exe --preset vs2022
/mnt/c/Users/rolands/Documents/cmake-3.29.2-windows-x86_64/bin/cmake.exe --build --preset vs2022

At least this helps in maintaining a single repository.

Upvotes: 0

Cinder Biscuits
Cinder Biscuits

Reputation: 5261

No can do. As per CMake's documentation:

CMake Generators are platform-specific so each may be available only on certain platforms. The cmake(1) command-line tool --help output lists available generators on the current platform.

Even if you built CMake yourself, you wouldn't be able to compile the Visual Studio generators because they rely on the Windows API.

Upvotes: 5

Related Questions