diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-09-21 18:04:54 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-11-15 14:10:58 (GMT) |
commit | 256bb0cc40a9f9f20452f0c0b2480886a577e7cb (patch) | |
tree | cc07534f951465698ace7fefc0bebfc12a456029 /Source/cmExportBuildFileGenerator.cxx | |
parent | a90968e044d04839e610da9a1adf7b6f390e144a (diff) | |
download | CMake-256bb0cc40a9f9f20452f0c0b2480886a577e7cb.zip CMake-256bb0cc40a9f9f20452f0c0b2480886a577e7cb.tar.gz CMake-256bb0cc40a9f9f20452f0c0b2480886a577e7cb.tar.bz2 |
install(EXPORT): Add ability to point to .xcframework file
Issue: #25262
Diffstat (limited to 'Source/cmExportBuildFileGenerator.cxx')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 291619f..8ba8d97 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -61,7 +61,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) expectedTargets += sep + this->Namespace + te->GetExportName(); sep = " "; if (this->ExportedTargets.insert(te).second) { - this->Exports.emplace_back(te); + this->Exports.emplace_back(te, tei.XcFrameworkLocation); } else { std::ostringstream e; e << "given target \"" << te->GetName() << "\" more than once."; @@ -202,7 +202,23 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig( // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, target, properties); + std::string importedXcFrameworkLocation = exp.XcFrameworkLocation; + if (!importedXcFrameworkLocation.empty()) { + importedXcFrameworkLocation = cmGeneratorExpression::Preprocess( + importedXcFrameworkLocation, + cmGeneratorExpression::PreprocessContext::BuildInterface); + importedXcFrameworkLocation = cmGeneratorExpression::Evaluate( + importedXcFrameworkLocation, exp.Target->GetLocalGenerator(), config, + exp.Target, nullptr, exp.Target); + if (!importedXcFrameworkLocation.empty() && + !cmSystemTools::FileIsFullPath(importedXcFrameworkLocation)) { + importedXcFrameworkLocation = + cmStrCat(this->LG->GetCurrentBinaryDirectory(), '/', + importedXcFrameworkLocation); + } + } + this->GenerateImportPropertyCode(os, config, suffix, target, properties, + importedXcFrameworkLocation); } } } @@ -318,7 +334,7 @@ void cmExportBuildFileGenerator::GetTargets( if (te->NamelinkOnly) { continue; } - targets.emplace_back(te->TargetName); + targets.emplace_back(te->TargetName, te->XcFrameworkLocation); } return; } |