mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
CMakePresets.json: Remove undocumented support for comments
Fixes: #21858
This commit is contained in:
@@ -409,7 +409,6 @@ Changes made since CMake 3.19.0 include the following.
|
|||||||
:generator:`Visual Studio 14 2015` generator. It has now been fixed to
|
:generator:`Visual Studio 14 2015` generator. It has now been fixed to
|
||||||
work with :ref:`Visual Studio Generators` for later VS versions too.
|
work with :ref:`Visual Studio Generators` for later VS versions too.
|
||||||
|
|
||||||
|
|
||||||
3.19.5
|
3.19.5
|
||||||
------
|
------
|
||||||
|
|
||||||
@@ -425,3 +424,11 @@ Changes made since CMake 3.19.0 include the following.
|
|||||||
*Link Binaries With Libraries* build phase broke the ability to switch
|
*Link Binaries With Libraries* build phase broke the ability to switch
|
||||||
between device and simulator builds without reconfiguring. That capability
|
between device and simulator builds without reconfiguring. That capability
|
||||||
has now been restored.
|
has now been restored.
|
||||||
|
|
||||||
|
3.19.6
|
||||||
|
------
|
||||||
|
|
||||||
|
* The :manual:`cmake-presets(7)` feature no longer allows comments in
|
||||||
|
``CMakePresets.json`` or ``CMakeUserPresets.json`` files.
|
||||||
|
This was mistakenly allowed by the implementation in CMake 3.19.0 through
|
||||||
|
CMake 3.19.5, and was not documented.
|
||||||
|
@@ -839,6 +839,7 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile(
|
|||||||
|
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::CharReaderBuilder builder;
|
Json::CharReaderBuilder builder;
|
||||||
|
Json::CharReaderBuilder::strictMode(&builder.settings_);
|
||||||
if (!Json::parseFromStream(builder, fin, &root, nullptr)) {
|
if (!Json::parseFromStream(builder, fin, &root, nullptr)) {
|
||||||
return ReadFileResult::JSON_PARSE_ERROR;
|
return ReadFileResult::JSON_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
/*
|
|
||||||
* Block comment
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
// Inline comment
|
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"cmakeMinimumRequired": {
|
"cmakeMinimumRequired": {
|
||||||
"major": 3,
|
"major": 3,
|
||||||
|
1
Tests/RunCMake/CMakePresets/Comment-result.txt
Normal file
1
Tests/RunCMake/CMakePresets/Comment-result.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
2
Tests/RunCMake/CMakePresets/Comment-stderr.txt
Normal file
2
Tests/RunCMake/CMakePresets/Comment-stderr.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
^CMake Error: Could not read presets from [^
|
||||||
|
]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$
|
11
Tests/RunCMake/CMakePresets/Comment.json.in
Normal file
11
Tests/RunCMake/CMakePresets/Comment.json.in
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Comment
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "Comment",
|
||||||
|
"generator": "@RunCMake_GENERATOR@",
|
||||||
|
"binaryDir": "${sourceDir}/build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -77,6 +77,7 @@ endfunction()
|
|||||||
# Test CMakePresets.json errors
|
# Test CMakePresets.json errors
|
||||||
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
|
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
|
||||||
run_cmake_presets(NoCMakePresets)
|
run_cmake_presets(NoCMakePresets)
|
||||||
|
run_cmake_presets(Comment)
|
||||||
run_cmake_presets(JSONParseError)
|
run_cmake_presets(JSONParseError)
|
||||||
run_cmake_presets(InvalidRoot)
|
run_cmake_presets(InvalidRoot)
|
||||||
run_cmake_presets(NoVersion)
|
run_cmake_presets(NoVersion)
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import jsmin
|
|
||||||
import json
|
import json
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import os.path
|
import os.path
|
||||||
@@ -6,7 +5,7 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
with open(sys.argv[1], "rb") as f:
|
with open(sys.argv[1], "rb") as f:
|
||||||
contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig")))
|
contents = json.loads(f.read().decode("utf-8-sig"))
|
||||||
|
|
||||||
schema_file = os.path.join(
|
schema_file = os.path.join(
|
||||||
os.path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
|
Reference in New Issue
Block a user