diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2019-03-12 19:36:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-05 14:35:10 (GMT) |
commit | 39cbbb59a52c63cd90eebaecea64fd42c3fad1d8 (patch) | |
tree | 0d78344c83683a5b306087f438fcd8680275c2d8 /Source | |
parent | 791b4d26d6cbcb69615ddfbd1872a34a2e214b39 (diff) | |
download | CMake-39cbbb59a52c63cd90eebaecea64fd42c3fad1d8.zip CMake-39cbbb59a52c63cd90eebaecea64fd42c3fad1d8.tar.gz CMake-39cbbb59a52c63cd90eebaecea64fd42c3fad1d8.tar.bz2 |
ninja: add experimental infrastructure to generate gcc-format modmap files
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 25d6a56..b7ca9b1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2460,7 +2460,30 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( // nothing to do. } else { std::stringstream mm; - if (false) { + if (arg_modmapfmt == "gcc") { + // Documented in GCC's documentation. The format is a series of lines + // with a module name and the associated filename separated by + // spaces. The first line may use `$root` as the module name to + // specify a "repository root". That is used to anchor any relative + // paths present in the file (CMake should never generate any). + + // Write the root directory to use for module paths. + mm << "$root .\n"; + + for (auto const& l : object.Provides) { + auto m = mod_files.find(l.LogicalName); + if (m != mod_files.end()) { + mm << l.LogicalName << " " << this->ConvertToNinjaPath(m->second) + << "\n"; + } + } + for (auto const& r : object.Requires) { + auto m = mod_files.find(r.LogicalName); + if (m != mod_files.end()) { + mm << r.LogicalName << " " << this->ConvertToNinjaPath(m->second) + << "\n"; + } + } } else { cmSystemTools::Error( cmStrCat("-E cmake_ninja_dyndep does not understand the ", |