From afb609ce148a67a659686f2f2bdd93e92156746d Mon Sep 17 00:00:00 2001 From: Tyler Yankee Date: Mon, 3 Aug 2026 19:30:33 -0400 Subject: [PATCH] cmScanDepFormat: Use cmJSONState to parse P1689 output This approach will be more portable. --- Source/cmScanDepFormat.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx index 00165447e9..f9d91f6b2f 100644 --- a/Source/cmScanDepFormat.cxx +++ b/Source/cmScanDepFormat.cxx @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -18,6 +17,7 @@ #include "cmsys/String.h" #include "cmGeneratedFileStream.h" +#include "cmJSONState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -85,13 +85,11 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, { Json::Value ppio; Json::Value const& ppi = ppio; - cmsys::ifstream ppf(arg_pp.c_str(), std::ios::in | std::ios::binary); { - Json::Reader reader; - if (!reader.parse(ppf, ppio, false)) { + cmJSONState parseState(arg_pp, &ppio); + if (!parseState.errors.empty()) { cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep failed to parse ", - arg_pp, - reader.getFormattedErrorMessages())); + arg_pp, parseState.GetErrorMessage())); return false; } }