Skip to content

cjson fails to build with CMake 4.0.3 #46589

@C-Holo-Krzysztof

Description

@C-Holo-Krzysztof

Baseline is 4f8fe05871555c1798dbcb1957d0d595e94f7b57, vcpkg version is 2025-04-01-9c604254140797833b6f76908435c9fcbf09920e.

I have CMake 4.0.3 installed on my system and I've made a sample setup with following commands:

mkdir testapp
cd testapp
vcpkg new --application
vcpkg add port cjson

Then when trying to run vcpkg install I get the following error:

Installing 1/1 cjson:x64-windows@1.7.18...
Building cjson:x64-windows@1.7.18...
C:\Users\KrzysztofLesiak\AppData\Local\vcpkg\registries\git-trees\dc5bbd0b7faf78acb68a65b06c0bc8bfdb0a7c2a: info: installing from git registry git+https://github.com/microsoft/vcpkg@dc5bbd0b7faf78acb68a65b06c0bc8bfdb0a7c2a
Downloading https://github.com/DaveGamble/cJSON/archive/v1.7.18.tar.gz -> DaveGamble-cJSON-v1.7.18.tar.gz
Successfully downloaded DaveGamble-cJSON-v1.7.18.tar.gz
-- Cleaning sources at D:/testapp/vcpkg_installed/vcpkg/blds/cjson/src/v1.7.18-66cc8df541.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/KrzysztofLesiak/AppData/Local/vcpkg/downloads/DaveGamble-cJSON-v1.7.18.tar.gz
-- Using source at D:/testapp/vcpkg_installed/vcpkg/blds/cjson/src/v1.7.18-66cc8df541.clean
-- Found external ninja('1.12.1').
-- Configuring x64-windows
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: "D:/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v
    Working Directory: D:/testapp/vcpkg_installed/vcpkg/blds/cjson/x64-windows-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      D:\testapp\vcpkg_installed\vcpkg\blds\cjson\config-x64-windows-dbg-CMakeCache.txt.log
      D:\testapp\vcpkg_installed\vcpkg\blds\cjson\config-x64-windows-rel-CMakeCache.txt.log
      D:\testapp\vcpkg_installed\vcpkg\blds\cjson\config-x64-windows-out.log

Call Stack (most recent call first):
  D:/testapp/vcpkg_installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:269 (vcpkg_execute_required_process)
  C:/Users/KrzysztofLesiak/AppData/Local/vcpkg/registries/git-trees/dc5bbd0b7faf78acb68a65b06c0bc8bfdb0a7c2a/portfile.cmake:23 (vcpkg_cmake_configure)
  scripts/ports.cmake:203 (include)


error: building cjson:x64-windows failed with: BUILD_FAILED

Looking inside the config-x64-windows-out.log file I see the following:

CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.


-- Configuring incomplete, errors occurred!

Setting CMAKE_POLICY_VERSION_MINIMUM to 3.5 as an environment variable doesn't seem to do anything.

Edit: looks like this is a known upstream issue that has an open PR, but looks like it's not getting merged anytime soon: DaveGamble/cJSON#935
Is it possible/desirable to patch this on the vcpkg side?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions