owasp-modsecurity / owasp-modsecurity/ModSecurity
Windows build fails: yajl's Conan recipe sets CMP0026 OLD, incompatible with newer CMake
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.8k
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 1
Description
Summary
The Windows build (vcbuild.bat → Conan → yajl) fails deterministically on GitHub-hosted Windows runners that have picked up a newer Visual Studio/CMake toolchain. yajl/2.1.0's Conan Center recipe's CMakeLists.txt still does cmake_policy(SET CMP0026 OLD), and current CMake has dropped support for CMP0026's OLD behavior entirely, so cmake_policy() itself errors out before configuration can proceed.
Where this was found
Building ModSecurity-nginx's Windows CI job (.github/workflows/test_new.yml, build-windows), which invokes this repo's own Windows build via vcbuild.bat. Not caused by anything in ModSecurity-nginx — it fails inside owasp-modsecurity/ModSecurity's own dependency build step, so any downstream consumer building on an affected Windows toolchain would hit the same thing.
Evidence (from CI log)
yajl/2.1.0: Calling build()
yajl/2.1.0: Apply patch (conan): CMake: fix mingw, disable build of doc/test/perf/example, relocatable shared lib for macos, install DLL into bin folder
yajl/2.1.0: Running CMake.configure()
yajl/2.1.0: RUN: cmake -G "Visual Studio 18 2026" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/runneradmin/.conan2/p/b/yajla281b513a4897/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/runneradmin/.conan2/p/b/yajla281b513a4897/b/src"
CMake Error at CMakeLists.txt:17 (cmake_policy):
Policy CMP0026 may not be set to OLD behavior because this version of CMake
no longer supports it. The policy was introduced in CMake version 3.0.0,
and use of NEW behavior is now required.
Please either update your CMakeLists.txt files to conform to the new
behavior or use an older version of CMake that still supports the old
behavior. Run cmake --help-policy CMP0026 for more information.
Two further, likely-related errors appear later in the same yajl configure step once the policy issue is worked around/ignored:
CMake Error at reformatter/CMakeLists.txt:38 (GET_TARGET_PROPERTY):
The LOCATION property may not be read from target "json_reformat". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
CMake Error at verify/CMakeLists.txt:32 (GET_TARGET_PROPERTY):
The LOCATION property may not be read from target "json_verify". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
(GET_TARGET_PROPERTY ... LOCATION on a target is also removed/hard-errors under CMake's CMP0026 NEW behavior — consistent with the same root cause: yajl's bundled CMakeLists.txt predates CMake policies this old CMake no longer tolerates.)
The runner's cmake -G "Visual Studio 18 2026" generator string indicates the GitHub-hosted Windows image has moved to a VS2026-preview-class toolchain with a correspondingly newer bundled CMake.
Impact
- Deterministic, not flaky: every Windows build that reaches the yajl step on an affected toolchain fails the same way. Retrying does not help.
- Blocks Windows CI for any downstream project (e.g. ModSecurity-nginx) that builds libmodsecurity for Windows via this path.
Suggested fixes (any of)
- Pin/patch the yajl Conan recipe/version used by
vcbuild.batto one whoseCMakeLists.txtdoesn't rely onCMP0026 OLD(or pass a policy override / patch it out during the build). - Pin an explicit, known-compatible CMake version for the Windows build instead of relying on whatever the toolchain/runner provides.
- Consider the existing #3308 ("Drop YAJL dependency") as a longer-term fix that would sidestep this class of issue entirely.
Environment
- GitHub-hosted Windows runner (windows-2025 image at the time of writing)
- Conan 2.x,
yajl/2.1.0from conancenter - Observed via
owasp-modsecurity/ModSecurity-nginx'stest_new.ymlbuild-windowsjob
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vcbuild.bat and .github/workflows/test_new.yml, especially the build-windows job, to trace how Conan builds yajl/2.1.0. Inspect yajl's CMakeLists.txt plus reformatter/CMakeLists.txt and verify/CMakeLists.txt for the reported policy and LOCATION errors. Done means the affected Windows CI path configures and builds successfully with the current toolchain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, github-actions
- Domain
- build-system, ci-cd, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100