mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-09 08:40:11 -06:00
Compiler arguments coming from CC environment variables or multi-element CMAKE_<LANG>_COMPILER variables set by toolchain files were previously not exposed in the file API. Among other possible problems, this caused clients to determine wrong system include paths and built-in preprocessor macros by calling the compiler without these important arguments. This is fixed by adding an optional "commandFragment" attribute to the compiler description in the `toolchains` object, containing these arguments as a command line fragment. This is already the form in which they are internally stored in the CMAKE_<LANG>_COMPILER_ARG1 variable, so all that is required is adding this variable to the set of exported variables, besides some logic to omit it if empty. Issue: #22568
242 lines
6.8 KiB
JSON
242 lines
6.8 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "Schema for the CMake toolchains object kind",
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"version",
|
|
"toolchains"
|
|
],
|
|
"oneOf": [
|
|
{
|
|
"$ref": "#/definitions/toolchainsObjV1_0"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/toolchainsObjV1_1"
|
|
}
|
|
],
|
|
"definitions": {
|
|
"kind": {
|
|
"type": "string",
|
|
"const": "toolchains",
|
|
"description": "Specifies the object kind"
|
|
},
|
|
"versionV1_0": {
|
|
"type": "object",
|
|
"required": [
|
|
"major",
|
|
"minor"
|
|
],
|
|
"properties": {
|
|
"major": {
|
|
"type": "integer",
|
|
"const": 1
|
|
},
|
|
"minor": {
|
|
"type": "integer",
|
|
"const": 0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"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",
|
|
"items": {
|
|
"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"
|
|
},
|
|
"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": {
|
|
"language": {
|
|
"$ref": "#/definitions/language"
|
|
},
|
|
"compiler": {
|
|
"$ref": "#/definitions/compilerV1_0"
|
|
},
|
|
"sourceFileExtensions": {
|
|
"$ref": "#/definitions/sourceFileExtensions"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"toolchainsObjV1_1": {
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {
|
|
"$ref": "#/definitions/kind"
|
|
},
|
|
"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
|
|
}
|
|
}
|
|
}
|