Very first tutorial lesson does not work due to ZLIB
Tutorial from tutorial\consuming_packages\simple_cmake_project\ does not build with commands provided from first lesson in documentation I am trying to follow (https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html)
When I do conan install . --output-folder=build --build=missing, it finishes with "finished successfully" status, despite of two warnings
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: zlib/1.2.11
However next command which is cmake .. -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" fails with
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
I have changed required ZLIB version to 1.3.1 and now it works.
Hi @Nady93
Thanks for your report.
Can you please post the full output of conan install command? Is VS 15-2017 the one you have installed and want to use?
It is worth to mention, I have skipped specifying cmake generator, therefore it were using VS 2022 (only one I have installed)
Full output from conan install.
D:\Projects\VisualStudio\projects\conan>conan install . --output-folder=build --build=missing
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
======== Computing dependency graph ========
zlib/1.2.11: Not found in local cache, looking in remotes...
zlib/1.2.11: Checking remote: conancenter
zlib/1.2.11: Downloaded recipe revision fca992a7d96a1b92bd956caa8a97d18f
Graph root
conanfile.txt: D:\Projects\VisualStudio\projects\conan\conanfile.txt
Requirements
zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f - Downloaded (conancenter)
======== Computing necessary packages ========
Requirements
zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f:7bfde258ff4f62f75668d0896dbddedaa7480a0f#cbbc6789c50217b730b84a1dfe10d8a2 - Download (conancenter)
======== Installing packages ========
-------- Downloading 1 package --------
zlib/1.2.11: Retrieving package 7bfde258ff4f62f75668d0896dbddedaa7480a0f from remote 'conancenter'
zlib/1.2.11: Package installed 7bfde258ff4f62f75668d0896dbddedaa7480a0f
zlib/1.2.11: Downloaded package revision cbbc6789c50217b730b84a1dfe10d8a2
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated: 'cpp_info.names' used in: zlib/1.2.11
======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to D:\Projects\VisualStudio\projects\conan\build
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(ZLIB)
target_link_libraries(... ZLIB::ZLIB)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: CMakeToolchain: Preset 'conan-default' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-default
(cmake<3.23) cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
conanfile.txt: CMakeToolchain generated: D:\Projects\VisualStudio\projects\conan\build\CMakePresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully
D:\Projects\VisualStudio\projects\conan>
I am a bit confused, I honestly don't know what could be failing.
Could you please do the following too?
- Double check that no files from the example were changed (
git diff) - Post the full
cmake ...command that you are using and the full output of that command. - The
cmakeerror that you are sharing shows it is 3.28, but if you can also share the fullcmake --versionnumber, and I guess it was a pretty standard cmake installation? Or does your cmake have something special?