diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-04-22 22:20:30 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2022-07-06 14:15:23 (GMT) |
commit | 3526b8c1232db2720c5d782ffde8acdc5cb2c191 (patch) | |
tree | 8ee3b7d2adba6f170af58844a1b798916db70dcb /Source/cmExportFileGenerator.cxx | |
parent | fe44cbe9e7849b3c555fbb29c83a54414c0e8629 (diff) | |
download | CMake-3526b8c1232db2720c5d782ffde8acdc5cb2c191.zip CMake-3526b8c1232db2720c5d782ffde8acdc5cb2c191.tar.gz CMake-3526b8c1232db2720c5d782ffde8acdc5cb2c191.tar.bz2 |
cmExport*FileGenerator: support exporting C++ module properties
C++ module properties will be generated at build time, so generate code
that includes the files actually responsible for the information.
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9837269..23b5690 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1305,3 +1305,28 @@ void cmExportFileGenerator::GenerateTargetFileSets(cmGeneratorTarget* gte, os << " )\nendif()\n\n"; } } + +void cmExportFileGenerator::GenerateCxxModuleInformation(std::ostream& os) +{ + auto const cxx_module_dirname = this->GetCxxModulesDirectory(); + if (cxx_module_dirname.empty()) { + return; + } + + // Write the include. + os << "# Include C++ module properties\n" + << "include(\"${CMAKE_CURRENT_LIST_DIR}/" << cxx_module_dirname + << "/cxx-modules.cmake\")\n\n"; + + // Get the path to the file we're going to write. + std::string path = this->MainImportFile; + path = cmSystemTools::GetFilenamePath(path); + auto trampoline_path = + cmStrCat(path, '/', cxx_module_dirname, "/cxx-modules.cmake"); + + // Include all configuration-specific include files. + cmGeneratedFileStream ap(trampoline_path, true); + ap.SetCopyIfDifferent(true); + + this->GenerateCxxModuleConfigInformation(ap); +} |