summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-05-17 17:50:32 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-07-26 21:00:01 (GMT)
commit7050ac56a11768c90f55654aa3f63d02bb549243 (patch)
treea436ee5be767bfd776dc93d747abd122a94f3a34 /Source/cmGeneratorTarget.cxx
parent93ed53790cb1e2d5f25f26156ee5c6590b0d3150 (diff)
downloadCMake-7050ac56a11768c90f55654aa3f63d02bb549243.zip
CMake-7050ac56a11768c90f55654aa3f63d02bb549243.tar.gz
CMake-7050ac56a11768c90f55654aa3f63d02bb549243.tar.bz2
macOS: Add support for linking against .xcframework folders
Issue: #21752
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 42be082..cff1574 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8874,6 +8874,47 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
return filename;
}
+std::string cmGeneratorTarget::GetImportedXcFrameworkPath(
+ const std::string& config) const
+{
+ if (!(this->IsApple() && this->IsImported() &&
+ (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::UNKNOWN_LIBRARY))) {
+ return {};
+ }
+
+ std::string desiredConfig = config;
+ if (config.empty()) {
+ desiredConfig = "NOCONFIG";
+ }
+
+ std::string result;
+
+ cmValue loc = nullptr;
+ cmValue imp = nullptr;
+ std::string suffix;
+
+ if (this->Target->GetMappedConfig(desiredConfig, loc, imp, suffix)) {
+ if (loc) {
+ result = *loc;
+ } else {
+ std::string impProp = cmStrCat("IMPORTED_LOCATION", suffix);
+ if (cmValue configLocation = this->GetProperty(impProp)) {
+ result = *configLocation;
+ } else if (cmValue location = this->GetProperty("IMPORTED_LOCATION")) {
+ result = *location;
+ }
+ }
+
+ if (cmSystemTools::IsPathToXcFramework(result)) {
+ return result;
+ }
+ }
+
+ return {};
+}
+
bool cmGeneratorTarget::HaveFortranSources(std::string const& config) const
{
auto sources = cmGeneratorTarget::GetSourceFiles(config);