1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-18 00:02:21 +08:00

cmExportFileGenerator: Add function to set required CMake version

This commit is contained in:
Kyle Edwards
2023-11-08 10:21:11 -05:00
parent e62a3b8625
commit 2837f592ab
6 changed files with 48 additions and 44 deletions

View File

@@ -76,9 +76,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
// Compute the relative import prefix for the file
this->GenerateImportPrefix(os);
bool require2_8_12 = false;
bool require3_0_0 = false;
bool require3_1_0 = false;
bool requiresConfigFiles = false;
// Create all the imported targets.
for (cmTargetExport* te : allTargets) {
@@ -147,16 +144,16 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
if (this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties) &&
!this->ExportOld) {
require2_8_12 = true;
this->SetRequiredCMakeVersion(2, 8, 12);
}
}
if (targetType == cmStateEnums::INTERFACE_LIBRARY) {
require3_0_0 = true;
this->SetRequiredCMakeVersion(3, 0, 0);
}
if (gt->GetProperty("INTERFACE_SOURCES")) {
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
// can consume them.
require3_1_0 = true;
this->SetRequiredCMakeVersion(3, 1, 0);
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gt,
@@ -169,14 +166,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateTargetFileSets(gt, os, te);
}
if (require3_1_0) {
this->GenerateRequiredCMakeVersion(os, "3.1.0");
} else if (require3_0_0) {
this->GenerateRequiredCMakeVersion(os, "3.0.0");
} else if (require2_8_12) {
this->GenerateRequiredCMakeVersion(os, "2.8.12");
}
this->LoadConfigFiles(os);
bool result = true;