mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 05:26:58 +08:00
cmCxxModuleMapper: add a query for the open mode for the modmap
GCC (MinGW) wants to use `\n` on Windows too. Fixes: #25974
This commit is contained in:
@@ -434,3 +434,17 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
|
|||||||
assert(false);
|
assert(false);
|
||||||
return {};
|
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;
|
||||||
|
}
|
||||||
|
@@ -83,6 +83,14 @@ struct CxxModuleUsage
|
|||||||
LookupMethod method);
|
LookupMethod method);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class CxxModuleMapMode
|
||||||
|
{
|
||||||
|
Text,
|
||||||
|
Binary,
|
||||||
|
|
||||||
|
Default = Text,
|
||||||
|
};
|
||||||
|
|
||||||
// Return the extension to use for a given modulemap format.
|
// Return the extension to use for a given modulemap format.
|
||||||
cm::static_string_view CxxModuleMapExtension(
|
cm::static_string_view CxxModuleMapExtension(
|
||||||
cm::optional<CxxModuleMapFormat> format);
|
cm::optional<CxxModuleMapFormat> format);
|
||||||
@@ -101,3 +109,6 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
|
|||||||
CxxModuleLocations const& loc,
|
CxxModuleLocations const& loc,
|
||||||
cmScanDepInfo const& obj,
|
cmScanDepInfo const& obj,
|
||||||
CxxModuleUsage const& usages);
|
CxxModuleUsage const& usages);
|
||||||
|
|
||||||
|
// Return the open mode required for the modmap file format.
|
||||||
|
CxxModuleMapMode CxxModuleMapOpenMode(CxxModuleMapFormat format);
|
||||||
|
@@ -2783,7 +2783,10 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
|
|||||||
// `cmNinjaTargetGenerator::WriteObjectBuildStatements` and
|
// `cmNinjaTargetGenerator::WriteObjectBuildStatements` and
|
||||||
// `cmNinjaTargetGenerator::ExportObjectCompileCommand` to generate the
|
// `cmNinjaTargetGenerator::ExportObjectCompileCommand` to generate the
|
||||||
// corresponding file path.
|
// 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.SetCopyIfDifferent(true);
|
||||||
mmf << mm;
|
mmf << mm;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user