소스 검색

fileAPI: Output all INTERFACE and IMPORTED targets

Fixes: #27248
Craig Scott 1 개월 전
부모
커밋
b626843d71
99개의 변경된 파일1160개의 추가작업 그리고 82개의 파일을 삭제
  1. 112 15
      Help/manual/cmake-file-api.7.rst
  2. 179 4
      Help/manual/file_api/schema_codemodel.json
  3. 43 9
      Help/manual/file_api/schema_target.json
  4. 17 0
      Help/release/dev/fileapi-direct-dependencies.rst
  5. 87 32
      Source/cmFileAPICodemodel.cxx
  6. 75 5
      Tests/RunCMake/FileAPI/codemodel-v2-check.py
  7. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json
  8. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json
  9. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.cross.json
  10. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
  11. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
  12. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json
  13. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json
  14. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json
  15. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
  16. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/framework.json
  17. 10 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json
  18. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
  19. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json
  20. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json
  21. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
  22. 2 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/alias.json
  23. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
  24. 2 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/custom.json
  25. 2 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json
  26. 2 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/external.json
  27. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/framework.json
  28. 8 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json
  29. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json
  30. 2 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/projects/object.json
  31. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json
  32. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json
  33. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json
  34. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json
  35. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_framework.json
  36. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json
  37. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json
  38. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json
  39. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
  40. 9 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_import_framework.json
  41. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json
  42. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json
  43. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
  44. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
  45. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json
  46. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json
  47. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json
  48. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json
  49. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
  50. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json
  51. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json
  52. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
  53. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json
  54. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json
  55. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json
  56. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
  57. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
  58. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json
  59. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json
  60. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json
  61. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json
  62. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json
  63. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json
  64. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json
  65. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
  66. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json
  67. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json
  68. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json
  69. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json
  70. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json
  71. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json
  72. 38 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_none.json
  73. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json
  74. 47 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/import_framework.json
  75. 43 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_exe.json
  76. 38 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json
  77. 38 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_lib.json
  78. 38 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_object_lib.json
  79. 47 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_shared_lib.json
  80. 43 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_static_lib.json
  81. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json
  82. 62 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json
  83. 5 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json
  84. 5 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json
  85. 5 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json
  86. 5 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json
  87. 5 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json
  88. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json
  89. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json
  90. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json
  91. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json
  92. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json
  93. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json
  94. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_framework.json
  95. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json
  96. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json
  97. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json
  98. 3 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json
  99. 3 0
      Tests/RunCMake/FileAPI/imported/CMakeLists.txt

+ 112 - 15
Help/manual/cmake-file-api.7.rst

@@ -507,6 +507,7 @@ Version 1 does not exist to avoid confusion with that from
             "childIndexes": [ 1 ],
             "projectIndex": 0,
             "targetIndexes": [ 0 ],
+            "abstractTargetIndexes": [ 1 ],
             "hasInstallRule": true,
             "minimumCMakeVersion": {
               "string": "3.14"
@@ -519,6 +520,7 @@ Version 1 does not exist to avoid confusion with that from
             "parentIndex": 0,
             "projectIndex": 0,
             "targetIndexes": [ 1 ],
+            "abstractTargetIndexes": [ 0 ],
             "minimumCMakeVersion": {
               "string": "3.14"
             },
@@ -529,7 +531,8 @@ Version 1 does not exist to avoid confusion with that from
           {
             "name": "MyProject",
             "directoryIndexes": [ 0, 1 ],
-            "targetIndexes": [ 0, 1 ]
+            "targetIndexes": [ 0, 1 ],
+            "abstractTargetIndexes": [ 0, 1 ],
           }
         ],
         "targets": [
@@ -546,6 +549,20 @@ Version 1 does not exist to avoid confusion with that from
             "jsonFile": "<file>"
           }
         ]
+        "abstractTargets": [
+          {
+            "name": "MyImportedExecutable",
+            "directoryIndex": 1,
+            "projectIndex": 0,
+            "jsonFile": "<file>"
+          },
+          {
+            "name": "MyPureInterfaceLibrary",
+            "directoryIndex": 0,
+            "projectIndex": 0,
+            "jsonFile": "<file>"
+          }
+        ]
       }
     ]
   }
@@ -612,10 +629,20 @@ The members specific to ``codemodel`` objects are:
       indicating the build system project to which the this directory belongs.
 
     ``targetIndexes``
-      Optional member that is present when the directory itself has targets,
-      excluding those belonging to subdirectories.  The value is a JSON
-      array of entries corresponding to the targets.  Each entry is an
-      unsigned integer 0-based index into the main ``targets`` array.
+      Optional member that is present when the directory itself has
+      build system targets, excluding those belonging to subdirectories.
+      The value is a JSON array of entries corresponding to the build system
+      targets.  Each entry is an unsigned integer 0-based index into the main
+      ``targets`` array.
+
+    ``abstractTargetIndexes``
+      Optional member that is present when the directory itself has abstract
+      targets, excluding those belonging to subdirectories.
+      The value is a JSON array of entries corresponding to the abstract
+      targets.  Each entry is an unsigned integer 0-based index into the main
+      ``abstractTargets`` array.
+
+      This field was added in codemodel version 2.9.
 
     ``minimumCMakeVersion``
       Optional member present when a minimum required version of CMake is
@@ -677,17 +704,58 @@ The members specific to ``codemodel`` objects are:
       integer 0-based index into the main ``directories`` array.
 
     ``targetIndexes``
-      Optional member that is present when the project itself has targets,
-      excluding those belonging to sub-projects.  The value is a JSON
-      array of entries corresponding to the targets.  Each entry is an
-      unsigned integer 0-based index into the main ``targets`` array.
+      Optional member that is present when the project itself has
+      build system targets, excluding those belonging to sub-projects.
+      The value is a JSON array of entries corresponding to the build system
+      targets.  Each entry is an unsigned integer 0-based index into the main
+      ``targets`` array.
+
+    ``abstractTargetIndexes``
+      Optional member that is present when the project itself has
+      abstract targets, excluding those belonging to sub-projects.
+      The value is a JSON array of entries corresponding to the abstract
+      targets.  Each entry is an unsigned integer 0-based index into the main
+      ``abstractTargets`` array.
+
+      This field was added in codemodel version 2.9.
 
   ``targets``
     A JSON array of entries corresponding to the build system targets.
     Such targets are created by calls to :command:`add_executable`,
     :command:`add_library`, and :command:`add_custom_target`, excluding
-    imported targets and interface libraries (which do not generate any
-    build rules).  Each entry is a JSON object containing members:
+    imported targets and interface libraries that do not generate any
+    build rules.  Each entry is a JSON object containing members:
+
+    ``name``
+      A string specifying the target name.
+
+    ``id``
+      A string uniquely identifying the target.  This matches the ``id``
+      field in the file referenced by ``jsonFile``.
+
+    ``directoryIndex``
+      An unsigned integer 0-based index into the main ``directories`` array
+      indicating the build system directory in which the target is defined.
+
+    ``projectIndex``
+      An unsigned integer 0-based index into the main ``projects`` array
+      indicating the build system project in which the target is defined.
+
+    ``jsonFile``
+      A JSON string specifying a path relative to the codemodel file
+      to another JSON file containing a
+      `"codemodel" version 2 "target" object`_.
+
+  ``abstractTargets``
+    A JSON array of entries corresponding to targets that are not present
+    in the build system.  These are imported targets or interface libraries
+    created by calls to :command:`add_executable` or :command:`add_library`.
+    In the case of interface libraries, only those that are not part of the
+    build system are included in this array.  Interface libraries that do
+    participate in the build system will be included in the ``targets``
+    array instead.
+
+    Each entry is a JSON object containing members:
 
     ``name``
       A string specifying the target name.
@@ -709,6 +777,8 @@ The members specific to ``codemodel`` objects are:
       to another JSON file containing a
       `"codemodel" version 2 "target" object`_.
 
+    This field was added in codemodel version 2.9.
+
 "codemodel" version 2 "directory" object
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -1039,6 +1109,31 @@ with members:
   ``MODULE_LIBRARY``, ``OBJECT_LIBRARY``, ``INTERFACE_LIBRARY``,
   or ``UTILITY``.
 
+``imported``
+  Optional member that is present with boolean value ``true`` if the
+  target is an imported target.
+
+  This field was added in codemodel version 2.9.
+
+``local``
+  Optional member that is present with boolean value ``true`` if the
+  target is only defined with local scope rather than being a global target.
+  Currently, only imported targets will potentially have this field.
+
+  This field was added in codemodel version 2.9.
+
+``abstract``
+  Optional member that is present with boolean value ``true`` if the
+  target is an abstract target.  Abstract targets are not part of the build
+  system, they only exist to describe dependencies or to provide usage
+  requirements to targets that link to them.  Examples include imported targets
+  and interface libraries that have no generated sources.  Abstract targets
+  cannot be built, so they should not be presented to the user as a buildable
+  target.
+
+  This field was added in codemodel version 2.9.  Abstract targets were not
+  included anywhere in file API replies in codemodel version 2.8 and earlier.
+
 ``backtrace``
   Optional member that is present when a CMake language backtrace to
   the command in the source code that created the target is available.
@@ -1146,8 +1241,8 @@ with members:
   This field was added in codemodel version 2.7.
 
 ``link``
-  Optional member that is present for executables and shared library
-  targets that link into a runtime binary.  The value is a JSON object
+  Optional member that is present for non-imported executables and shared
+  library targets that link into a runtime binary.  The value is a JSON object
   with members describing the link step:
 
   ``language``
@@ -1193,8 +1288,8 @@ with members:
       with forward slashes.
 
 ``archive``
-  Optional member that is present for static library targets.  The value
-  is a JSON object with members describing the archive step:
+  Optional member that is present for non-imported static library targets.
+  The value is a JSON object with members describing the archive step:
 
   ``commandFragments``
     Optional member that is present when fragments of the archiver command
@@ -1233,6 +1328,8 @@ with members:
 
 ``dependencies``
   Optional member that is present when the target depends on other targets.
+  It is not present if the target is not part of the build system (i.e. it is
+  not an imported target or an interface library with no generated sources).
   The value is a JSON array of entries corresponding to the dependencies.
   Each entry is a JSON object with members:
 

+ 179 - 4
Help/manual/file_api/schema_codemodel.json

@@ -14,6 +14,9 @@
     },
     {
       "$ref": "#/definitions/codemodelV2_3"
+    },
+    {
+      "$ref": "#/definitions/codemodelV2_9"
     }
   ],
   "definitions": {
@@ -54,7 +57,26 @@
         },
         "minor": {
           "type": "integer",
-          "minimum": 3
+          "minimum": 3,
+          "maximum": 8
+        }
+      },
+      "additionalProperties": false
+    },
+    "versionV2_9": {
+      "type": "object",
+      "required": [
+        "major",
+        "minor"
+      ],
+      "properties": {
+        "major": {
+          "type": "integer",
+          "const": 2
+        },
+        "minor": {
+          "type": "integer",
+          "minimum": 9
         }
       },
       "additionalProperties": false
@@ -103,7 +125,7 @@
       "minimum": 0,
       "description": "Index into the projects array"
     },
-    "configurationDirectoryItemTargetIndexes": {
+    "configurationDirectoryItemBuildSystemTargetIndexes": {
       "type": "array",
       "items": {
         "type": "integer",
@@ -111,6 +133,14 @@
       },
       "description": "Indices into the targets array"
     },
+    "configurationDirectoryItemAbstractTargetIndexesV2_9": {
+      "type": "array",
+      "items": {
+        "type": "integer",
+        "minimum": 0
+      },
+      "description": "Indices into the abstractTargets array"
+    },
     "configurationDirectoryItemMinimumCMakeVersion": {
       "type": "object",
       "required": [
@@ -160,7 +190,7 @@
             "$ref": "#/definitions/configurationDirectoryItemProjectIndex"
           },
           "targetIndexes": {
-            "$ref": "#/definitions/configurationDirectoryItemTargetIndexes"
+            "$ref": "#/definitions/configurationDirectoryItemBuildSystemTargetIndexes"
           },
           "minimumCMakeVersion": {
             "$ref": "#/definitions/configurationDirectoryItemMinimumCMakeVersion"
@@ -198,7 +228,51 @@
             "$ref": "#/definitions/configurationDirectoryItemProjectIndex"
           },
           "targetIndexes": {
-            "$ref": "#/definitions/configurationDirectoryItemTargetIndexes"
+            "$ref": "#/definitions/configurationDirectoryItemBuildSystemTargetIndexes"
+          },
+          "minimumCMakeVersion": {
+            "$ref": "#/definitions/configurationDirectoryItemMinimumCMakeVersion"
+          },
+          "hasInstallRule": {
+            "$ref": "#/definitions/configurationDirectoryItemHasInstallRule"
+          },
+          "jsonFile": {
+            "$ref": "#/definitions/configurationDirectoryItemJsonFileV2_3"
+          }
+        },
+        "additionalProperties": false
+      }
+    },
+    "configurationDirectoriesV2_9": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "source",
+          "build",
+          "projectIndex"
+        ],
+        "properties": {
+          "source": {
+            "$ref": "#/definitions/configurationDirectoryItemSource"
+          },
+          "build": {
+            "$ref": "#/definitions/configurationDirectoryItemBuild"
+          },
+          "parentIndex": {
+            "$ref": "#/definitions/configurationDirectoryItemParentIndex"
+          },
+          "childIndexes": {
+            "$ref": "#/definitions/configurationDirectoryItemChildIndexes"
+          },
+          "projectIndex": {
+            "$ref": "#/definitions/configurationDirectoryItemProjectIndex"
+          },
+          "targetIndexes": {
+            "$ref": "#/definitions/configurationDirectoryItemBuildSystemTargetIndexes"
+          },
+          "abstractTargetIndexes": {
+            "$ref": "#/definitions/configurationDirectoryItemAbstractTargetIndexesV2_9"
           },
           "minimumCMakeVersion": {
             "$ref": "#/definitions/configurationDirectoryItemMinimumCMakeVersion"
@@ -262,6 +336,59 @@
         }
       }
     },
+    "configurationProjectsV2_9": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "name",
+          "directoryIndexes"
+        ],
+        "properties": {
+          "name": {
+            "type": "string",
+            "description": "Project name"
+          },
+          "parentIndex": {
+            "type": "integer",
+            "minimum": 0,
+            "description": "Index of parent project"
+          },
+          "childIndexes": {
+            "type": "array",
+            "items": {
+              "type": "integer",
+              "minimum": 0
+            },
+            "description": "Indices of child projects"
+          },
+          "directoryIndexes": {
+            "type": "array",
+            "items": {
+              "type": "integer",
+              "minimum": 0
+            },
+            "description": "Indices into directories array"
+          },
+          "targetIndexes": {
+            "type": "array",
+            "items": {
+              "type": "integer",
+              "minimum": 0
+            },
+            "description": "Indices into targets array"
+          },
+          "abstractTargetIndexes": {
+            "type": "array",
+            "items": {
+              "type": "integer",
+              "minimum": 0
+            },
+            "description": "Indices into abstractTargets array"
+          }
+        }
+      }
+    },
     "configurationTargets": {
       "type": "array",
       "items": {
@@ -352,6 +479,37 @@
         "additionalProperties": false
       }
     },
+    "configurationsV2_9": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "name",
+          "directories",
+          "projects",
+          "targets",
+          "abstractTargets"
+        ],
+        "properties": {
+          "name": {
+            "$ref": "#/definitions/configurationName"
+          },
+          "projects": {
+            "$ref": "#/definitions/configurationProjectsV2_9"
+          },
+          "targets": {
+            "$ref": "#/definitions/configurationTargets"
+          },
+          "abstractTargets": {
+            "$ref": "#/definitions/configurationTargets"
+          },
+          "directories": {
+            "$ref": "#/definitions/configurationDirectoriesV2_9"
+          }
+        },
+        "additionalProperties": false
+      }
+    },
     "codemodelV2_0": {
       "properties": {
         "kind": {
@@ -385,6 +543,23 @@
         }
       },
       "additionalProperties": false
+    },
+    "codemodelV2_9": {
+      "properties": {
+        "kind": {
+          "$ref": "#/definitions/kind"
+        },
+        "version": {
+          "$ref": "#/definitions/versionV2_9"
+        },
+        "paths": {
+          "$ref": "#/definitions/paths"
+        },
+        "configurations": {
+          "$ref": "#/definitions/configurationsV2_9"
+        }
+      },
+      "additionalProperties": false
     }
   }
 }

+ 43 - 9
Help/manual/file_api/schema_target.json

@@ -60,7 +60,7 @@
       "type": "string",
       "description": "Unique identifier for the target. The format is unspecified and should not be interpreted by clients."
     },
-    "type": {
+    "typeV2_0": {
       "type": "string",
       "enum": [
         "EXECUTABLE",
@@ -72,6 +72,31 @@
         "UTILITY"
       ]
     },
+    "typeV2_9": {
+      "type": "string",
+      "enum": [
+        "EXECUTABLE",
+        "STATIC_LIBRARY",
+        "SHARED_LIBRARY",
+        "MODULE_LIBRARY",
+        "OBJECT_LIBRARY",
+        "INTERFACE_LIBRARY",
+        "UNKNOWN_LIBRARY",
+        "UTILITY"
+      ]
+    },
+    "importedV2_9": {
+      "type": "boolean",
+      "description": "True if the target is imported"
+    },
+    "localV2_9": {
+      "type": "boolean",
+      "description": "True if the target is defined in a local scope rather than being a global target"
+    },
+    "abstractV2_9": {
+      "type": "boolean",
+      "description": "True if the target is not part of the build system"
+    },
     "backtrace": {
       "type": "integer",
       "minimum": 0,
@@ -865,7 +890,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -929,7 +954,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -993,7 +1018,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1057,7 +1082,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1124,7 +1149,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1191,7 +1216,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1261,7 +1286,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1338,7 +1363,16 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/type"
+          "$ref": "#/definitions/typeV2_9"
+        },
+        "imported": {
+          "$ref": "#/definitions/importedV2_9"
+        },
+        "local": {
+          "$ref": "#/definitions/localV2_9"
+        },
+        "abstract": {
+          "$ref": "#/definitions/abstractV2_9"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"

+ 17 - 0
Help/release/dev/fileapi-direct-dependencies.rst

@@ -0,0 +1,17 @@
+fileapi-direct-dependencies
+---------------------------
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 now includes imported
+  targets and all interface library targets in its replies.  Previously,
+  imported targets were omitted, and only those interface targets that
+  participated in the build system were included.  The following changes
+  support these new additions:
+
+  * The "target" object gained ``imported``, ``local``, and ``abstract`` fields.
+  * The "target" object's ``type`` field can now also hold the value
+    ``UNKNOWN_LIBRARY``.
+  * The "codemodel" object's ``configurations`` entries gained a new
+    ``abstractTargets`` array.
+  * Entries in the ``directories`` and ``projects`` arrays of the "codemodel"
+    object's ``configurations`` entries gained a new ``abstractTargetIndexes``
+    array.

+ 87 - 32
Source/cmFileAPICodemodel.cxx

@@ -250,7 +250,8 @@ class CodemodelConfig
   {
     cmStateSnapshot Snapshot;
     cmLocalGenerator const* LocalGenerator = nullptr;
-    Json::Value TargetIndexes = Json::arrayValue;
+    Json::Value BuildSystemTargetIndexes = Json::arrayValue;
+    Json::Value AbstractTargetIndexes = Json::arrayValue;
     Json::ArrayIndex ProjectIndex;
     bool HasInstallRule = false;
   };
@@ -266,7 +267,8 @@ class CodemodelConfig
     Json::ArrayIndex ParentIndex = NoParentIndex;
     Json::Value ChildIndexes = Json::arrayValue;
     Json::Value DirectoryIndexes = Json::arrayValue;
-    Json::Value TargetIndexes = Json::arrayValue;
+    Json::Value BuildSystemTargetIndexes = Json::arrayValue;
+    Json::Value AbstractTargetIndexes = Json::arrayValue;
   };
   std::map<cmStateSnapshot, Json::ArrayIndex, cmStateSnapshot::StrictWeakOrder>
     ProjectMap;
@@ -274,6 +276,12 @@ class CodemodelConfig
 
   TargetIndexMapType TargetIndexMap;
 
+  struct DumpedTargets
+  {
+    Json::Value BuildSystemTargets = Json::arrayValue;
+    Json::Value AbstractTargets = Json::arrayValue;
+  };
+
   void ProcessDirectories();
 
   Json::ArrayIndex GetDirectoryIndex(cmLocalGenerator const* lg);
@@ -281,7 +289,7 @@ class CodemodelConfig
 
   Json::ArrayIndex AddProject(cmStateSnapshot s);
 
-  Json::Value DumpTargets();
+  DumpedTargets DumpTargets();
   Json::Value DumpTarget(cmGeneratorTarget* gt, Json::ArrayIndex ti);
 
   Json::Value DumpDirectories();
@@ -591,9 +599,14 @@ Json::Value CodemodelConfig::Dump()
   Json::Value configuration = Json::objectValue;
   configuration["name"] = this->Config;
   this->ProcessDirectories();
-  configuration["targets"] = this->DumpTargets();
+
+  DumpedTargets dumpedTargets = this->DumpTargets();
+  configuration["targets"] = dumpedTargets.BuildSystemTargets;
+  configuration["abstractTargets"] = dumpedTargets.AbstractTargets;
+
   configuration["directories"] = this->DumpDirectories();
   configuration["projects"] = this->DumpProjects();
+
   return configuration;
 }
 
@@ -680,15 +693,16 @@ Json::ArrayIndex CodemodelConfig::AddProject(cmStateSnapshot s)
   return projectIndex;
 }
 
-Json::Value CodemodelConfig::DumpTargets()
+CodemodelConfig::DumpedTargets CodemodelConfig::DumpTargets()
 {
-  Json::Value targets = Json::arrayValue;
+  DumpedTargets dumpedTargets;
 
   std::vector<cmGeneratorTarget*> targetList;
   cmGlobalGenerator* gg =
     this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
   for (auto const& lg : gg->GetLocalGenerators()) {
     cm::append(targetList, lg->GetGeneratorTargets());
+    cm::append(targetList, lg->GetOwnedImportedGeneratorTargets());
   }
   std::sort(targetList.begin(), targetList.end(),
             [](cmGeneratorTarget* l, cmGeneratorTarget* r) {
@@ -696,8 +710,7 @@ Json::Value CodemodelConfig::DumpTargets()
             });
 
   for (cmGeneratorTarget* gt : targetList) {
-    if (gt->GetType() == cmStateEnums::GLOBAL_TARGET ||
-        !gt->IsInBuildSystem()) {
+    if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
       continue;
     }
 
@@ -706,17 +719,22 @@ Json::Value CodemodelConfig::DumpTargets()
       continue;
     }
 
+    Json::Value& targets = gt->IsInBuildSystem()
+      ? dumpedTargets.BuildSystemTargets
+      : dumpedTargets.AbstractTargets;
     targets.append(this->DumpTarget(gt, targets.size()));
   }
 
-  return targets;
+  return dumpedTargets;
 }
 
 Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
                                         Json::ArrayIndex ti)
 {
   Target t(gt, this->VersionMajor, this->VersionMinor, this->Config);
-  std::string prefix = "target-" + gt->GetName();
+  std::string safeTargetName = gt->GetName();
+  std::replace(safeTargetName.begin(), safeTargetName.end(), ':', '_');
+  std::string prefix = "target-" + safeTargetName;
   if (!this->Config.empty()) {
     prefix += "-" + this->Config;
   }
@@ -727,12 +745,20 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
   // Cross-reference directory containing target.
   Json::ArrayIndex di = this->GetDirectoryIndex(gt->GetLocalGenerator());
   target["directoryIndex"] = di;
-  this->Directories[di].TargetIndexes.append(ti);
+  if (gt->IsInBuildSystem()) {
+    this->Directories[di].BuildSystemTargetIndexes.append(ti);
+  } else {
+    this->Directories[di].AbstractTargetIndexes.append(ti);
+  }
 
   // Cross-reference project containing target.
   Json::ArrayIndex pi = this->Directories[di].ProjectIndex;
   target["projectIndex"] = pi;
-  this->Projects[pi].TargetIndexes.append(ti);
+  if (gt->IsInBuildSystem()) {
+    this->Projects[pi].BuildSystemTargetIndexes.append(ti);
+  } else {
+    this->Projects[pi].AbstractTargetIndexes.append(ti);
+  }
 
   this->TargetIndexMap[gt] = ti;
 
@@ -774,8 +800,11 @@ Json::Value CodemodelConfig::DumpDirectory(Directory& d)
 
   directory["projectIndex"] = d.ProjectIndex;
 
-  if (!d.TargetIndexes.empty()) {
-    directory["targetIndexes"] = std::move(d.TargetIndexes);
+  if (!d.BuildSystemTargetIndexes.empty()) {
+    directory["targetIndexes"] = std::move(d.BuildSystemTargetIndexes);
+  }
+  if (!d.AbstractTargetIndexes.empty()) {
+    directory["abstractTargetIndexes"] = std::move(d.AbstractTargetIndexes);
   }
 
   Json::Value minimumCMakeVersion = this->DumpMinimumCMakeVersion(d.Snapshot);
@@ -841,8 +870,11 @@ Json::Value CodemodelConfig::DumpProject(Project& p)
 
   project["directoryIndexes"] = std::move(p.DirectoryIndexes);
 
-  if (!p.TargetIndexes.empty()) {
-    project["targetIndexes"] = std::move(p.TargetIndexes);
+  if (!p.BuildSystemTargetIndexes.empty()) {
+    project["targetIndexes"] = std::move(p.BuildSystemTargetIndexes);
+  }
+  if (!p.AbstractTargetIndexes.empty()) {
+    project["abstractTargetIndexes"] = std::move(p.AbstractTargetIndexes);
   }
 
   return project;
@@ -1231,6 +1263,15 @@ Json::Value Target::Dump()
   target["name"] = this->GT->GetName();
   target["type"] = cmState::GetTargetTypeName(type);
   target["id"] = TargetId(this->GT, this->TopBuild);
+  if (this->GT->IsImported()) {
+    target["imported"] = true;
+    if (!this->GT->IsImportedGloballyVisible()) {
+      target["local"] = true;
+    }
+  }
+  if (!this->GT->IsInBuildSystem()) {
+    target["abstract"] = true;
+  }
   target["paths"] = this->DumpPaths();
   if (this->GT->Target->GetIsGeneratorProvided()) {
     target["isGeneratorProvided"] = true;
@@ -1253,10 +1294,14 @@ Json::Value Target::Dump()
       type == cmStateEnums::SHARED_LIBRARY ||
       type == cmStateEnums::MODULE_LIBRARY) {
     target["nameOnDisk"] = this->GT->GetFullName(this->Config);
-    target["link"] = this->DumpLink();
+    if (!this->GT->IsImported()) {
+      target["link"] = this->DumpLink();
+    }
   } else if (type == cmStateEnums::STATIC_LIBRARY) {
     target["nameOnDisk"] = this->GT->GetFullName(this->Config);
-    target["archive"] = this->DumpArchive();
+    if (!this->GT->IsImported()) {
+      target["archive"] = this->DumpArchive();
+    }
   }
 
   if (type == cmStateEnums::EXECUTABLE) {
@@ -1266,13 +1311,17 @@ Json::Value Target::Dump()
     }
   }
 
-  Json::Value dependencies = this->DumpDependencies();
-  if (!dependencies.empty()) {
-    target["dependencies"] = dependencies;
+  if (!this->GT->IsImported()) {
+    Json::Value dependencies = this->DumpDependencies();
+    if (!dependencies.empty()) {
+      target["dependencies"] = dependencies;
+    }
   }
 
   {
-    this->ProcessLanguages();
+    if (!this->GT->IsImported()) {
+      this->ProcessLanguages();
+    }
 
     auto fileSetInfo = this->DumpFileSets();
 
@@ -1280,6 +1329,8 @@ Json::Value Target::Dump()
       target["fileSets"] = fileSetInfo.first;
     }
 
+    // Even though some types of targets can't have sources, we have to always
+    // output a sources array to preserve backward compatibility
     target["sources"] = this->DumpSources(fileSetInfo.second);
 
     Json::Value folder = this->DumpFolder();
@@ -1287,22 +1338,26 @@ Json::Value Target::Dump()
       target["folder"] = std::move(folder);
     }
 
-    Json::Value sourceGroups = this->DumpSourceGroups();
-    if (!sourceGroups.empty()) {
-      target["sourceGroups"] = std::move(sourceGroups);
-    }
+    if (!this->GT->IsImported()) {
+      Json::Value sourceGroups = this->DumpSourceGroups();
+      if (!sourceGroups.empty()) {
+        target["sourceGroups"] = std::move(sourceGroups);
+      }
 
-    Json::Value compileGroups = this->DumpCompileGroups();
-    if (!compileGroups.empty()) {
-      target["compileGroups"] = std::move(compileGroups);
+      Json::Value compileGroups = this->DumpCompileGroups();
+      if (!compileGroups.empty()) {
+        target["compileGroups"] = std::move(compileGroups);
+      }
     }
   }
 
   target["backtraceGraph"] = this->Backtraces.Dump();
 
-  Json::Value debugger = this->DumpDebugger();
-  if (!debugger.isNull()) {
-    target["debugger"] = std::move(debugger);
+  if (!this->GT->IsImported()) {
+    Json::Value debugger = this->DumpDebugger();
+    if (!debugger.isNull()) {
+      target["debugger"] = std::move(debugger);
+    }
   }
 
   return target;

+ 75 - 5
Tests/RunCMake/FileAPI/codemodel-v2-check.py

@@ -82,6 +82,13 @@ def check_directory(c, major, minor):
                              missing_exception=lambda e: "Target ID: %s" % e,
                              extra_exception=lambda a: "Target ID: %s" % c["targets"][a]["id"])
 
+        if expected["abstractTargetIds"] is not None:
+            expected_keys.append("abstractTargetIndexes")
+            check_list_match(lambda a, e: matches(c["abstractTargets"][a]["id"], e),
+                             actual["abstractTargetIndexes"], expected["abstractTargetIds"],
+                             missing_exception=lambda e: "Abstract target ID: %s" % e,
+                             extra_exception=lambda a: "Abstract target ID: %s" % c["abstractTargets"][a]["id"])
+
         if expected["minimumCMakeVersion"] is not None:
             expected_keys.append("minimumCMakeVersion")
             assert is_dict(actual["minimumCMakeVersion"])
@@ -295,6 +302,18 @@ def check_target(c, major, minor):
         assert is_string(obj["type"], expected["type"])
         check_backtrace_graph(obj["backtraceGraph"])
 
+        if expected["imported"] is not None:
+            expected_keys.append("imported")
+            assert is_bool(obj["imported"], expected["imported"])
+
+        if expected["local"] is not None:
+            expected_keys.append("local")
+            assert is_bool(obj["local"], expected["local"])
+
+        if expected["abstract"] is not None:
+            expected_keys.append("abstract")
+            assert is_bool(obj["abstract"], expected["abstract"])
+
         assert is_dict(obj["paths"])
         assert sorted(obj["paths"].keys()) == ["build", "source"]
         assert matches(obj["paths"]["build"], expected["build"])
@@ -747,6 +766,13 @@ def check_project(c):
                              missing_exception=lambda e: "Target ID: %s" % e,
                              extra_exception=lambda a: "Target ID: %s" % c["targets"][a]["id"])
 
+        if expected["abstractTargetIds"] is not None:
+            expected_keys.append("abstractTargetIndexes")
+            check_list_match(lambda a, e: matches(c["abstractTargets"][a]["id"], e),
+                             actual["abstractTargetIndexes"], expected["abstractTargetIds"],
+                             missing_exception=lambda e: "Abstract target ID: %s" % e,
+                             extra_exception=lambda a: "Abstract target ID: %s" % c["abstractTargets"][a]["id"])
+
         assert sorted(actual.keys()) == sorted(expected_keys)
 
     return _check
@@ -779,6 +805,7 @@ def gen_check_directories(c, g):
         if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""):
             for e in expected:
                 e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^(link_imported_object_exe)"), e["targetIds"])
+                e["abstractTargetIds"] = filter_list(lambda t: not matches(t, "^\\^(imported_object_lib)"), e["abstractTargetIds"])
 
     else:
         for e in expected:
@@ -815,7 +842,7 @@ def check_directories(c, g, major, minor):
                      missing_exception=lambda e: "Directory source: %s" % e["source"],
                      extra_exception=lambda a: "Directory source: %s" % a["source"])
 
-def gen_check_targets(c, g, inSource):
+def gen_check_build_system_targets(c, g, inSource):
     expected = [
         read_codemodel_json_data("targets/all_build_top.json"),
         read_codemodel_json_data("targets/zero_check_top.json"),
@@ -1015,14 +1042,55 @@ def gen_check_targets(c, g, inSource):
 
     return expected
 
-def check_targets(c, g, major, minor, inSource):
+def gen_check_abstract_targets(c, g, inSource):
+    expected = [
+        read_codemodel_json_data("targets/interface_lib.json"),
+
+        read_codemodel_json_data("targets/import_framework.json"),
+
+        read_codemodel_json_data("targets/imported_exe.json"),
+        read_codemodel_json_data("targets/imported_lib.json"),
+        read_codemodel_json_data("targets/imported_interface_lib.json"),
+        read_codemodel_json_data("targets/imported_object_lib.json"),
+        read_codemodel_json_data("targets/imported_shared_lib.json"),
+        read_codemodel_json_data("targets/imported_static_lib.json"),
+
+        read_codemodel_json_data("targets/iface_none.json"),
+    ]
+
+    if sys.platform == "darwin":
+        for e in expected:
+            if e["name"] == "import_framework":
+                apple_import_framework = read_codemodel_json_data("targets/apple_import_framework.json")
+                e["artifacts"] = apple_import_framework["artifacts"]
+                e["nameOnDisk"] = apple_import_framework["nameOnDisk"]
+
+    if g["name"] == "Xcode":
+        if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""):
+            expected = filter_list(lambda e: e["name"] not in ("imported_object_lib"), expected)
+
+    if sys.platform not in ("win32", "cygwin", "msys"):
+        for e in expected:
+            e["artifacts"] = filter_list(lambda a: not a["_dllExtra"], e["artifacts"])
+
+    return expected
+
+def check_build_system_targets(c, g, major, minor, inSource):
     check_list_match(lambda a, e: matches(a["id"], e["id"]),
-                     c["targets"], gen_check_targets(c, g, inSource),
+                     c["targets"], gen_check_build_system_targets(c, g, inSource),
                      check=check_target(c, major, minor),
                      check_exception=lambda a, e: "Target ID: %s" % a["id"],
                      missing_exception=lambda e: "Target ID: %s" % e["id"],
                      extra_exception=lambda a: "Target ID: %s" % a["id"])
 
+def check_abstract_targets(c, g, major, minor, inSource):
+    check_list_match(lambda a, e: matches(a["id"], e["id"]),
+                     c["abstractTargets"], gen_check_abstract_targets(c, g, inSource),
+                     check=check_target(c, major, minor),
+                     check_exception=lambda a, e: "Abstract target ID: %s" % a["id"],
+                     missing_exception=lambda e: "Abstract target ID: %s" % e["id"],
+                     extra_exception=lambda a: "Abstract target ID: %s" % a["id"])
+
 def gen_check_projects(c, g):
     expected = [
         read_codemodel_json_data("projects/codemodel-v2.json"),
@@ -1045,6 +1113,7 @@ def gen_check_projects(c, g):
         if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""):
             for e in expected:
                 e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^(link_imported_object_exe)"), e["targetIds"])
+                e["abstractTargetIds"] = filter_list(lambda t: not matches(t, "^\\^(imported_object_lib)"), e["abstractTargetIds"])
 
     else:
         for e in expected:
@@ -1060,10 +1129,11 @@ def check_projects(c, g):
                      extra_exception=lambda a: "Project name: %s" % a["name"])
 
 def check_object_codemodel_configuration(c, g, major, minor, inSource):
-    assert sorted(c.keys()) == ["directories", "name", "projects", "targets"]
+    assert sorted(c.keys()) == ["abstractTargets", "directories", "name", "projects", "targets"]
     assert is_string(c["name"])
     check_directories(c, g, major, minor)
-    check_targets(c, g, major, minor, inSource)
+    check_build_system_targets(c, g, major, minor, inSource)
+    check_abstract_targets(c, g, major, minor, inSource)
     check_projects(c, g)
 
 def check_object_codemodel(g, major, minor):

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json

@@ -9,6 +9,7 @@
         "^c_alias_exe::@53632cba2752272bb008$",
         "^cxx_alias_exe::@53632cba2752272bb008$"
     ],
+    "abstractTargetIds": null,
     "projectName": "Alias",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json

@@ -9,6 +9,7 @@
         "^custom_exe::@c11385ffed57b860da63$",
         "^custom_tgt::@c11385ffed57b860da63$"
     ],
+    "abstractTargetIds": null,
     "projectName": "Custom",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.cross.json

@@ -9,6 +9,7 @@
         "^cxx_exe_cross_emulator_args::@ee4a268216d1f53c4e2e$",
         "^cxx_exe_test_launcher_and_cross_emulator::@ee4a268216d1f53c4e2e$"
     ],
+    "abstractTargetIds": null,
     "projectName": "Cxx",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json

@@ -18,6 +18,7 @@
         "^cxx_static_exe::@a56b12a3f5c0529fb296$",
         "^cxx_static_lib::@a56b12a3f5c0529fb296$"
     ],
+    "abstractTargetIds": null,
     "projectName": "Cxx",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": true,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json

@@ -7,6 +7,7 @@
         "^dir/very-long$"
     ],
     "targetIds": null,
+    "abstractTargetIds": null,
     "projectName": "codemodel-v2",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json

@@ -4,6 +4,7 @@
     "parentSource": "^dir$",
     "childSources": null,
     "targetIds": null,
+    "abstractTargetIds": null,
     "projectName": "codemodel-v2",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_very-long.json

@@ -4,6 +4,7 @@
     "parentSource": "^dir$",
     "childSources": null,
     "targetIds": null,
+    "abstractTargetIds": null,
     "projectName": "codemodel-v2",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json

@@ -8,6 +8,7 @@
         "^ZERO_CHECK::@[0-9a-f]+$",
         "^generated_exe::@[0-9a-f]+$"
     ],
+    "abstractTargetIds": null,
     "projectName": "External",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": true,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json

@@ -7,6 +7,7 @@
     "^c_headers_1::@6b8db101d64c125f29fe$",
     "^c_headers_2::@6b8db101d64c125f29fe$"
   ],
+  "abstractTargetIds": null,
   "projectName": "codemodel-v2",
   "minimumCMakeVersion": "3.13",
   "hasInstallRule": true,

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/framework.json

@@ -10,6 +10,9 @@
         "^static_framework::@217a96c3a62328a73ef4$",
         "^exe_framework::@217a96c3a62328a73ef4$"
     ],
+    "abstractTargetIds": [
+        "^import_framework::@217a96c3a62328a73ef4$"
+    ],
     "projectName": "Framework",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 10 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json

@@ -12,6 +12,14 @@
         "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$",
         "^link_imported_static_exe::@ba7eb709d0b48779c6c8$"
     ],
+    "abstractTargetIds": [
+        "^imported_exe::@ba7eb709d0b48779c6c8$",
+        "^imported_interface_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_object_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_shared_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_static_lib::@ba7eb709d0b48779c6c8$"
+    ],
     "projectName": "Imported",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": true,
@@ -34,7 +42,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 32,
+                    "line": 35,
                     "command": "install",
                     "hasParent": true
                 },
@@ -64,7 +72,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 35,
+                    "line": 38,
                     "command": "install",
                     "hasParent": true
                 },

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json

@@ -8,6 +8,9 @@
         "^ZERO_CHECK::@25b7fa8ea00134654b85$",
         "^iface_srcs::@25b7fa8ea00134654b85$"
     ],
+    "abstractTargetIds": [
+        "^iface_none::@25b7fa8ea00134654b85$"
+    ],
     "projectName": "Interface",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json

@@ -11,6 +11,7 @@
         "^cxx_object_exe::@5ed5358f70faf8d8af7a$",
         "^cxx_object_lib::@5ed5358f70faf8d8af7a$"
     ],
+    "abstractTargetIds": null,
     "projectName": "Object",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": true,

+ 1 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json

@@ -4,6 +4,7 @@
     "parentSource": "^\\.$",
     "childSources": null,
     "targetIds": null,
+    "abstractTargetIds": null,
     "projectName": "codemodel-v2",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": null,

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json

@@ -27,6 +27,9 @@
         "^c_subdir::@6890427a1f51a3e7e1df$",
         "^interface_exe::@6890427a1f51a3e7e1df$"
     ],
+    "abstractTargetIds": [
+        "^interface_lib::@6890427a1f51a3e7e1df$"
+    ],
     "projectName": "codemodel-v2",
     "minimumCMakeVersion": "3.13",
     "hasInstallRule": true,

+ 2 - 1
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/alias.json

@@ -10,5 +10,6 @@
         "^ZERO_CHECK::@53632cba2752272bb008$",
         "^c_alias_exe::@53632cba2752272bb008$",
         "^cxx_alias_exe::@53632cba2752272bb008$"
-    ]
+    ],
+    "abstractTargetIds": null
 }

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json

@@ -32,5 +32,8 @@
         "^c_subdir::@6890427a1f51a3e7e1df$",
         "^c_headers_1::@6b8db101d64c125f29fe$",
         "^c_headers_2::@6b8db101d64c125f29fe$"
+    ],
+    "abstractTargetIds": [
+        "^interface_lib::@6890427a1f51a3e7e1df$"
     ]
 }

+ 2 - 1
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/custom.json

@@ -10,5 +10,6 @@
         "^ZERO_CHECK::@c11385ffed57b860da63$",
         "^custom_tgt::@c11385ffed57b860da63$",
         "^custom_exe::@c11385ffed57b860da63$"
-    ]
+    ],
+    "abstractTargetIds": null
 }

+ 2 - 1
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json

@@ -21,5 +21,6 @@
         "^cxx_shared_exe::@a56b12a3f5c0529fb296$",
         "^cxx_static_lib::@a56b12a3f5c0529fb296$",
         "^cxx_static_exe::@a56b12a3f5c0529fb296$"
-    ]
+    ],
+    "abstractTargetIds": null
 }

+ 2 - 1
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/external.json

@@ -9,5 +9,6 @@
         "^ALL_BUILD::@[0-9a-f]+$",
         "^ZERO_CHECK::@[0-9a-f]+$",
         "^generated_exe::@[0-9a-f]+$"
-    ]
+    ],
+    "abstractTargetIds": null
 }

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/framework.json

@@ -11,5 +11,8 @@
         "^shared_framework::@217a96c3a62328a73ef4$",
         "^static_framework::@217a96c3a62328a73ef4$",
         "^exe_framework::@217a96c3a62328a73ef4$"
+    ],
+    "abstractTargetIds": [
+        "^import_framework::@217a96c3a62328a73ef4$"
     ]
 }

+ 8 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json

@@ -13,5 +13,13 @@
         "^link_imported_static_exe::@ba7eb709d0b48779c6c8$",
         "^link_imported_object_exe::@ba7eb709d0b48779c6c8$",
         "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$"
+    ],
+    "abstractTargetIds": [
+        "^imported_exe::@ba7eb709d0b48779c6c8$",
+        "^imported_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_interface_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_object_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_shared_lib::@ba7eb709d0b48779c6c8$",
+        "^imported_static_lib::@ba7eb709d0b48779c6c8$"
     ]
 }

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json

@@ -9,5 +9,8 @@
         "^ALL_BUILD::@25b7fa8ea00134654b85$",
         "^ZERO_CHECK::@25b7fa8ea00134654b85$",
         "^iface_srcs::@25b7fa8ea00134654b85$"
+    ],
+    "abstractTargetIds": [
+        "^iface_none::@25b7fa8ea00134654b85$"
     ]
 }

+ 2 - 1
Tests/RunCMake/FileAPI/codemodel-v2-data/projects/object.json

@@ -12,5 +12,6 @@
         "^c_object_exe::@5ed5358f70faf8d8af7a$",
         "^cxx_object_lib::@5ed5358f70faf8d8af7a$",
         "^cxx_object_exe::@5ed5358f70faf8d8af7a$"
-    ]
+    ],
+    "abstractTargetIds": null
 }

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json

@@ -4,6 +4,9 @@
     "directorySource": "^alias$",
     "projectName": "Alias",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json

@@ -4,6 +4,9 @@
     "directorySource": "^custom$",
     "projectName": "Custom",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json

@@ -4,6 +4,9 @@
     "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$",
     "projectName": "External",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_framework.json

@@ -4,6 +4,9 @@
     "directorySource": "^framework$",
     "projectName": "Framework",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json

@@ -4,6 +4,9 @@
     "directorySource": "^interface$",
     "projectName": "Interface",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 9 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/apple_import_framework.json

@@ -0,0 +1,9 @@
+{
+    "nameOnDisk": "^Foo",
+    "artifacts": [
+        {
+            "path": "^/usr/Frameworks/Foo.framework/Foo$",
+            "_dllExtra": false
+        }
+    ]
+}

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^alias$",
     "projectName": "Alias",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json

@@ -4,6 +4,9 @@
   "directorySource": "^fileset$",
   "projectName": "codemodel-v2",
   "type": "STATIC_LIBRARY",
+  "imported": null,
+  "local": null,
+  "abstract": null,
   "isGeneratorProvided": null,
   "fileSets": [
     {

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json

@@ -4,6 +4,9 @@
   "directorySource": "^fileset$",
   "projectName": "codemodel-v2",
   "type": "STATIC_LIBRARY",
+  "imported": null,
+  "local": null,
+  "abstract": null,
   "isGeneratorProvided": null,
   "fileSets": [
     {

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "OBJECT_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "SHARED_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^custom$",
     "projectName": "Custom",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json

@@ -4,6 +4,9 @@
     "directorySource": "^custom$",
     "projectName": "Custom",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^alias$",
     "projectName": "Alias",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx/cross$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx/cross$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx/cross$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "OBJECT_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "SHARED_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json

@@ -4,6 +4,9 @@
     "directorySource": "^framework$",
     "projectName": "Framework",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$",
     "projectName": "External",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 38 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_none.json

@@ -0,0 +1,38 @@
+{
+    "name": "iface_none",
+    "id": "^iface_none::@25b7fa8ea00134654b85$",
+    "directorySource": "^interface$",
+    "projectName": "Interface",
+    "type": "INTERFACE_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^interface/CMakeLists\\.txt$",
+            "line": 2,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^interface/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": null,
+    "artifacts": null,
+    "build": "^interface$",
+    "source": "^interface$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json

@@ -4,6 +4,9 @@
     "directorySource": "^interface$",
     "projectName": "Interface",
     "type": "INTERFACE_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 47 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/import_framework.json

@@ -0,0 +1,47 @@
+{
+    "name": "import_framework",
+    "id": "^import_framework::@217a96c3a62328a73ef4$",
+    "directorySource": "^framework$",
+    "projectName": "Framework",
+    "type": "SHARED_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^framework/CMakeLists\\.txt$",
+            "line": 11,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^framework/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": "^(lib|cyg|msys-)?Foo(\\.(so|dll))?$",
+    "artifacts": [
+        {
+            "path": "^/usr/Frameworks/Foo.framework/Foo(\\.(so|dll))?$",
+            "_dllExtra": false
+        },
+        {
+            "path": "^/usr/Frameworks/Foo.framework/(lib)?Foo\\.(dll\\.a|lib|l)$",
+            "_dllExtra": true
+        }
+    ],
+    "build": "^framework$",
+    "source": "^framework$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 43 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_exe.json

@@ -0,0 +1,43 @@
+{
+    "name": "imported_exe",
+    "id": "^imported_exe::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "EXECUTABLE",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 5,
+            "command": "add_executable",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": "^imported_exe(\\.exe)?$",
+    "artifacts": [
+        {
+            "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?imported_exe(\\.exe)?$",
+            "_dllExtra": false
+        }
+    ],
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 38 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_interface_lib.json

@@ -0,0 +1,38 @@
+{
+    "name": "imported_interface_lib",
+    "id": "^imported_interface_lib::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "INTERFACE_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 31,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": null,
+    "artifacts": null,
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 38 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_lib.json

@@ -0,0 +1,38 @@
+{
+    "name": "imported_lib",
+    "id": "^imported_lib::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "UNKNOWN_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 3,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": null,
+    "artifacts": null,
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 38 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_object_lib.json

@@ -0,0 +1,38 @@
+{
+    "name": "imported_object_lib",
+    "id": "^imported_object_lib::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "OBJECT_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 26,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": null,
+    "artifacts": null,
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 47 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_shared_lib.json

@@ -0,0 +1,47 @@
+{
+    "name": "imported_shared_lib",
+    "id": "^imported_shared_lib::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "SHARED_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 12,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": "^(lib|cyg|msys-)?imported_shared\\.(so|dylib|dll)$",
+    "artifacts": [
+        {
+            "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?imported_shared\\.(so|dylib|dll)$",
+            "_dllExtra": false
+        },
+        {
+            "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?imported_shared\\.(dll\\.a|lib|l)$",
+            "_dllExtra": true
+        }
+    ],
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 43 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/imported_static_lib.json

@@ -0,0 +1,43 @@
+{
+    "name": "imported_static_lib",
+    "id": "^imported_static_lib::@ba7eb709d0b48779c6c8$",
+    "directorySource": "^imported$",
+    "projectName": "Imported",
+    "type": "STATIC_LIBRARY",
+    "imported": true,
+    "local": true,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": 20,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^imported/CMakeLists\\.txt$",
+            "line": null,
+            "command": null,
+            "hasParent": false
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": "^(lib)?imported_static\\.(a|lib|l)$",
+    "artifacts": [
+        {
+            "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?imported_static\\.(a|lib|l)$",
+            "_dllExtra": false
+        }
+    ],
+    "build": "^imported$",
+    "source": "^imported$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 62 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json

@@ -0,0 +1,62 @@
+{
+    "name": "interface_lib",
+    "id": "^interface_lib::@6890427a1f51a3e7e1df$",
+    "directorySource": "^\\.$",
+    "projectName": "codemodel-v2",
+    "type": "INTERFACE_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": true,
+    "isGeneratorProvided": null,
+    "fileSets": null,
+    "sources": [],
+    "sourceGroups": null,
+    "compileGroups": null,
+    "backtrace": [
+        {
+            "file": "^include_test\\.cmake$",
+            "line": 1,
+            "command": "add_library",
+            "hasParent": true
+        },
+        {
+            "file": "^include_test\\.cmake$",
+            "line": null,
+            "command": null,
+            "hasParent": true
+        },
+        {
+            "file": "^codemodel-v2\\.cmake$",
+            "line": 7,
+            "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
+        }
+    ],
+    "folder": null,
+    "nameOnDisk": null,
+    "artifacts": null,
+    "build": "^\\.$",
+    "source": "^\\.$",
+    "install": null,
+    "link": null,
+    "archive": null,
+    "dependencies": null
+}

+ 5 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [
@@ -16,7 +19,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 6,
+                    "line": 9,
                     "command": "add_executable",
                     "hasParent": true
                 },
@@ -52,7 +55,7 @@
     "backtrace": [
         {
             "file": "^imported/CMakeLists\\.txt$",
-            "line": 6,
+            "line": 9,
             "command": "add_executable",
             "hasParent": true
         },

+ 5 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [
@@ -16,7 +19,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 29,
+                    "line": 32,
                     "command": "add_executable",
                     "hasParent": true
                 },
@@ -52,7 +55,7 @@
     "backtrace": [
         {
             "file": "^imported/CMakeLists\\.txt$",
-            "line": 29,
+            "line": 32,
             "command": "add_executable",
             "hasParent": true
         },

+ 5 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [
@@ -16,7 +19,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 24,
+                    "line": 27,
                     "command": "add_executable",
                     "hasParent": true
                 },
@@ -52,7 +55,7 @@
     "backtrace": [
         {
             "file": "^imported/CMakeLists\\.txt$",
-            "line": 24,
+            "line": 27,
             "command": "add_executable",
             "hasParent": true
         },

+ 5 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [
@@ -16,7 +19,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 14,
+                    "line": 17,
                     "command": "add_executable",
                     "hasParent": true
                 },
@@ -52,7 +55,7 @@
     "backtrace": [
         {
             "file": "^imported/CMakeLists\\.txt$",
-            "line": 14,
+            "line": 17,
             "command": "add_executable",
             "hasParent": true
         },

+ 5 - 2
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "EXECUTABLE",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [
@@ -16,7 +19,7 @@
             "backtrace": [
                 {
                     "file": "^imported/CMakeLists\\.txt$",
-                    "line": 19,
+                    "line": 22,
                     "command": "add_executable",
                     "hasParent": true
                 },
@@ -52,7 +55,7 @@
     "backtrace": [
         {
             "file": "^imported/CMakeLists\\.txt$",
-            "line": 19,
+            "line": 22,
             "command": "add_executable",
             "hasParent": true
         },

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json

@@ -4,6 +4,9 @@
     "directorySource": "^framework$",
     "projectName": "Framework",
     "type": "SHARED_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json

@@ -4,6 +4,9 @@
     "directorySource": "^framework$",
     "projectName": "Framework",
     "type": "STATIC_LIBRARY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": null,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json

@@ -4,6 +4,9 @@
     "directorySource": "^alias$",
     "projectName": "Alias",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json

@@ -4,6 +4,9 @@
     "directorySource": "^custom$",
     "projectName": "Custom",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json

@@ -4,6 +4,9 @@
     "directorySource": "^cxx$",
     "projectName": "Cxx",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json

@@ -4,6 +4,9 @@
     "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$",
     "projectName": "External",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_framework.json

@@ -4,6 +4,9 @@
     "directorySource": "^framework$",
     "projectName": "Framework",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json

@@ -4,6 +4,9 @@
     "directorySource": "^imported$",
     "projectName": "Imported",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json

@@ -4,6 +4,9 @@
     "directorySource": "^interface$",
     "projectName": "Interface",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json

@@ -4,6 +4,9 @@
     "directorySource": "^object$",
     "projectName": "Object",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json

@@ -4,6 +4,9 @@
     "directorySource": "^\\.$",
     "projectName": "codemodel-v2",
     "type": "UTILITY",
+    "imported": null,
+    "local": null,
+    "abstract": null,
     "isGeneratorProvided": true,
     "fileSets": null,
     "sources": [

+ 3 - 0
Tests/RunCMake/FileAPI/imported/CMakeLists.txt

@@ -3,6 +3,9 @@ project(Imported)
 add_library(imported_lib UNKNOWN IMPORTED)
 set_target_properties(imported_lib PROPERTIES IMPORTED_LOCATION "imported_unk${CMAKE_STATIC_LIBRARY_SUFFIX}")
 add_executable(imported_exe IMPORTED)
+set_target_properties(imported_exe PROPERTIES
+  IMPORTED_LOCATION "imported_exe${CMAKE_EXECUTABLE_SUFFIX}"
+)
 add_executable(link_imported_exe ../empty.c)
 target_link_libraries(link_imported_exe PRIVATE imported_lib)