libzt icon indicating copy to clipboard operation
libzt copied to clipboard

Fix compilation in Visual Studio CMake projects

Open StephenCWills opened this issue 4 years ago • 0 comments

When building the DevilutionX codebase using Visual Studio (CMake Ninja generator) against the latest version of libzt, I get the following error.

>------ Build All started: Project: devilutionX, Configuration: x64-Debug ------
T:\staphen\Projects\devilutionX\build\x64-Debug\ninja : error : '/WS2_32.Lib', needed by 'devilutionx.exe', missing and no known rule to make it

Build All failed.

Thanks to the log messages in CMakeLists.txt, the cause can be easily observed by reviewing the CMake output: WINLIBDIR is empty.

1> [CMake] -- 
1> [CMake] -- WS2_32=/WS2_32.Lib
1> [CMake] -- ShLwApi=/ShLwApi.Lib
1> [CMake] -- liphlpapi=/iphlpapi.Lib

Furthermore, the path that was supposed to be used to reference these libraries does not even exist on my Windows 10 system. My Windows Kits lib version is 10.0.19041.0.

From what I've been able to tell using both MSVC and MinGW, there is no need to specify the full path for these libraries when compiling for Windows. Also, linking them by name does not seem to have any effect on the documented build process in the README.

StephenCWills avatar Dec 27 '21 23:12 StephenCWills