diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst index 163c5f890f..26a8db7065 100644 --- a/Help/manual/cmake-file-api.7.rst +++ b/Help/manual/cmake-file-api.7.rst @@ -1712,6 +1712,31 @@ with members: file set; see also policy :policy:`CMP0211`. The value is an array of unsigned integer 0-based indexes into the ``fileSets`` array. +``interfaceIncludes`` + .. codemodel-versionadded:: 2.12 + + An optional member that is present when the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` + property is set on a target. Note that non-private ``HEADERS`` file sets + automatically populate this property. + + The value is a JSON array with an entry for each directory. + Transitive usage requirements from dependencies are not included. + Each entry is a JSON object with members: + + ``path`` + A string specifying the path to the include directory, + represented with forward slashes. + + ``isSystem`` + Optional member that is present with boolean value ``true`` if + the include directory is marked as a system include directory. + + ``backtrace`` + Optional member that is present when a CMake language backtrace to + the command invocation that added this include directory is available. + The value is an unsigned integer 0-based index into the + ``backtraceGraph`` member's ``nodes`` array. + ``sourceGroups`` Optional member that is present when sources are grouped together by the :command:`source_group` command or by default. The value is a diff --git a/Help/manual/file_api/schema_target.json b/Help/manual/file_api/schema_target.json index 6a05fd2f71..90a327d216 100644 --- a/Help/manual/file_api/schema_target.json +++ b/Help/manual/file_api/schema_target.json @@ -37,6 +37,9 @@ }, { "$ref": "#/definitions/codemodelV2_11" + }, + { + "$ref": "#/definitions/codemodelV2_12" } ], "definitions": { @@ -89,7 +92,25 @@ }, "minor": { "type": "integer", - "minimum": 11 + "const": 11 + } + }, + "additionalProperties": false + }, + "codemodelVersionV2_12": { + "type": "object", + "required": [ + "major", + "minor" + ], + "properties": { + "major": { + "type": "integer", + "const": 2 + }, + "minor": { + "type": "integer", + "minimum": 12 } }, "additionalProperties": false @@ -866,6 +887,31 @@ "additionalProperties": false } }, + "interfaceIncludes": { + "type": "array", + "items": { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "type": "string", + "description": "Include directory path" + }, + "isSystem": { + "type": "boolean", + "description": "True if the path is a system include directory" + }, + "backtrace": { + "type": "integer", + "minimum": 0, + "description": "Index into backtraceGraph nodes array for the command that added the include directory, if available" + } + }, + "additionalProperties": false + } + }, "compileGroupsSourceIndexes": { "type": "array", "items": { @@ -2015,6 +2061,119 @@ } }, "additionalProperties": false + }, + "codemodelV2_12": { + "required": [ + "codemodelVersion", + "name", + "id", + "type", + "paths", + "sources", + "backtraceGraph" + ], + "properties": { + "codemodelVersion": { + "$ref": "#/definitions/codemodelVersionV2_12" + }, + "name": { + "$ref": "#/definitions/name" + }, + "id": { + "$ref": "#/definitions/id" + }, + "type": { + "$ref": "#/definitions/target-typeV2_9" + }, + "imported": { + "$ref": "#/definitions/importedV2_9" + }, + "local": { + "$ref": "#/definitions/localV2_9" + }, + "abstract": { + "$ref": "#/definitions/abstractV2_9" + }, + "backtrace": { + "$ref": "#/definitions/backtrace" + }, + "folder": { + "$ref": "#/definitions/folder" + }, + "paths": { + "$ref": "#/definitions/paths" + }, + "nameOnDisk": { + "$ref": "#/definitions/nameOnDisk" + }, + "artifacts": { + "$ref": "#/definitions/artifacts" + }, + "isGeneratorProvided": { + "$ref": "#/definitions/isGeneratorProvided" + }, + "install": { + "$ref": "#/definitions/install" + }, + "launchers": { + "$ref": "#/definitions/launchersV2_7" + }, + "link": { + "$ref": "#/definitions/link" + }, + "archive": { + "$ref": "#/definitions/archive" + }, + "debugger": { + "$ref": "#/definitions/debuggerV2_8" + }, + "dependencies": { + "$ref": "#/definitions/dependencies" + }, + "linkLibraries": { + "$ref": "#/definitions/linkLibrariesV2_9" + }, + "interfaceLinkLibraries": { + "$ref": "#/definitions/interfaceLinkLibrariesV2_9" + }, + "compileDependencies": { + "$ref": "#/definitions/compileDependenciesV2_9" + }, + "interfaceCompileDependencies": { + "$ref": "#/definitions/interfaceCompileDependenciesV2_9" + }, + "objectDependencies": { + "$ref": "#/definitions/onlyTargetDependenciesArrayV2_9" + }, + "orderDependencies": { + "$ref": "#/definitions/onlyTargetDependenciesArrayV2_9" + }, + "fileSets": { + "$ref": "#/definitions/fileSetsV2_11" + }, + "interfaceIncludes": { + "$ref": "#/definitions/interfaceIncludes" + }, + "sources": { + "$ref": "#/definitions/sourcesV2_11" + }, + "interfaceSources": { + "$ref": "#/definitions/interfaceSourcesV2_11" + }, + "symbolic": { + "$ref": "#/definitions/symbolicV2_9" + }, + "sourceGroups": { + "$ref": "#/definitions/sourceGroupsV2_10" + }, + "compileGroups": { + "$ref": "#/definitions/compileGroupsV2_6" + }, + "backtraceGraph": { + "$ref": "#/definitions/backtraceGraph" + } + }, + "additionalProperties": false } } } diff --git a/Help/release/dev/fileapi-interface-includes.rst b/Help/release/dev/fileapi-interface-includes.rst new file mode 100644 index 0000000000..4564065cdb --- /dev/null +++ b/Help/release/dev/fileapi-interface-includes.rst @@ -0,0 +1,8 @@ +file-api-interface-includes +--------------------------- + +* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has + been updated to 2.12. + +* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object gained + a new ``interfaceIncludes`` array field. diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 6fb9b4b7ac..55be1e9aa1 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -798,7 +798,7 @@ std::string cmFileAPI::NoSupportedVersion( // Update the following files as well when updating this constant: // Help/manual/cmake-file-api.7.rst // Tests/RunCMake/FileAPI/codemodel-v2-check.py (check_objects()) -static unsigned int const CodeModelV2Minor = 11; +static unsigned int const CodeModelV2Minor = 12; void cmFileAPI::BuildClientRequestCodeModel( ClientRequest& r, std::vector const& versions) diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 039d6915a4..655dbeddcd 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -511,6 +511,7 @@ class Target Json::Value DumpSources(FileSetDatabase const& fsdb); Json::Value DumpSource(cmGeneratorTarget::SourceAndKind const& sk, Json::ArrayIndex si, FileSetDatabase const& fsdb); + Json::Value DumpInterfaceIncludes(); Json::Value DumpInterfaceSources(FileSetDatabase const& fsdb); Json::Value DumpInterfaceSource(std::string path, Json::ArrayIndex si, FileSetDatabase const& fsdb); @@ -1381,6 +1382,11 @@ Json::Value Target::Dump() target["interfaceSources"] = std::move(interfaceSources); } + auto interfaceIncludes = this->DumpInterfaceIncludes(); + if (!interfaceIncludes.empty()) { + target["interfaceIncludes"] = std::move(interfaceIncludes); + } + Json::Value folder = this->DumpFolder(); if (!folder.isNull()) { target["folder"] = std::move(folder); @@ -1997,6 +2003,48 @@ Json::Value Target::DumpInterfaceSources(FileSetDatabase const& fsdb) return interfaceSources; } +Json::Value Target::DumpInterfaceIncludes() +{ + Json::Value interfaceIncludes = Json::arrayValue; + + std::set systemIncludes; + cmValue systemIncludesProp = + this->GT->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"); + if (systemIncludesProp) { + cmList includes{ cmGeneratorExpression::Evaluate( + *systemIncludesProp, this->GT->GetLocalGenerator(), this->Config, + this->GT) }; + for (std::string include : includes) { + cmSystemTools::ConvertToUnixSlashes(include); + systemIncludes.emplace(std::move(include)); + } + } + + cmValue prop = this->GT->GetProperty("INTERFACE_INCLUDE_DIRECTORIES"); + if (prop) { + cmList includes{ cmGeneratorExpression::Evaluate( + *prop, this->GT->GetLocalGenerator(), this->Config, this->GT) }; + + bool const targetTreatsOwnIncludesAsSystem = + this->GT->GetPropertyAsBool("SYSTEM") && + (!this->GT->IsImported() || + !this->GT->GetPropertyAsBool("IMPORTED_NO_SYSTEM")); + + for (std::string include : includes) { + cmSystemTools::ConvertToUnixSlashes(include); + + bool const isSystem = targetTreatsOwnIncludesAsSystem || + systemIncludes.find(include) != systemIncludes.end(); + + JBT path(include); + interfaceIncludes.append( + this->DumpInclude({ std::move(path), isSystem })); + } + } + + return interfaceIncludes; +} + Json::Value Target::DumpInterfaceSource(std::string path, Json::ArrayIndex si, FileSetDatabase const& fsdb) { diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index d90b3453b1..e8359fdfc4 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"debugger":(true|false),"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":11}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":1}]},{"kind":"toolchains","version":\[{"major":1,"minor":1}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ +^{"debugger":(true|false),"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":12}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":1}]},{"kind":"toolchains","version":\[{"major":1,"minor":1}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index d5fafdcaf1..0a828c20e8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -13,7 +13,7 @@ def check_objects(o, g): assert is_list(o) assert len(o) == 1 major = 2 - minor = 11 + minor = 12 check_index_object(o[0], "codemodel", major, minor, check_object_codemodel(g, major, minor)) def check_backtrace(t, b, backtrace): @@ -323,6 +323,9 @@ def check_target(c, major, minor): assert is_list(obj["interfaceSources"]) assert len(obj["interfaceSources"]) == len(expected["interfaceSources"]) + if expected.get("interfaceIncludes") is not None: + expected_keys.append("interfaceIncludes") + assert is_dict(obj["paths"]) assert sorted(obj["paths"].keys()) == ["build", "source"] assert matches(obj["paths"]["build"], expected["build"]) @@ -903,6 +906,26 @@ def check_target(c, major, minor): missing_exception=lambda e: "Compile group: %s" % e["language"], extra_exception=lambda a: "Compile group: %s" % a["language"]) + if expected.get("interfaceIncludes") is not None: + def check_interface_include(actual, expected): + assert is_dict(actual) + expected_keys = ["path"] + + assert matches(actual["path"], expected["path"]) + + if expected["isSystem"] is not None: + expected_keys.append("isSystem") + assert is_bool(actual["isSystem"], expected["isSystem"]) + + assert sorted(actual.keys()) == sorted(expected_keys) + + check_list_match(lambda a, e: matches(a["path"], e["path"]), + obj["interfaceIncludes"], expected["interfaceIncludes"], + check=check_interface_include, + check_exception=lambda a, e: "Interface include: %s" % a["path"], + missing_exception=lambda e: "Interface include: %s" % e["path"], + extra_exception=lambda a: "Interface include: %s" % a["path"]) + assert sorted(obj.keys()) == sorted(expected_keys) return _check diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index 6dd03a6ac2..d3d7e7c418 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -45,7 +45,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 39, + "line": 45, "command": "install", "hasParent": true }, @@ -75,7 +75,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 42, + "line": 48, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index 6c85fa1c1f..da4c64cd62 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -55,7 +55,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 52, + "line": 55, "command": "install", "hasParent": true }, @@ -100,7 +100,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -148,7 +148,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -193,7 +193,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -237,7 +237,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -281,7 +281,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 60, + "line": 63, "command": "install", "hasParent": true }, @@ -328,7 +328,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 62, + "line": 65, "command": "install", "hasParent": true }, @@ -373,7 +373,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 63, + "line": 66, "command": "install", "hasParent": true }, @@ -422,7 +422,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 64, + "line": 67, "command": "install", "hasParent": true }, @@ -474,7 +474,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 65, + "line": 68, "command": "install", "hasParent": true }, @@ -523,7 +523,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 66, + "line": 69, "command": "install", "hasParent": true }, @@ -565,7 +565,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 67, + "line": 70, "command": "install", "hasParent": true }, @@ -607,7 +607,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 68, + "line": 71, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json index f1000f84d3..6e54d526cf 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 13, + "line": 16, "command": "add_executable", "hasParent": true }, @@ -77,7 +77,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 13, + "line": 16, "command": "add_executable", "hasParent": true }, @@ -127,7 +127,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 14, + "line": 17, "command": "target_link_libraries", "hasParent": true }, @@ -163,7 +163,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 14, + "line": 17, "command": "target_link_libraries", "hasParent": true }, @@ -196,7 +196,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 14, + "line": 17, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json index 38c78cd2f5..1e6dbf5968 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json @@ -226,6 +226,20 @@ ] } ], + "interfaceIncludes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset$", + "isSystem": null + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset$", + "isSystem": null + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset/dir$", + "isSystem": null + } + ], "interfaceSources": [ { "path": "^fileset/error\\.c$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json index 996ef72158..9ad5dea17b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json @@ -44,6 +44,12 @@ ] } ], + "interfaceIncludes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset$", + "isSystem": null + } + ], "interfaceSources": [ { "path": "^fileset/h1\\.h$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json index b5422f54c1..3ca5b33825 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 12, + "line": 15, "command": "add_library", "hasParent": true }, @@ -77,7 +77,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 12, + "line": 15, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json index 65d294a181..fc28be3874 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 18, + "line": 21, "command": "add_executable", "hasParent": true }, @@ -77,7 +77,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 18, + "line": 21, "command": "add_executable", "hasParent": true }, @@ -127,7 +127,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 19, + "line": 22, "command": "target_link_libraries", "hasParent": true }, @@ -163,7 +163,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 19, + "line": 22, "command": "target_link_libraries", "hasParent": true }, @@ -196,7 +196,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 19, + "line": 22, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index eef8899e01..6e691b5966 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 17, + "line": 20, "command": "add_library", "hasParent": true }, @@ -85,7 +85,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 17, + "line": 20, "command": "add_library", "hasParent": true }, @@ -134,7 +134,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -164,7 +164,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -194,7 +194,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 60, + "line": 63, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json index b11671ce4a..0349a4d17c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 22, + "line": 25, "command": "add_executable", "hasParent": true }, @@ -77,7 +77,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 22, + "line": 25, "command": "add_executable", "hasParent": true }, @@ -127,7 +127,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 23, + "line": 26, "command": "target_link_libraries", "hasParent": true }, @@ -163,7 +163,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 23, + "line": 26, "command": "target_link_libraries", "hasParent": true }, @@ -196,7 +196,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 23, + "line": 26, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json index 8ccc381ec4..789ee52ca5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json @@ -21,7 +21,7 @@ [ { "file": "^codemodel-v2\\.cmake$", - "line": 21, + "line": 24, "command": "add_library", "hasParent": true }, @@ -77,7 +77,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 21, + "line": 24, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json index 4354dfb2b4..4b67193193 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -101,7 +101,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 25, + "line": 28, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index cc1e36c56f..3e47df3036 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -152,7 +152,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 52, + "line": 55, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index 8c9306e42a..45782c39fa 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -110,7 +110,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -140,7 +140,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, @@ -170,7 +170,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 60, + "line": 63, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json index 3a0903d474..8b62e56d25 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json @@ -9,9 +9,35 @@ "abstract": true, "symbolic": null, "isGeneratorProvided": null, - "fileSets": null, + "fileSets": [ + { + "name": "HEADERS", + "type": "HEADERS", + "visibility": "INTERFACE", + "baseDirectories": [ + "^imported/\\.\\.$" + ] + } + ], "sources": [], - "interfaceSources": null, + "interfaceIncludes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/imported$", + "isSystem": true + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/imported/\\.\\.$", + "isSystem": true + } + ], + "interfaceSources": [ + { + "path": "^empty\\.h$", + "isGenerated": null, + "fileSetNames": ["HEADERS"], + "sourceGroupName": "Header Files" + } + ], "sourceGroups": null, "compileGroups": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_symbolic_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_symbolic_lib.json index db6029ab7b..e7142cfc64 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_symbolic_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_symbolic_lib.json @@ -17,7 +17,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 35, + "line": 41, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json index b7ea263a67..39a755e780 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -75,7 +75,92 @@ "sourcePaths": [ "^empty\\.c$" ], - "includes": null, + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI$", + "isSystem": null, + "backtrace": [ + { + "file": "^include_test\\.cmake$", + "line": 4, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^include_test\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": 10, + "command": "include", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/dir$", + "isSystem": true, + "backtrace": [ + { + "file": "^include_test\\.cmake$", + "line": 4, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^include_test\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": 10, + "command": "include", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "frameworks": null, "defines": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json index 03bb8b3dfe..ce236c4416 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json @@ -11,6 +11,16 @@ "isGeneratorProvided": null, "fileSets": null, "sources": [], + "interfaceIncludes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI$", + "isSystem": null + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/dir$", + "isSystem": true + } + ], "interfaceSources": null, "sourceGroups": null, "compileGroups": null, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json index 351ed3f679..be96066fcf 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -21,7 +21,7 @@ [ { "file": "^imported/CMakeLists\\.txt$", - "line": 32, + "line": 38, "command": "add_executable", "hasParent": true }, @@ -51,7 +51,44 @@ "sourcePaths": [ "^empty\\.c$" ], - "includes": null, + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/imported$", + "isSystem": true, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 39, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/imported/\\.\\.$", + "isSystem": true, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 39, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "frameworks": null, "defines": [ { @@ -65,7 +102,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 32, + "line": 38, "command": "add_executable", "hasParent": true }, @@ -110,7 +147,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 33, + "line": 39, "command": "target_link_libraries", "hasParent": true }, @@ -131,7 +168,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 33, + "line": 39, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json index a27040f95b..75de339bb8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json @@ -21,7 +21,7 @@ [ { "file": "^imported/CMakeLists\\.txt$", - "line": 36, + "line": 42, "command": "add_executable", "hasParent": true }, @@ -65,7 +65,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 36, + "line": 42, "command": "add_executable", "hasParent": true }, @@ -110,7 +110,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 37, + "line": 43, "command": "target_link_libraries", "hasParent": true }, @@ -131,7 +131,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 37, + "line": 43, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json index 3c9baf70ed..043dfcf097 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json @@ -17,7 +17,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 48, + "line": 54, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index af259902cd..21efd23c5e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -9,6 +9,9 @@ set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0) include("${CMAKE_CURRENT_LIST_DIR}/include_test.cmake") +target_include_directories(interface_lib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/dir") +set_property(TARGET interface_lib APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/dir") + add_library(c_lib empty.c) add_executable(c_exe empty.c) target_link_libraries(c_exe PRIVATE c_lib) diff --git a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt index 9d6ec39f6d..438f68a868 100644 --- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt @@ -29,6 +29,12 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES " endif() add_library(imported_interface_lib INTERFACE IMPORTED) +set_target_properties(imported_interface_lib PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" +) +target_sources(imported_interface_lib + INTERFACE FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/.." FILES ../empty.h +) add_executable(link_imported_interface_exe ../empty.c) target_link_libraries(link_imported_interface_exe PRIVATE imported_interface_lib)