|
@@ -13,6 +13,7 @@
|
|
|
#include <cm/string_view>
|
|
|
#include <cmext/string_view>
|
|
|
|
|
|
+#include "cmExportFileGenerator.h"
|
|
|
#include "cmExportSet.h"
|
|
|
#include "cmFileSet.h"
|
|
|
#include "cmGeneratedFileStream.h"
|
|
@@ -224,48 +225,17 @@ void cmExportInstallCMakeConfigGenerator::LoadConfigFiles(std::ostream& os)
|
|
|
/* clang-format on */
|
|
|
}
|
|
|
|
|
|
-bool cmExportInstallCMakeConfigGenerator::GenerateImportFileConfig(
|
|
|
- std::string const& config)
|
|
|
+void cmExportInstallCMakeConfigGenerator::GenerateImportConfig(
|
|
|
+ std::ostream& os, std::string const& config)
|
|
|
{
|
|
|
- // Skip configurations not enabled for this export.
|
|
|
- if (!this->IEGen->InstallsForConfig(config)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- // Construct the name of the file to generate.
|
|
|
- std::string fileName = cmStrCat(this->FileDir, '/', this->FileBase, '-');
|
|
|
- if (!config.empty()) {
|
|
|
- fileName += cmSystemTools::LowerCase(config);
|
|
|
- } else {
|
|
|
- fileName += "noconfig";
|
|
|
- }
|
|
|
- fileName += this->FileExt;
|
|
|
-
|
|
|
- // Open the output file to generate it.
|
|
|
- cmGeneratedFileStream exportFileStream(fileName, true);
|
|
|
- if (!exportFileStream) {
|
|
|
- std::string se = cmSystemTools::GetLastSystemError();
|
|
|
- std::ostringstream e;
|
|
|
- e << "cannot write to file \"" << fileName << "\": " << se;
|
|
|
- cmSystemTools::Error(e.str());
|
|
|
- return false;
|
|
|
- }
|
|
|
- exportFileStream.SetCopyIfDifferent(true);
|
|
|
- std::ostream& os = exportFileStream;
|
|
|
-
|
|
|
// Start with the import file header.
|
|
|
this->GenerateImportHeaderCode(os, config);
|
|
|
|
|
|
// Generate the per-config target information.
|
|
|
- this->GenerateImportConfig(os, config);
|
|
|
+ this->cmExportFileGenerator::GenerateImportConfig(os, config);
|
|
|
|
|
|
// End with the import file footer.
|
|
|
this->GenerateImportFooterCode(os);
|
|
|
-
|
|
|
- // Record this per-config import file.
|
|
|
- this->ConfigImportFiles[config] = fileName;
|
|
|
-
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
void cmExportInstallCMakeConfigGenerator::GenerateImportTargetsConfig(
|