summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-05-17 15:15:38 (GMT)
committerBrad King <brad.king@kitware.com>2024-05-17 15:15:38 (GMT)
commit32a8d5a4acee9d116031d7e54a90000940f03a50 (patch)
treef6461d1decf013e0236b5f94568b21f8fca76567
parent20b63a87ed35fb8d61b35d2e33542d192e9b3a16 (diff)
parent9e2f31ec23ec982d9ad67ab18284b28ce01930a1 (diff)
downloadCMake-32a8d5a4acee9d116031d7e54a90000940f03a50.zip
CMake-32a8d5a4acee9d116031d7e54a90000940f03a50.tar.gz
CMake-32a8d5a4acee9d116031d7e54a90000940f03a50.tar.bz2
Merge topic 'cxxmodules-gcc-binary-mode' into release-3.28
9e2f31ec23 cmCxxModuleMapper: add a query for the open mode for the modmap Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9525
-rw-r--r--Source/cmCxxModuleMapper.cxx14
-rw-r--r--Source/cmCxxModuleMapper.h11
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
3 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx
index b6b9540..4b2aec7 100644
--- a/Source/cmCxxModuleMapper.cxx
+++ b/Source/cmCxxModuleMapper.cxx
@@ -434,3 +434,17 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
assert(false);
return {};
}
+
+CxxModuleMapMode CxxModuleMapOpenMode(CxxModuleMapFormat format)
+{
+ switch (format) {
+ case CxxModuleMapFormat::Gcc:
+ return CxxModuleMapMode::Binary;
+ case CxxModuleMapFormat::Clang:
+ case CxxModuleMapFormat::Msvc:
+ return CxxModuleMapMode::Default;
+ }
+
+ assert(false);
+ return CxxModuleMapMode::Default;
+}
diff --git a/Source/cmCxxModuleMapper.h b/Source/cmCxxModuleMapper.h
index c785099..898396c 100644
--- a/Source/cmCxxModuleMapper.h
+++ b/Source/cmCxxModuleMapper.h
@@ -83,6 +83,14 @@ struct CxxModuleUsage
LookupMethod method);
};
+enum class CxxModuleMapMode
+{
+ Text,
+ Binary,
+
+ Default = Text,
+};
+
// Return the extension to use for a given modulemap format.
cm::static_string_view CxxModuleMapExtension(
cm::optional<CxxModuleMapFormat> format);
@@ -101,3 +109,6 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
CxxModuleLocations const& loc,
cmScanDepInfo const& obj,
CxxModuleUsage const& usages);
+
+// Return the open mode required for the modmap file format.
+CxxModuleMapMode CxxModuleMapOpenMode(CxxModuleMapFormat format);
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index f350efa..4ad801f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -2783,7 +2783,10 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
// `cmNinjaTargetGenerator::WriteObjectBuildStatements` and
// `cmNinjaTargetGenerator::ExportObjectCompileCommand` to generate the
// corresponding file path.
- cmGeneratedFileStream mmf(cmStrCat(object.PrimaryOutput, ".modmap"));
+ cmGeneratedFileStream mmf;
+ mmf.Open(cmStrCat(object.PrimaryOutput, ".modmap"), false,
+ CxxModuleMapOpenMode(*modmap_fmt) ==
+ CxxModuleMapMode::Binary);
mmf.SetCopyIfDifferent(true);
mmf << mm;
}