fileapi: Add build properties for SOURCES file set type to codemodel

This complements commit 5c5b68f44e (FILE_SET: Add support for the
SOURCES type, 2026-03-12).

Co-Authored-By: Brad King <brad.king@kitware.com>
Co-Authored-By: Tyler Yankee <tyler.yankee@kitware.com>
diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst
index 857d498..49b348f 100644
--- a/Help/manual/cmake-file-api.7.rst
+++ b/Help/manual/cmake-file-api.7.rst
@@ -1017,6 +1017,9 @@
 
     This field was added in codemodel version 2.4.
 
+    Since codemodel version 2.11, this field additionally accounts for
+    ``SOURCES`` file sets.
+
   ``fileSetDirectories``
     Optional member that is present when ``type`` is ``fileSet``. The value
     is a list of strings with the file set's base directories (determined by
diff --git a/Help/manual/file_api/schema_target.json b/Help/manual/file_api/schema_target.json
index 68cb14e..925c259 100644
--- a/Help/manual/file_api/schema_target.json
+++ b/Help/manual/file_api/schema_target.json
@@ -34,6 +34,9 @@
     },
     {
       "$ref": "#/definitions/codemodelV2_10"
+    },
+    {
+      "$ref": "#/definitions/codemodelV2_11"
     }
   ],
   "definitions": {
@@ -68,7 +71,25 @@
         },
         "minor": {
           "type": "integer",
-          "minimum": 10
+          "const": 10
+        }
+      },
+      "additionalProperties": false
+    },
+    "codemodelVersionV2_11": {
+      "type": "object",
+      "required": [
+        "major",
+        "minor"
+      ],
+      "properties": {
+        "major": {
+          "type": "integer",
+          "const": 2
+        },
+        "minor": {
+          "type": "integer",
+          "minimum": 11
         }
       },
       "additionalProperties": false
@@ -81,7 +102,22 @@
       "type": "string",
       "description": "Unique identifier for the target. The format is unspecified and should not be interpreted by clients."
     },
-    "typeV2_0": {
+    "fileset-typeV2_5": {
+      "type": "string",
+      "enum": [
+        "HEADERS",
+        "CXX_MODULES"
+      ]
+    },
+    "fileset-typeV2_11": {
+      "type": "string",
+      "enum": [
+        "HEADERS",
+        "CXX_MODULES",
+        "SOURCES"
+      ]
+    },
+    "target-typeV2_0": {
       "type": "string",
       "enum": [
         "EXECUTABLE",
@@ -93,7 +129,7 @@
         "UTILITY"
       ]
     },
-    "typeV2_9": {
+    "target-typeV2_9": {
       "type": "string",
       "enum": [
         "EXECUTABLE",
@@ -530,12 +566,45 @@
             "type": "string"
           },
           "type": {
+            "$ref": "#/definitions/fileset-typeV2_5"
+          },
+          "visibility": {
             "type": "string",
             "enum": [
-              "HEADERS",
-              "CXX_MODULES"
+              "PUBLIC",
+              "PRIVATE",
+              "INTERFACE"
             ]
           },
+          "baseDirectories": {
+            "type": "array",
+            "minItems": 1,
+            "items": {
+              "type": "string"
+            },
+            "description": "Base directories containing the file set's files. If a directory is inside the top level source directory, its path is specified relative to that directory. Otherwise, its path is absolute."
+          }
+        },
+        "additionalProperties": false
+      }
+    },
+    "fileSetsV2_11": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "name",
+          "type",
+          "visibility",
+          "baseDirectories"
+        ],
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "type": {
+            "$ref": "#/definitions/fileset-typeV2_11"
+          },
           "visibility": {
             "type": "string",
             "enum": [
@@ -1094,7 +1163,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1158,7 +1227,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1222,7 +1291,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1286,7 +1355,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1353,7 +1422,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1420,7 +1489,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1490,7 +1559,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_0"
+          "$ref": "#/definitions/target-typeV2_0"
         },
         "backtrace": {
           "$ref": "#/definitions/backtrace"
@@ -1567,7 +1636,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_9"
+          "$ref": "#/definitions/target-typeV2_9"
         },
         "imported": {
           "$ref": "#/definitions/importedV2_9"
@@ -1674,7 +1743,7 @@
           "$ref": "#/definitions/id"
         },
         "type": {
-          "$ref": "#/definitions/typeV2_9"
+          "$ref": "#/definitions/target-typeV2_9"
         },
         "imported": {
           "$ref": "#/definitions/importedV2_9"
@@ -1762,6 +1831,116 @@
         }
       },
       "additionalProperties": false
+    },
+    "codemodelV2_11": {
+      "required": [
+        "codemodelVersion",
+        "name",
+        "id",
+        "type",
+        "paths",
+        "sources",
+        "backtraceGraph"
+      ],
+      "properties": {
+        "codemodelVersion": {
+          "$ref": "#/definitions/codemodelVersionV2_11"
+        },
+        "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"
+        },
+        "sources": {
+          "$ref": "#/definitions/sourcesV2_5"
+        },
+        "interfaceSources": {
+          "$ref": "#/definitions/interfaceSourcesV2_10"
+        },
+        "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/file-api-FILE_SET-SOURCES.rst b/Help/release/dev/file-api-FILE_SET-SOURCES.rst
new file mode 100644
index 0000000..e121c65
--- /dev/null
+++ b/Help/release/dev/file-api-FILE_SET-SOURCES.rst
@@ -0,0 +1,8 @@
+file-api-FILE_SET-SOURCES
+-------------------------
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 object has been
+  updated to 2.11.
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 "installers" object's
+  optional ``fileSetType`` field gained a new ``SOURCES`` value to incorporate
+  the new :ref:`file set <file sets>` ``SOURCES`` type in codemodel replies.
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index be816d5..ff31855 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -823,7 +823,7 @@
 // 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 = 10;
+static unsigned int const CodeModelV2Minor = 11;
 
 void cmFileAPI::BuildClientRequestCodeModel(
   ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 8b214b6..3627cb9 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -1495,6 +1495,9 @@
   cmGeneratorExpressionInterpreter genexInterpreter(lg, this->Config, this->GT,
                                                     fd.Language);
 
+  cmGeneratorFileSet const* fileSet =
+    GT->GetFileSetForSource(this->Config, sf);
+
   std::string const COMPILE_FLAGS("COMPILE_FLAGS");
   if (cmValue cflags = sf->GetProperty(COMPILE_FLAGS)) {
     std::string flags = genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS);
@@ -1511,6 +1514,19 @@
     BT<std::string> opt(tmp, tmpOpt.Backtrace);
     fd.Flags.emplace_back(this->ToJBT(opt));
   }
+  // File set compile options, if any
+  if (fileSet) {
+    for (BT<std::string> const& tmpOpt : fileSet->BelongsTo(this->GT)
+           ? fileSet->GetCompileOptions(this->Config, fd.Language)
+           : fileSet->GetInterfaceCompileOptions(this->Config, fd.Language)) {
+      // We need to use the AppendCompileOptions method so we handle situations
+      // where backtrace entries have list and properly escape flags.
+      std::string tmp;
+      lg->AppendCompileOptions(tmp, tmpOpt.Value);
+      BT<std::string> opt(tmp, tmpOpt.Backtrace);
+      fd.Flags.emplace_back(this->ToJBT(opt));
+    }
+  }
 
   // Add precompile headers compile options.
   std::vector<std::string> pchArchs =
@@ -1548,9 +1564,31 @@
     fd.Flags.emplace_back(this->ToJBT(opt));
   }
 
+  std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+  // Add include directories from file set properties.
+  if (fileSet) {
+    for (BT<std::string> const& tmpInclude : fileSet->BelongsTo(this->GT)
+           ? fileSet->GetIncludeDirectories(this->Config, fd.Language)
+           : fileSet->GetInterfaceIncludeDirectories(this->Config,
+                                                     fd.Language)) {
+      // We need to use the AppendIncludeDirectories method so we handle
+      // situations where backtrace entries have lists.
+      std::vector<std::string> tmp;
+      lg->AppendIncludeDirectories(tmp, tmpInclude.Value, *sf);
+      for (std::string& i : tmp) {
+        bool const isSystemInclude =
+          this->GT->IsSystemIncludeDirectory(i, this->Config, fd.Language);
+        BT<std::string> include(i, tmpInclude.Backtrace);
+        if (this->GT->IsApple() && cmSystemTools::IsPathToFramework(i)) {
+          fd.Frameworks.emplace_back(this->ToJBT(include), isSystemInclude);
+        } else {
+          fd.Includes.emplace_back(this->ToJBT(include), isSystemInclude);
+        }
+      }
+    }
+  }
   // Add include directories from source file properties.
   {
-    std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
     for (BT<std::string> tmpInclude : sf->GetIncludeDirectories()) {
       tmpInclude.Value =
         genexInterpreter.Evaluate(tmpInclude.Value, INCLUDE_DIRECTORIES);
@@ -1597,7 +1635,25 @@
       genexInterpreter.Evaluate(*config_defs, COMPILE_DEFINITIONS));
   }
 
-  fd.Defines.reserve(fileDefines.size() + configFileDefines.size());
+  std::set<BT<std::string>> fileSetDefines;
+  if (fileSet) {
+    for (BT<std::string> const& tmpDef : fileSet->BelongsTo(this->GT)
+           ? fileSet->GetCompileDefinitions(this->Config, fd.Language)
+           : fileSet->GetInterfaceCompileDefinitions(this->Config,
+                                                     fd.Language)) {
+      // We need to use the AppendDefines method so we handle situations where
+      // backtrace entries have lists.
+      std::set<std::string> tmp;
+      lg->AppendDefines(tmp, tmpDef.Value);
+      for (std::string const& i : tmp) {
+        BT<std::string> def(i, tmpDef.Backtrace);
+        fileSetDefines.insert(def);
+      }
+    }
+  }
+
+  fd.Defines.reserve(fileDefines.size() + configFileDefines.size() +
+                     fileSetDefines.size());
 
   for (BT<std::string> const& def : fileDefines) {
     fd.Defines.emplace_back(this->ToJBT(def));
@@ -1607,6 +1663,10 @@
     fd.Defines.emplace_back(d, JBTIndex());
   }
 
+  for (BT<std::string> const& def : fileSetDefines) {
+    fd.Defines.emplace_back(this->ToJBT(def));
+  }
+
   return fd;
 }
 
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
index 2b4587f..d90b345 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":10}]},{"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":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":{.*}}$
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index 34d0e86..b3958e7 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -13,7 +13,7 @@
     assert is_list(o)
     assert len(o) == 1
     major = 2
-    minor = 10
+    minor = 11
     check_index_object(o[0], "codemodel", major, minor, check_object_codemodel(g, major, minor))
 
 def check_backtrace(t, b, backtrace):
@@ -1077,6 +1077,8 @@
 
         read_codemodel_json_data("targets/c_headers_1.json"),
         read_codemodel_json_data("targets/c_headers_2.json"),
+        read_codemodel_json_data("targets/c_sources_1.json"),
+        read_codemodel_json_data("targets/c_sources_2.json"),
     ]
 
     if sys.platform == "darwin":
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
index ea7a079..1e84bb9 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
@@ -5,7 +5,9 @@
   "childSources": null,
   "targetIds": [
     "^c_headers_1::@6b8db101d64c125f29fe$",
-    "^c_headers_2::@6b8db101d64c125f29fe$"
+    "^c_headers_2::@6b8db101d64c125f29fe$",
+    "^c_sources_1::@6b8db101d64c125f29fe$",
+    "^c_sources_2::@6b8db101d64c125f29fe$"
   ],
   "abstractTargetIds": null,
   "projectName": "codemodel-v2",
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
index ad73de9..658d77b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
@@ -32,7 +32,9 @@
         "^c_static_exe::@6890427a1f51a3e7e1df$",
         "^c_subdir::@6890427a1f51a3e7e1df$",
         "^c_headers_1::@6b8db101d64c125f29fe$",
-        "^c_headers_2::@6b8db101d64c125f29fe$"
+        "^c_headers_2::@6b8db101d64c125f29fe$",
+        "^c_sources_1::@6b8db101d64c125f29fe$",
+        "^c_sources_2::@6b8db101d64c125f29fe$"
     ],
     "abstractTargetIds": [
         "^interface_lib::@6890427a1f51a3e7e1df$"
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
index 1cad522..8df8133 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
@@ -230,6 +230,14 @@
             "backtrace": null
         },
         {
+            "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+            "backtrace": null
+        },
+        {
+            "id": "^c_sources_2::@6b8db101d64c125f29fe$",
+            "backtrace": null
+        },
+        {
             "id": "^static_framework::@217a96c3a62328a73ef4$",
             "backtrace": null
         },
@@ -421,6 +429,14 @@
             "backtrace": null
         },
         {
+            "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+            "backtrace": null
+        },
+        {
+            "id": "^c_sources_2::@6b8db101d64c125f29fe$",
+            "backtrace": null
+        },
+        {
             "id": "^static_framework::@217a96c3a62328a73ef4$",
             "backtrace": null
         },
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_1.json
new file mode 100644
index 0000000..64adf2e
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_1.json
@@ -0,0 +1,188 @@
+{
+  "name": "c_sources_1",
+  "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+  "directorySource": "^fileset$",
+  "projectName": "codemodel-v2",
+  "type": "STATIC_LIBRARY",
+  "imported": null,
+  "local": null,
+  "abstract": null,
+  "symbolic": null,
+  "isGeneratorProvided": null,
+  "fileSets": [
+    {
+      "name": "SOURCES",
+      "type": "SOURCES",
+      "visibility": "PRIVATE",
+      "baseDirectories": [
+        "^fileset$"
+      ]
+    },
+    {
+      "name": "public_srcs",
+      "type": "SOURCES",
+      "visibility": "PUBLIC",
+      "baseDirectories": [
+        "^fileset$"
+      ]
+    }
+  ],
+  "sources": [
+    {
+      "path": "^fileset/empty\\.c$",
+      "isGenerated": null,
+      "fileSetName": "public_srcs",
+      "sourceGroupName": "Source Files",
+      "compileGroupLanguage": "C",
+      "backtrace": [
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": 40,
+          "command": "target_sources",
+          "hasParent": true
+        },
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": null,
+          "command": null,
+          "hasParent": false
+        }
+      ]
+    },
+    {
+      "path": "^fileset/other\\.c$",
+      "isGenerated": null,
+      "fileSetName": "SOURCES",
+      "sourceGroupName": "Source Files",
+      "compileGroupLanguage": null,
+      "backtrace": [
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": 35,
+          "command": "target_sources",
+          "hasParent": true
+        },
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": null,
+          "command": null,
+          "hasParent": false
+        }
+      ]
+    }
+  ],
+  "interfaceSources": [
+    {
+      "path": "^fileset/empty\\.c$",
+      "isGenerated": null,
+      "fileSetName": "SOURCES",
+      "sourceGroupName": "Source Files"
+    }
+  ],
+  "sourceGroups": [
+    {
+      "name": "Source Files",
+      "sourcePaths": [
+        "^fileset/empty\\.c$",
+        "^fileset/other\\.c$"
+      ],
+      "interfaceSourcePaths": [
+        "^fileset/empty\\.c$"
+      ]
+    }
+  ],
+  "compileGroups": [
+    {
+      "language": "C",
+      "sourcePaths": [
+        "^fileset/empty\\.c$"
+      ],
+      "includes": [
+        {
+          "path": "^.*/Tests/RunCMake/FileAPI/fileset/dir$",
+          "isSystem": null,
+          "backtrace": [
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": 46,
+              "command": "set_property",
+              "hasParent": true
+            },
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": null,
+              "command": null,
+              "hasParent": false
+            }
+          ]
+        }
+      ],
+      "frameworks": null,
+      "defines": [
+        {
+          "define": "DEF2",
+          "backtrace": [
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": 43,
+              "command": "set_property",
+              "hasParent": true
+            },
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": null,
+              "command": null,
+              "hasParent": false
+            }
+          ]
+        },
+        {
+          "define": "_MBCS",
+          "backtrace": null
+        }
+      ],
+      "compileCommandFragments": null
+    }
+  ],
+  "backtrace": [
+    {
+      "file": "^fileset/CMakeLists\\.txt$",
+      "line": 33,
+      "command": "add_library",
+      "hasParent": true
+    },
+    {
+      "file": "^fileset/CMakeLists\\.txt$",
+      "line": null,
+      "command": null,
+      "hasParent": false
+    }
+  ],
+  "folder": null,
+  "nameOnDisk": "^(lib)?c_sources_1\\.(a|lib|l)$",
+  "artifacts": [
+    {
+      "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_sources_1\\.(a|lib|l)$",
+      "_dllExtra": false
+    }
+  ],
+  "build": "^fileset$",
+  "source": "^fileset$",
+  "install": null,
+  "link": null,
+  "archive": {
+    "lto": null
+  },
+  "dependencies": [
+    {
+      "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
+      "backtrace": null
+    }
+  ],
+  "linkLibraries": null,
+  "interfaceLinkLibraries": null,
+  "compileDependencies": null,
+  "interfaceCompileDependencies": null,
+  "objectDependencies": null,
+  "orderDependencies": null
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_2.json
new file mode 100644
index 0000000..65c7c77
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_sources_2.json
@@ -0,0 +1,218 @@
+{
+  "name": "c_sources_2",
+  "id": "^c_sources_2::@6b8db101d64c125f29fe$",
+  "directorySource": "^fileset$",
+  "projectName": "codemodel-v2",
+  "type": "STATIC_LIBRARY",
+  "imported": null,
+  "local": null,
+  "abstract": null,
+  "symbolic": null,
+  "isGeneratorProvided": null,
+  "fileSets": null,
+  "sources": [
+    {
+      "path": "^fileset/empty\\.c$",
+      "isGenerated": null,
+      "fileSetName": null,
+      "sourceGroupName": "Source Files",
+      "compileGroupLanguage": "C",
+      "backtrace": [
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": 50,
+          "command": "target_link_libraries",
+          "hasParent": true
+        },
+        {
+          "file": "^fileset/CMakeLists\\.txt$",
+          "line": null,
+          "command": null,
+          "hasParent": false
+        }
+      ]
+    }
+  ],
+  "interfaceSources": null,
+  "sourceGroups": [
+    {
+      "name": "Source Files",
+      "sourcePaths": [
+        "^fileset/empty\\.c$"
+      ],
+      "interfaceSourcePaths": null
+    }
+  ],
+  "compileGroups": [
+    {
+      "language": "C",
+      "sourcePaths": [
+        "^fileset/empty\\.c$"
+      ],
+      "includes": [
+        {
+          "path": "^.*/Tests/RunCMake/FileAPI/fileset/dir$",
+          "isSystem": null,
+          "backtrace": [
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": 47,
+              "command": "set_property",
+              "hasParent": true
+            },
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": null,
+              "command": null,
+              "hasParent": false
+            }
+          ]
+        }
+      ],
+      "frameworks": null,
+      "defines": [
+        {
+          "define": "DEF3",
+          "backtrace": [
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": 44,
+              "command": "set_property",
+              "hasParent": true
+            },
+            {
+              "file": "^fileset/CMakeLists\\.txt$",
+              "line": null,
+              "command": null,
+              "hasParent": false
+            }
+          ]
+        },
+        {
+          "define": "_MBCS",
+          "backtrace": null
+        }
+      ],
+      "compileCommandFragments": null
+    }
+  ],
+  "backtrace": [
+    {
+      "file": "^fileset/CMakeLists\\.txt$",
+      "line": 49,
+      "command": "add_library",
+      "hasParent": true
+    },
+    {
+      "file": "^fileset/CMakeLists\\.txt$",
+      "line": null,
+      "command": null,
+      "hasParent": false
+    }
+  ],
+  "folder": null,
+  "nameOnDisk": "^(lib)?c_sources_2\\.(a|lib|l)$",
+  "artifacts": [
+    {
+      "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_sources_2\\.(a|lib|l)$",
+      "_dllExtra": false
+    }
+  ],
+  "build": "^fileset$",
+  "source": "^fileset$",
+  "install": null,
+  "link": null,
+  "archive": {
+    "lto": null
+  },
+  "dependencies": [
+    {
+      "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
+      "backtrace": null
+    },
+    {
+        "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+        "fragment": null,
+        "backtrace": [
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": 50,
+                "command": "target_link_libraries",
+                "hasParent": true
+            },
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": null,
+                "command": null,
+                "hasParent": false
+            }
+        ],
+        "fromDependency": null
+    }
+  ],
+  "linkLibraries": [
+    {
+        "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+        "fragment": null,
+        "backtrace": [
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": 50,
+                "command": "target_link_libraries",
+                "hasParent": true
+            },
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": null,
+                "command": null,
+                "hasParent": false
+            }
+        ],
+        "fromDependency": null
+    }
+  ],
+  "interfaceLinkLibraries": [
+    {
+        "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+        "fragment": null,
+        "backtrace": [
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": 50,
+                "command": "target_link_libraries",
+                "hasParent": true
+            },
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": null,
+                "command": null,
+                "hasParent": false
+            }
+        ]
+    }
+  ],
+  "compileDependencies": [
+    {
+        "id": "^c_sources_1::@6b8db101d64c125f29fe$",
+        "fragment": null,
+        "backtrace": [
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": 50,
+                "command": "target_link_libraries",
+                "hasParent": true
+            },
+            {
+                "file": "^fileset/CMakeLists\\.txt$",
+                "line": null,
+                "command": null,
+                "hasParent": false
+            }
+        ],
+        "fromDependency": null
+    }
+  ],
+  "interfaceCompileDependencies": null,
+  "objectDependencies": null,
+  "orderDependencies": null
+}
diff --git a/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt
index c318b21..183d721 100644
--- a/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt
@@ -26,3 +26,25 @@
   FILE_SET d
   )
 install(TARGETS c_headers_2)
+
+#
+# SOURCES file set type
+#
+add_library(c_sources_1 STATIC)
+
+target_sources(c_sources_1
+  PRIVATE FILE_SET SOURCES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES other.c
+  )
+set_property(FILE_SET SOURCES TARGET c_sources_1 PROPERTY COMPILE_DEFINITIONS DEF1)
+
+target_sources(c_sources_1
+  PUBLIC FILE_SET public_srcs TYPE SOURCES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES empty.c
+  )
+set_property(FILE_SET public_srcs TARGET c_sources_1 PROPERTY COMPILE_DEFINITIONS DEF2)
+set_property(FILE_SET public_srcs TARGET c_sources_1 PROPERTY INTERFACE_COMPILE_DEFINITIONS DEF3)
+
+set_property(FILE_SET public_srcs TARGET c_sources_1 PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/dir")
+set_property(FILE_SET public_srcs TARGET c_sources_1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/dir")
+
+add_library(c_sources_2 STATIC)
+target_link_libraries(c_sources_2 PRIVATE c_sources_1)