diff options
author | Brad King <brad.king@kitware.com> | 2024-05-17 15:16:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-05-17 15:16:16 (GMT) |
commit | ea44e63a7c8ee7679dbb241d7eab2f4f52a0d9a6 (patch) | |
tree | ccabd7017fe28993b486d181791318a79d75ddf7 /Source | |
parent | 050bba06c17a19696324b3092789dab6ad57d517 (diff) | |
parent | 9e2f31ec23ec982d9ad67ab18284b28ce01930a1 (diff) | |
download | CMake-ea44e63a7c8ee7679dbb241d7eab2f4f52a0d9a6.zip CMake-ea44e63a7c8ee7679dbb241d7eab2f4f52a0d9a6.tar.gz CMake-ea44e63a7c8ee7679dbb241d7eab2f4f52a0d9a6.tar.bz2 |
Merge topic 'cxxmodules-gcc-binary-mode' into release-3.29
9e2f31ec23 cmCxxModuleMapper: add a query for the open mode for the modmap
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9525
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCxxModuleMapper.cxx | 14 | ||||
-rw-r--r-- | Source/cmCxxModuleMapper.h | 11 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 5 |
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 612af4f..250546f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2806,7 +2806,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; } |