summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-02-02 20:54:43 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-08-17 18:42:53 (GMT)
commit159585967a0e4ab99f39de4eec311bac7d0ee0d0 (patch)
treec85b8a8b0f6bbe22e81ade3b8a8740ced8f45eab
parent7b069510c5440f0193f1626be5000cf5efe90442 (diff)
downloadCMake-159585967a0e4ab99f39de4eec311bac7d0ee0d0.zip
CMake-159585967a0e4ab99f39de4eec311bac7d0ee0d0.tar.gz
CMake-159585967a0e4ab99f39de4eec311bac7d0ee0d0.tar.bz2
cmGeneratorTarget: classify BMI-only C++ module sources
-rw-r--r--Source/cmFileAPICodemodel.cxx1
-rw-r--r--Source/cmGeneratorTarget.cxx10
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx1
4 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 812b1b5..3c1bc14 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -1678,6 +1678,7 @@ Json::Value Target::DumpSource(cmGeneratorTarget::SourceAndKind const& sk,
}
switch (sk.Kind) {
+ case cmGeneratorTarget::SourceKindCxxModuleSource:
case cmGeneratorTarget::SourceKindObjectSource: {
source["compileGroupIndex"] =
this->AddSourceCompileGroup(sk.Source.Value, si);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c6b2718..c15db5b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1071,6 +1071,12 @@ void cmGeneratorTarget::GetHeaderSources(
IMPLEMENT_VISIT(SourceKindHeader);
}
+void cmGeneratorTarget::GetCxxModuleSources(
+ std::vector<cmSourceFile const*>& data, const std::string& config) const
+{
+ IMPLEMENT_VISIT(SourceKindCxxModuleSource);
+}
+
void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
@@ -1953,8 +1959,12 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
// Compute the kind (classification) of this source file.
SourceKind kind;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
+ cmFileSet const* fs = this->GetFileSetForSource(config, sf);
if (sf->GetCustomCommand()) {
kind = SourceKindCustomCommand;
+ } else if (!this->Target->IsNormal() && !this->Target->IsImported() &&
+ fs && (fs->GetType() == "CXX_MODULES"_s)) {
+ kind = SourceKindCxxModuleSource;
} else if (this->Target->GetType() == cmStateEnums::UTILITY ||
this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY
// XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 844454f..3adf5b8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -116,6 +116,7 @@ public:
SourceKindCertificate,
SourceKindCustomCommand,
SourceKindExternalObject,
+ SourceKindCxxModuleSource,
SourceKindExtra,
SourceKindHeader,
SourceKindIDL,
@@ -186,6 +187,8 @@ public:
const std::string& config) const;
void GetHeaderSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
+ void GetCxxModuleSources(std::vector<cmSourceFile const*>&,
+ const std::string& config) const;
void GetExtraSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetCustomCommands(std::vector<cmSourceFile const*>&,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 48f3197..1bd4c57 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2517,6 +2517,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
case cmGeneratorTarget::SourceKindModuleDefinition:
tool = "None";
break;
+ case cmGeneratorTarget::SourceKindCxxModuleSource:
case cmGeneratorTarget::SourceKindUnityBatched:
case cmGeneratorTarget::SourceKindObjectSource: {
const std::string& lang = si.Source->GetLanguage();