cmScanDepFormat: Use cmJSONState to parse P1689 output

This approach will be more portable.
This commit is contained in:
Tyler Yankee
2026-08-03 19:30:33 -04:00
parent 7e4e036531
commit afb609ce14

View File

@@ -10,7 +10,6 @@
#include <cm/string_view>
#include <cmext/string_view>
#include <cm3p/json/reader.h>
#include <cm3p/json/value.h>
#include <cm3p/json/writer.h>
@@ -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;
}
}