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/cmExportCommand.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/cmExportCommand.cxx')
-rw-r--r-- | Source/cmExportCommand.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index e7a69b0..9c3bc61 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -72,6 +72,8 @@ bool cmExportCommand(std::vector<std::string> const& args, std::vector<std::vector<std::string>> PackageDependencyArgs; bool ExportPackageDependencies = false; + + std::vector<std::vector<std::string>> TargetArgs; }; auto parser = @@ -87,6 +89,7 @@ bool cmExportCommand(std::vector<std::string> const& args, } else if (args[0] == "SETUP") { parser.Bind("SETUP"_s, &Arguments::ExportSetName); parser.Bind("PACKAGE_DEPENDENCY"_s, &Arguments::PackageDependencyArgs); + parser.Bind("TARGET"_s, &Arguments::TargetArgs); } else { parser.Bind("TARGETS"_s, &Arguments::Targets); parser.Bind("ANDROID_MK"_s, &Arguments::AndroidMKFile); @@ -159,6 +162,31 @@ bool cmExportCommand(std::vector<std::string> const& args, packageDependencyArguments.ExtraArgs); } + struct TargetArguments + { + std::string XcFrameworkLocation; + }; + + auto targetParser = cmArgumentParser<TargetArguments>{}.Bind( + "XCFRAMEWORK_LOCATION"_s, &TargetArguments::XcFrameworkLocation); + + for (auto const& targetArgs : arguments.TargetArgs) { + if (targetArgs.empty()) { + continue; + } + + TargetArguments const targetArguments = + targetParser.Parse(cmMakeRange(targetArgs).advance(1), &unknownArgs); + + if (!unknownArgs.empty()) { + status.SetError("Unknown argument: \"" + unknownArgs.front() + "\"."); + return false; + } + + exportSet.SetXcFrameworkLocation(targetArgs.front(), + targetArguments.XcFrameworkLocation); + } + return true; } @@ -242,7 +270,7 @@ bool cmExportCommand(std::vector<std::string> const& args, status.SetError(e.str()); return false; } - targets.emplace_back(currentTarget); + targets.emplace_back(currentTarget, std::string{}); } if (arguments.Append) { if (cmExportBuildFileGenerator* ebfg = |