Merge topic 'builddb-fileset-properties-support'

b81321f9db Build database: add file set flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12111
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0312da4..b2fd3ff 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2178,6 +2178,8 @@
 
   auto* const lg = this->GetLocalGenerator();
   auto const* const mf = this->Makefile;
+  cmGeneratorFileSet const* const fileSet =
+    this->GetFileSetForSource(config, sf);
 
   // Compute the compiler launcher flags.
   if (CanUseCompilerLauncher(lang)) {
@@ -2234,6 +2236,28 @@
     }
   }
 
+  // File set specific flags
+  if (fileSet) {
+    // include flags
+    {
+      auto fsIncludes = fileSet->BelongsTo(this)
+        ? fileSet->GetIncludeDirectories(config, lang)
+        : fileSet->GetInterfaceIncludeDirectories(config, lang);
+      if (!fsIncludes.empty()) {
+        std::vector<std::string> includes;
+        lg->AppendIncludeDirectories(includes, cm::remove_BT(fsIncludes), *sf);
+
+        auto includeFlags =
+          lg->GetIncludeFlags(includes, this, lang, config, false);
+
+        for (auto&& flag : SplitFlags(includeFlags)) {
+          include_flags.emplace_back(FlagClassification::PrivateFlag,
+                                     FlagKind::Include, std::move(flag));
+        }
+      }
+    }
+  }
+
   // Compute target-wide flags.
   {
     FlagClassification cls = FlagClassification::BaselineFlag;
@@ -2325,6 +2349,44 @@
     }
   }
 
+  // File set specific flags
+  if (fileSet) {
+    // Define flags
+    {
+      auto fsDefines = fileSet->BelongsTo(this)
+        ? fileSet->GetCompileDefinitions(config, lang)
+        : fileSet->GetInterfaceCompileDefinitions(config, lang);
+      if (!fsDefines.empty()) {
+        std::set<std::string> defines;
+        lg->AppendDefines(defines, fsDefines);
+
+        std::string defineFlags;
+        lg->JoinDefines(defines, defineFlags, lang);
+
+        for (auto&& flag : SplitFlags(defineFlags)) {
+          define_flags.emplace_back(FlagClassification::PrivateFlag,
+                                    FlagKind::Definition, std::move(flag));
+        }
+      }
+    }
+
+    // Compile flags.
+    {
+      auto options = fileSet->BelongsTo(this)
+        ? fileSet->GetCompileOptions(config, lang)
+        : fileSet->GetInterfaceCompileOptions(config, lang);
+      if (!options.empty()) {
+        std::string compileFlags;
+        lg->AppendCompileOptions(compileFlags, cm::remove_BT(options));
+
+        for (auto&& flag : SplitFlags(compileFlags)) {
+          compile_flags.emplace_back(FlagClassification::PrivateFlag,
+                                     FlagKind::Compile, std::move(flag));
+        }
+      }
+    }
+  }
+
   // Precompiled headers.
   {
     FlagClassification cls = FlagClassification::PrivateFlag;
diff --git a/Tests/RunCMake/CXXModulesCompile/exp-builddb-emptyconfig/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/exp-builddb-emptyconfig/CMakeLists.txt
index 17ab78d..31b75cd 100644
--- a/Tests/RunCMake/CXXModulesCompile/exp-builddb-emptyconfig/CMakeLists.txt
+++ b/Tests/RunCMake/CXXModulesCompile/exp-builddb-emptyconfig/CMakeLists.txt
@@ -44,6 +44,10 @@
   PRIVATE
     provide_flags)
 
+set_property(FILE_SET modules TARGET export_build_database PROPERTY COMPILE_OPTIONS "-Dfileset_private_option")
+set_property(FILE_SET modules TARGET export_build_database PROPERTY COMPILE_DEFINITIONS "fileset_private_define")
+set_property(FILE_SET modules TARGET export_build_database PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/fileset_private_include")
+
 set_property(SOURCE importable.cxx APPEND
   PROPERTY COMPILE_FLAGS "-Dfrom_source_flag")
 set_property(SOURCE importable.cxx APPEND
diff --git a/Tests/RunCMake/CXXModulesCompile/exp-builddb/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/exp-builddb/CMakeLists.txt
index 0ce2072..1cf3806 100644
--- a/Tests/RunCMake/CXXModulesCompile/exp-builddb/CMakeLists.txt
+++ b/Tests/RunCMake/CXXModulesCompile/exp-builddb/CMakeLists.txt
@@ -41,6 +41,10 @@
   PRIVATE
     provide_flags)
 
+set_property(FILE_SET modules TARGET export_build_database PROPERTY COMPILE_OPTIONS "-Dfileset_private_option")
+set_property(FILE_SET modules TARGET export_build_database PROPERTY COMPILE_DEFINITIONS "fileset_private_define")
+set_property(FILE_SET modules TARGET export_build_database PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/fileset_private_include")
+
 set_property(SOURCE importable.cxx APPEND
   PROPERTY COMPILE_FLAGS "-Dfrom_source_flag")
 set_property(SOURCE importable.cxx APPEND
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all-multi.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all-multi.json
index 1cb79bb..4808965 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all-multi.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all-multi.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
@@ -237,6 +243,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -252,6 +260,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -281,6 +290,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -294,7 +305,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all.json
index 9b13bd0..305d718 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-all.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-config.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-config.json
index 0253351..4b5e8aa 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-config.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-config.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-config.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-config.json
index 0253351..4b5e8aa 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-config.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-config.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-multi.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-multi.json
index 78cde14..490a6ef 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-multi.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx-multi.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
@@ -237,6 +243,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -252,6 +260,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -281,6 +290,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -294,7 +305,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx.json
index 0253351..4b5e8aa 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-cxx.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-all.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-all.json
index 55d0950..8ce6d3f 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-all.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-all.json
@@ -81,6 +81,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -95,6 +97,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb-emptyconfig/importable.cxx"
@@ -123,6 +126,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -135,7 +140,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-cxx.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-cxx.json
index e754c98..2b92eec 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-cxx.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-cxx.json
@@ -81,6 +81,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -95,6 +97,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb-emptyconfig/importable.cxx"
@@ -123,6 +126,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -135,7 +140,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-target.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-target.json
index 55d0950..8ce6d3f 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-target.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-emptyconfig-target.json
@@ -81,6 +81,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -95,6 +97,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb-emptyconfig/importable.cxx"
@@ -123,6 +126,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb-emptyconfig/target_public_include",
@@ -135,7 +140,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir/importable.cxx<OBJEXT>",
           "private": false,
diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-target.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-target.json
index 9b13bd0..305d718 100644
--- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-target.json
+++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-target.json
@@ -84,6 +84,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -99,6 +101,7 @@
             "-Dfrom_source_flag",
             "-Dfrom_source_option",
             "PATH:-Ddepflag=\"CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>.d\"",
+            "-Dfileset_private_option",
             "PATH:<OUTPUT_FLAG>CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
             "-c",
             "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
@@ -128,6 +131,8 @@
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
             "-Dtarget_public_define",
+            "-Dfileset_private_define",
+            "PATH:-I<SOURCE_DIR>/exp-builddb/fileset_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
             "PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
@@ -141,7 +146,8 @@
             "-Dtarget_public_option",
             "-Ddep_interface_option",
             "-Dfrom_source_flag",
-            "-Dfrom_source_option"
+            "-Dfrom_source_option",
+            "-Dfileset_private_option"
           ],
           "object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
           "private": false,