Describe the bug
vcpkg sets the cmake policy version to 3.7.2 on lines 40 and 878 of scripts/buildsystems/vcpkg.cmake
CMake 3.31 has deprecated policy versions <3.10 and will be removing them in the future, the correct mechanism here is to add a max version to the cmake_policy() call to indicate that vcpkg doesn't actually rely on these deprecated policy behaviors. Ideally this would be set to a modern version of CMake, but it is sufficient to set it to 3.10, ie cmake_policy(VERSION 3.7.2...3.10)
This is unrelated to the policy 0174 issue in #41999.
Full Disclosure: I'm a Kitware employee, happy to answer questions
Environment
OS: N/A
Compiler: N/A
CMake Version: 3.31
To Reproduce
Steps to reproduce the behavior:
./vcpkg install zlib
See error
Expected behavior
No warnings for deprecated cmake_policy() levels
Failure logs
CMake Deprecation Warning at build/Debug/_deps/vcpkg-src/scripts/buildsystems/vcpkg.cmake:40 (cmake_policy):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
build/Debug/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
CMakeLists.txt:5 (project)
...
CMake Deprecation Warning at build/Debug/_deps/vcpkg-src/scripts/buildsystems/vcpkg.cmake:878 (cmake_policy):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
build/Debug/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
CMakeLists.txt:5 (project)
Describe the bug vcpkg sets the cmake policy version to 3.7.2 on lines 40 and 878 of scripts/buildsystems/vcpkg.cmake
CMake 3.31 has deprecated policy versions <3.10 and will be removing them in the future, the correct mechanism here is to add a max version to the
cmake_policy()
call to indicate that vcpkg doesn't actually rely on these deprecated policy behaviors. Ideally this would be set to a modern version of CMake, but it is sufficient to set it to 3.10, iecmake_policy(VERSION 3.7.2...3.10)
This is unrelated to the policy 0174 issue in #41999.
Full Disclosure: I'm a Kitware employee, happy to answer questions
Environment
To Reproduce Steps to reproduce the behavior:
Expected behavior No warnings for deprecated
cmake_policy()
levelsFailure logs