|
@@ -6,12 +6,7 @@
|
|
|
#include <sstream>
|
|
|
#include <utility>
|
|
|
|
|
|
-#include <cm/memory>
|
|
|
-
|
|
|
#include "cmCryptoHash.h"
|
|
|
-#ifndef CMAKE_BOOTSTRAP
|
|
|
-# include "cmExportInstallAndroidMKGenerator.h"
|
|
|
-#endif
|
|
|
#include "cmExportInstallFileGenerator.h"
|
|
|
#include "cmExportSet.h"
|
|
|
#include "cmInstallType.h"
|
|
@@ -22,29 +17,20 @@
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
|
cmInstallExportGenerator::cmInstallExportGenerator(
|
|
|
- cmExportSet* exportSet, std::string const& destination,
|
|
|
- std::string file_permissions, std::vector<std::string> const& configurations,
|
|
|
- std::string const& component, MessageLevel message, bool exclude_from_all,
|
|
|
- std::string filename, std::string name_space,
|
|
|
- std::string cxx_modules_directory, bool exportOld, bool android,
|
|
|
- bool exportPackageDependencies, cmListFileBacktrace backtrace)
|
|
|
- : cmInstallGenerator(destination, configurations, component, message,
|
|
|
- exclude_from_all, false, std::move(backtrace))
|
|
|
+ cmExportSet* exportSet, std::string destination, std::string filePermissions,
|
|
|
+ std::vector<std::string> const& configurations, std::string component,
|
|
|
+ MessageLevel message, bool excludeFromAll, std::string filename,
|
|
|
+ std::string targetNamespace, std::string cxxModulesDirectory,
|
|
|
+ cmListFileBacktrace backtrace)
|
|
|
+ : cmInstallGenerator(std::move(destination), configurations,
|
|
|
+ std::move(component), message, excludeFromAll, false,
|
|
|
+ std::move(backtrace))
|
|
|
, ExportSet(exportSet)
|
|
|
- , FilePermissions(std::move(file_permissions))
|
|
|
+ , FilePermissions(std::move(filePermissions))
|
|
|
, FileName(std::move(filename))
|
|
|
- , Namespace(std::move(name_space))
|
|
|
- , CxxModulesDirectory(std::move(cxx_modules_directory))
|
|
|
- , ExportOld(exportOld)
|
|
|
- , ExportPackageDependencies(exportPackageDependencies)
|
|
|
+ , Namespace(std::move(targetNamespace))
|
|
|
+ , CxxModulesDirectory(std::move(cxxModulesDirectory))
|
|
|
{
|
|
|
- if (android) {
|
|
|
-#ifndef CMAKE_BOOTSTRAP
|
|
|
- this->EFGen = cm::make_unique<cmExportInstallAndroidMKGenerator>(this);
|
|
|
-#endif
|
|
|
- } else {
|
|
|
- this->EFGen = cm::make_unique<cmExportInstallFileGenerator>(this);
|
|
|
- }
|
|
|
exportSet->AddInstallation(this);
|
|
|
}
|
|
|
|
|
@@ -92,7 +78,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
|
|
|
// Skip empty sets.
|
|
|
if (this->ExportSet->GetTargetExports().empty()) {
|
|
|
std::ostringstream e;
|
|
|
- e << "INSTALL(EXPORT) given unknown export \""
|
|
|
+ e << "INSTALL(" << this->InstallSubcommand() << ") given unknown export \""
|
|
|
<< this->ExportSet->GetName() << "\"";
|
|
|
cmSystemTools::Error(e.str());
|
|
|
return;
|
|
@@ -108,7 +94,6 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
|
|
|
// Generate the import file for this export set.
|
|
|
this->EFGen->SetExportFile(this->MainImportFile.c_str());
|
|
|
this->EFGen->SetNamespace(this->Namespace);
|
|
|
- this->EFGen->SetExportOld(this->ExportOld);
|
|
|
if (this->ConfigurationTypes->empty()) {
|
|
|
if (!this->ConfigurationName.empty()) {
|
|
|
this->EFGen->AddConfiguration(this->ConfigurationName);
|
|
@@ -120,7 +105,6 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
|
|
|
this->EFGen->AddConfiguration(c);
|
|
|
}
|
|
|
}
|
|
|
- this->EFGen->SetExportPackageDependencies(this->ExportPackageDependencies);
|
|
|
this->EFGen->GenerateImportFile();
|
|
|
|
|
|
// Perform the main install script generation.
|
|
@@ -149,22 +133,18 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
|
|
|
// Now create a configuration-specific install rule for the C++ module import
|
|
|
// property file of each configuration.
|
|
|
- auto cxx_module_dest =
|
|
|
+ auto const cxxModuleDestination =
|
|
|
cmStrCat(this->Destination, '/', this->CxxModulesDirectory);
|
|
|
- std::string config_file_example;
|
|
|
- for (auto const& i : this->EFGen->GetConfigCxxModuleFiles()) {
|
|
|
- config_file_example = i.second;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (!config_file_example.empty()) {
|
|
|
+ auto const cxxModuleInstallFilePath = this->EFGen->GetCxxModuleFile();
|
|
|
+ if (!cxxModuleInstallFilePath.empty()) {
|
|
|
+ auto const cxxModuleFilename =
|
|
|
+ cmSystemTools::GetFilenameName(cxxModuleInstallFilePath);
|
|
|
+
|
|
|
// Remove old per-configuration export files if the main changes.
|
|
|
- std::string installedDir = cmStrCat(
|
|
|
- "$ENV{DESTDIR}", ConvertToAbsoluteDestination(cxx_module_dest), '/');
|
|
|
- std::string installedFile = cmStrCat(installedDir, "/cxx-modules-",
|
|
|
- this->ExportSet->GetName(), ".cmake");
|
|
|
- std::string toInstallFile =
|
|
|
- cmStrCat(cmSystemTools::GetFilenamePath(config_file_example),
|
|
|
- "/cxx-modules-", this->ExportSet->GetName(), ".cmake");
|
|
|
+ std::string installedDir =
|
|
|
+ cmStrCat("$ENV{DESTDIR}",
|
|
|
+ ConvertToAbsoluteDestination(cxxModuleDestination), '/');
|
|
|
+ std::string installedFile = cmStrCat(installedDir, cxxModuleFilename);
|
|
|
os << indent << "if(EXISTS \"" << installedFile << "\")\n";
|
|
|
Indent indentN = indent.Next();
|
|
|
Indent indentNN = indentN.Next();
|
|
@@ -172,7 +152,7 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
/* clang-format off */
|
|
|
os << indentN << "file(DIFFERENT _cmake_export_file_changed FILES\n"
|
|
|
<< indentN << " \"" << installedFile << "\"\n"
|
|
|
- << indentN << " \"" << toInstallFile << "\")\n";
|
|
|
+ << indentN << " \"" << cxxModuleInstallFilePath << "\")\n";
|
|
|
os << indentN << "if(_cmake_export_file_changed)\n";
|
|
|
os << indentNN << "file(GLOB _cmake_old_config_files \"" << installedDir
|
|
|
<< this->EFGen->GetConfigImportFileGlob() << "\")\n";
|
|
@@ -191,8 +171,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
|
|
|
// All of these files are siblings; get its location to know where the
|
|
|
// "anchor" file is.
|
|
|
- files.push_back(toInstallFile);
|
|
|
- this->AddInstallRule(os, cxx_module_dest, cmInstallType_FILES, files,
|
|
|
+ files.push_back(cxxModuleInstallFilePath);
|
|
|
+ this->AddInstallRule(os, cxxModuleDestination, cmInstallType_FILES, files,
|
|
|
false, this->FilePermissions.c_str(), nullptr,
|
|
|
nullptr, nullptr, indent);
|
|
|
files.clear();
|
|
@@ -201,7 +181,7 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
files.push_back(i.second);
|
|
|
std::string config_test = this->CreateConfigTest(i.first);
|
|
|
os << indent << "if(" << config_test << ")\n";
|
|
|
- this->AddInstallRule(os, cxx_module_dest, cmInstallType_FILES, files,
|
|
|
+ this->AddInstallRule(os, cxxModuleDestination, cmInstallType_FILES, files,
|
|
|
false, this->FilePermissions.c_str(), nullptr,
|
|
|
nullptr, nullptr, indent.Next());
|
|
|
os << indent << "endif()\n";
|
|
@@ -210,9 +190,9 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
for (auto const& i : this->EFGen->GetConfigCxxModuleTargetFiles()) {
|
|
|
std::string config_test = this->CreateConfigTest(i.first);
|
|
|
os << indent << "if(" << config_test << ")\n";
|
|
|
- this->AddInstallRule(os, cxx_module_dest, cmInstallType_FILES, i.second,
|
|
|
- false, this->FilePermissions.c_str(), nullptr,
|
|
|
- nullptr, nullptr, indent.Next());
|
|
|
+ this->AddInstallRule(os, cxxModuleDestination, cmInstallType_FILES,
|
|
|
+ i.second, false, this->FilePermissions.c_str(),
|
|
|
+ nullptr, nullptr, nullptr, indent.Next());
|
|
|
os << indent << "endif()\n";
|
|
|
files.clear();
|
|
|
}
|