Merge topic 'fileapi-compilerargs'

71a4e34d97 fileAPI: Expose CMAKE_<LANG>_COMPILER_ARG1
1e02926c9a fileAPI: Refactor toolchains schema to prepare for new version
3caa572c05 fileAPI: Output more info for test failures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11419
This commit is contained in:
Craig Scott
2025-12-02 21:27:16 +00:00
committed by Kitware Robot
9 changed files with 266 additions and 100 deletions
+12 -1
View File
@@ -2109,12 +2109,13 @@ There is only one ``toolchains`` object major version, version 1.
{
"kind": "toolchains",
"version": { "major": 1, "minor": 0 },
"version": { "major": 1, "minor": 1 },
"toolchains": [
{
"language": "C",
"compiler": {
"path": "/usr/bin/cc",
"commandFragment": "--config x86_64-linux-gnu.cfg",
"id": "GNU",
"version": "9.3.0",
"implicit": {
@@ -2193,6 +2194,16 @@ The members specific to ``toolchains`` objects are:
:variable:`CMAKE_<LANG>_COMPILER` variable is defined for the current
language. Its value is a JSON string holding the path to the compiler.
``commandFragment``
Optional member that is present when the
:variable:`CMAKE_<LANG>_COMPILER` variable is a list containing multiple
elements or the :envvar:`CC` or similar environment variable contains
command line arguments after the compiler executable.
Its value is a JSON string holding the second and further elements
(mandatory arguments to the compiler) as a command line fragment.
This field was added in toolchains version 1.1.
``id``
Optional member that is present when the
:variable:`CMAKE_<LANG>_COMPILER_ID` variable is defined for the current
+196 -72
View File
@@ -7,13 +7,21 @@
"version",
"toolchains"
],
"properties": {
"oneOf": [
{
"$ref": "#/definitions/toolchainsObjV1_0"
},
{
"$ref": "#/definitions/toolchainsObjV1_1"
}
],
"definitions": {
"kind": {
"type": "string",
"const": "toolchains",
"description": "Specifies the object kind"
},
"version": {
"versionV1_0": {
"type": "object",
"required": [
"major",
@@ -31,87 +39,203 @@
},
"additionalProperties": false
},
"toolchains": {
"versionV1_1": {
"type": "object",
"required": [
"major",
"minor"
],
"properties": {
"major": {
"type": "integer",
"const": 1
},
"minor": {
"type": "integer",
"const": 1
}
},
"additionalProperties": false
},
"language": {
"type": "string",
"description": "Toolchain language identifier (e.g. C, CXX)"
},
"sourceFileExtensions": {
"type": "array",
"description": "Array of toolchain configurations per language",
"items": {
"type": "object",
"required": [
"language",
"compiler"
],
"properties": {
"language": {
"type": "string",
"description": "Toolchain language identifier (e.g. C, CXX)"
"type": "string"
},
"description": "List of source file extensions (without leading dot) supported by this toolchain"
},
"compilerPath": {
"type": "string",
"description": "Path to the compiler executable. This is present when the CMAKE_<LANG>_COMPILER variable is defined."
},
"compilerCommandFragment": {
"type": "string",
"description": "Mandatory arguments to the compiler, as a command line fragment. This is present when the CMAKE_<LANG>_COMPILER variable is a list containing multiple elements or the CC or similar environment variable contains command line arguments."
},
"compilerId": {
"type": "string",
"description": "Compiler identifier (e.g. GNU, MSVC). This is present when the CMAKE_<LANG>_COMPILER_ID variable is defined."
},
"compilerVersion": {
"type": "string",
"description": "Version of the compiler. This is present when the CMAKE_<LANG>_COMPILER_VERSION variable is defined."
},
"compilerTarget": {
"type": "string",
"description": "Cross-compiling target of the compiler. This is present when the CMAKE_<LANG>_COMPILER_TARGET variable is defined."
},
"compilerImplicit": {
"type": "object",
"properties": {
"includeDirectories": {
"type": "array",
"items": {
"type": "string"
},
"compiler": {
"description": "List of implicit include directories for the compiler. This is present when the CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES variable is defined."
},
"linkDirectories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link directories for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES variable is defined."
},
"linkFrameworkDirectories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link framework directories for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_FRAMEWORK_DIRECTORIES variable is defined."
},
"linkLibraries": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link libraries for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES variable is defined."
}
},
"additionalProperties": false
},
"compilerV1_0": {
"type": "object",
"properties": {
"path": {
"$ref": "#/definitions/compilerPath"
},
"id": {
"$ref": "#/definitions/compilerId"
},
"version": {
"$ref": "#/definitions/compilerVersion"
},
"target": {
"$ref": "#/definitions/compilerTarget"
},
"implicit": {
"$ref": "#/definitions/compilerImplicit"
}
},
"additionalProperties": false
},
"compilerV1_1": {
"type": "object",
"properties": {
"path": {
"$ref": "#/definitions/compilerPath"
},
"commandFragment": {
"$ref": "#/definitions/compilerCommandFragment"
},
"id": {
"$ref": "#/definitions/compilerId"
},
"version": {
"$ref": "#/definitions/compilerVersion"
},
"target": {
"$ref": "#/definitions/compilerTarget"
},
"implicit": {
"$ref": "#/definitions/compilerImplicit"
}
},
"additionalProperties": false
},
"toolchainsObjV1_0": {
"type": "object",
"properties": {
"kind": {
"$ref": "#/definitions/kind"
},
"version": {
"$ref": "#/definitions/versionV1_0"
},
"toolchains": {
"type": "array",
"description": "Array of toolchain configurations per language",
"items": {
"type": "object",
"required": [
"language",
"compiler"
],
"properties": {
"path": {
"type": "string",
"description": "Path to the compiler executable. This is present when the CMAKE_<LANG>_COMPILER variable is defined."
"language": {
"$ref": "#/definitions/language"
},
"id": {
"type": "string",
"description": "Compiler identifier (e.g. GNU, MSVC). This is present when the CMAKE_<LANG>_COMPILER_ID variable is defined."
"compiler": {
"$ref": "#/definitions/compilerV1_0"
},
"version": {
"type": "string",
"description": "Version of the compiler. This is present when the CMAKE_<LANG>_COMPILER_VERSION variable is defined."
},
"target": {
"type": "string",
"description": "Cross-compiling target of the compiler. This is present when the CMAKE_<LANG>_COMPILER_TARGET variable is defined."
},
"implicit": {
"type": "object",
"properties": {
"includeDirectories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit include directories for the compiler. This is present when the CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES variable is defined."
},
"linkDirectories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link directories for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES variable is defined."
},
"linkFrameworkDirectories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link framework directories for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_FRAMEWORK_DIRECTORIES variable is defined."
},
"linkLibraries": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of implicit link libraries for the compiler front end. This is present when the CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES variable is defined."
}
},
"additionalProperties": false
"sourceFileExtensions": {
"$ref": "#/definitions/sourceFileExtensions"
}
},
"additionalProperties": false
},
"sourceFileExtensions": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of source file extensions (without leading dot) supported by this toolchain"
}
}
},
"additionalProperties": false
},
"toolchainsObjV1_1": {
"type": "object",
"properties": {
"kind": {
"$ref": "#/definitions/kind"
},
"additionalProperties": false
}
"version": {
"$ref": "#/definitions/versionV1_1"
},
"toolchains": {
"type": "array",
"description": "Array of toolchain configurations per language",
"items": {
"type": "object",
"required": [
"language",
"compiler"
],
"properties": {
"language": {
"$ref": "#/definitions/language"
},
"compiler": {
"$ref": "#/definitions/compilerV1_1"
},
"sourceFileExtensions": {
"$ref": "#/definitions/sourceFileExtensions"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
}