1

in the new version of putty there is no Makefile.vc or project file for visual studio. How can I compile putty under visual studio 2019? can someone help me?

link to zipped source

I tried to open the windows folder in visual studio with the following error:

Severity Code Description Project File Line Suppression State
Error CMake Error at C:\Usersuser\Downloads\Compressed\putty-src\windows\CMakeLists.txt:3 (add_sources_from_current_dir):
   Unknown CMake command "add_sources_from_current_dir". C:\Users\user\Downloads\Compressed\putty-src\windows\CMakeLists.txt 3
Scott Hunter
  • 48,888
  • 12
  • 60
  • 101

1 Answers1

0

You don't need to open Visual Studio or any IDE to compile the executables.

  • Download cmake and make sure Visual C compiler is installed.

  • Unzip the .zip file, open a command prompt where the readme and CMakeLists.txt reside

  • Then, as the readme states:

run these commands in the source directory:

cmake .
cmake --build .

In the Debug directory, you'll find a lot of .exe files.

Then, to install in the simplest way on Linux or Mac:

 cmake --build . --target install

I didn't need that part. I suppose that it copies the executables & other files somewhere in the path.

Problem with creating a distro using Microsoft compiler is that the executables then require a lot of Microsoft runtime DLLs. For instance if you deploy the executables on other machines it may not work.

An alternative is to use gcc and make to build the executables.

First:

  • install a recent gcc for windows
  • install make

Installing a recent MinGW distribution should do it. Personally I used another gcc distribution so I had to grab make too.

Now, I followed Setting default compiler in CMake, the key part being to enable mingw makefiles: -G "MinGW Makefiles", else cmake ignores your compiler requirements and keeps on using Microsoft compiler.

cmake -DCMAKE_MAKE_PROGRAM=/path/to/make/make.exe -DCMAKE_C_COMPILER=/path/to/gcc/gcc.exe -G "MinGW Makefiles" .

Note that specifying full paths require that / are used. Backslashes conflict with escaping in cmake/make files.

Then

cmake --build .
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219