admin管理员组

文章数量:1193357

I'd like to compile (using MSVC 2022) some third party project (fteqw) that depends on zlib library. First to generate a solution to open in MSVC i'm using the cmake from the Visual Studio 2022 Developer Command Prompt. I'm getting an error:

The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZLIB_LIBRARY
    linked by target "qtv" in directory D:/Pobrane/fteqw-master

I guess the zlib library is just missing. The question is there a way to install zlib package from Visual Studio 2022 Developer Command Prompt like on Linux system using apt-get, yum, etc.?

I'd like to compile (using MSVC 2022) some third party project (fteqw) that depends on zlib library. First to generate a solution to open in MSVC i'm using the cmake from the Visual Studio 2022 Developer Command Prompt. I'm getting an error:

The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZLIB_LIBRARY
    linked by target "qtv" in directory D:/Pobrane/fteqw-master

I guess the zlib library is just missing. The question is there a way to install zlib package from Visual Studio 2022 Developer Command Prompt like on Linux system using apt-get, yum, etc.?

Share Improve this question asked Jan 23 at 16:00 AlmondPuddingAlmondPudding 391 silver badge5 bronze badges 2
  • here you are : developers.lseg.com/en/article-catalog/article/… – R.F. Commented Jan 23 at 17:03
  • vcpkg is also a good option to obtain the zlib, and SDL2 dependencies. I am not sure if there are more. I glanced over the CMakeLists.txt for only a minute or so this morning when this question was in the Staging Ground. Edit: https://github.com/fte-team/fteqw/blob/master/CMakeLists.txt looks like there are several other dependencies, like OpenGL, jpeg, bzip2, freetype, vulkan ... I am not sure if these are hard dependencies or optional. With that said vcpkg could provide them all. – drescherjm Commented Jan 23 at 17:06
Add a comment  | 

2 Answers 2

Reset to default 1

Make sure vcpkg is installed in Visual Studio Installer. Use command vcpkg install zlib.

Install In classic mode, run the following vcpkg command:
vcpkg install zlib

In manifest mode, run the following vcpkg command in your project directory:

vcpkg add port zlib

Reference: vcpkg in CMake projects

Use vcpkg

Another method (lower level and also more complicated) would be to:

  • Download ZLib from [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/ZLib /v1

  • Unpack the .zip file locally (in "C:\Program Files")

  • When invoking CMake, pass e.g.: -DZLIB_ROOT=C:\Program Files\ZLib\ZLib\1.3.1 (besides all other flags that you might have). It should pick it up from there

    • If you want to include it in a VStudio project directly, check [SO]: building DLL based on libzip-static.lib (@CristiFati's answer)

本文标签: cInstall zlib library on Windows for MSVCStack Overflow