Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: bump zlib to v1.3, set CMAKE_MSVC_RUNTIME_LIBRARY
Since v1.3, zlib advertises compatibility with CMake 3.15 which introduced policy CMP0091 [1]. The NEW behavior is to to leave the MSVC runtime library selection flags out of the default CMAKE_<LANG>_FLAGS_<CONFIG> values and instead offer a first-class abstraction: MSVC_RUNTIME_LIBRARY [2]. CMP0091 is documented to default to the OLD behavior and not warn when unset. The zlib CMakeLists.txt does not set this policy. However, when building libfido2 as a static library targeting Win32, linking fails because our runtime selection flags for zlib have been replaced from under our feet (the MSVC_RUNTIME_LIBRARY property defaults to the dynamically linked runtime). Setting -DCMAKE_POLICY_DEFAULT_CMP0091=OLD [3] on the command line has no effect and CMake instead warns that the variable has been ignored. Manually modifying zlib's CMakeLists.txt to set the policy to OLD issues a deprecation warning but fixes our linking issues. The only remaining possibility that does not modify external files, is to explicitly set -DCMAKE_MSVC_RUNTIME_LIBRARY=... [4] on the command line. Setting it to an empty value does not work (Visual Studio generators may supposedly also override with _another_ default). Setting it to one of the allowed values corresponding to the selected build type resolves our linking issues. [1] https://cmake.org/cmake/help/latest/policy/CMP0091.html [2] https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html [3] https://cmake.org/cmake/help/latest/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.html [4] https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
- Loading branch information