From d8f8940bc68f09e382320d1ffe36947ba880ae65 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 9 Oct 2015 23:59:10 +0200 Subject: cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget. --- Source/cmExportFileGenerator.cxx | 2 +- Source/cmGeneratorTarget.cxx | 16 ++++++++++++---- Source/cmGeneratorTarget.h | 3 +++ Source/cmGlobalXCodeGenerator.cxx | 10 +++++----- Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 4 ++-- Source/cmNinjaNormalTargetGenerator.cxx | 4 ++-- Source/cmTarget.cxx | 8 -------- Source/cmTarget.h | 3 --- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9bdf2f5..5177ec8 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1095,7 +1095,7 @@ cmExportFileGenerator << " PROPERTY MACOSX_BUNDLE 1)\n"; } - if (target->Target->IsCFBundleOnApple()) + if (target->IsCFBundleOnApple()) { os << "set_property(TARGET " << targetName << " PROPERTY BUNDLE 1)\n"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7e457bb..b2959fe 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1574,7 +1574,7 @@ bool cmGeneratorTarget::IsBundleOnApple() const { return this->IsFrameworkOnApple() || this->IsAppBundleOnApple() - || this->Target->IsCFBundleOnApple(); + || this->IsCFBundleOnApple(); } //---------------------------------------------------------------------------- @@ -1943,7 +1943,7 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base, { fpath += this->GetFrameworkDirectory(config, contentOnly); } - if(this->Target->IsCFBundleOnApple()) + if(this->IsCFBundleOnApple()) { fpath += this->GetCFBundleDirectory(config, contentOnly); } @@ -3483,7 +3483,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, targetSuffix = 0; } - if(this->Target->IsCFBundleOnApple()) + if(this->IsCFBundleOnApple()) { fw_prefix = this->GetCFBundleDirectory(config, false); fw_prefix += "/"; @@ -5966,6 +5966,14 @@ bool cmGeneratorTarget::IsAppBundleOnApple() const //---------------------------------------------------------------------------- bool cmGeneratorTarget::IsXCTestOnApple() const { - return (this->Target->IsCFBundleOnApple() && + return (this->IsCFBundleOnApple() && this->GetPropertyAsBool("XCTEST")); } + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsCFBundleOnApple() const +{ + return (this->GetType() == cmState::MODULE_LIBRARY && + this->Makefile->IsOn("APPLE") && + this->GetPropertyAsBool("BUNDLE")); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index ce2f42e..6537421 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -425,6 +425,9 @@ public: /** Return whether this target is a XCTest on Apple. */ bool IsXCTestOnApple() const; + /** Return whether this target is a CFBundle (plugin) on Apple. */ + bool IsCFBundleOnApple() const; + struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a489767..ea1b1a0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1197,7 +1197,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, // some build phases only apply to bundles and/or frameworks bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"); - bool isCFBundleTarget = cmtarget.IsCFBundleOnApple(); + bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); cmXCodeObject* buildFiles = 0; @@ -1993,7 +1993,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, pndir = gtgt->GetDirectory(configName); } - if(gtgt->IsFrameworkOnApple() || target.IsCFBundleOnApple()) + if(gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { pnprefix = ""; } @@ -2046,7 +2046,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("BUNDLE")); - if (target.IsCFBundleOnApple()) + if (gtgt->IsCFBundleOnApple()) { // It turns out that a BUNDLE is basically the same // in many ways as an application bundle, as far as @@ -2653,7 +2653,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( case cmState::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "wrapper.cfbundle"; - else if (target->Target->IsCFBundleOnApple()) + else if (target->IsCFBundleOnApple()) return "wrapper.plug-in"; else return ((this->XcodeVersion >= 22)? @@ -2680,7 +2680,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( case cmState::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "com.apple.product-type.bundle.unit-test"; - else if (target->Target->IsCFBundleOnApple()) + else if (target->IsCFBundleOnApple()) return "com.apple.product-type.bundle"; else return ((this->XcodeVersion >= 22)? diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e16dfd7..a97cc5f 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -226,7 +226,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); } - else if(this->Target->Target->IsCFBundleOnApple()) + else if(this->Target->IsCFBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 015c880..df2a8c9 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -279,7 +279,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->OSXBundleGenerator->CreateFramework(targetName, outpath); outpath += "/"; } - else if(this->Target->IsCFBundleOnApple()) + else if(this->GeneratorTarget->IsCFBundleOnApple()) { outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); this->OSXBundleGenerator->CreateCFBundle(targetName, outpath); @@ -360,7 +360,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules buildEcho += " shared library "; break; case cmState::MODULE_LIBRARY: - if (this->Target->IsCFBundleOnApple()) + if (this->GeneratorTarget->IsCFBundleOnApple()) buildEcho += " CFBundle"; buildEcho += " shared module "; break; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 8a4f17e..dafbda9 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -139,7 +139,7 @@ const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const case cmState::SHARED_LIBRARY: return "shared library"; case cmState::MODULE_LIBRARY: - if (this->GetTarget()->IsCFBundleOnApple()) + if (this->GetGeneratorTarget()->IsCFBundleOnApple()) return "CFBundle shared module"; else return "shared module"; @@ -434,7 +434,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, gt.GetDirectory(cfgName)); } - else if(target.IsCFBundleOnApple()) + else if(gt.IsCFBundleOnApple()) { // Create the core foundation bundle. this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 02a5ea6..f663678 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -369,14 +369,6 @@ bool cmTarget::IsAppBundleOnApple() const } //---------------------------------------------------------------------------- -bool cmTarget::IsCFBundleOnApple() const -{ - return (this->GetType() == cmState::MODULE_LIBRARY && - this->Makefile->IsOn("APPLE") && - this->GetPropertyAsBool("BUNDLE")); -} - -//---------------------------------------------------------------------------- void cmTarget::AddTracedSources(std::vector const& srcs) { if (!srcs.empty()) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 7cf4808..0e966e9 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -235,9 +235,6 @@ public: Apple. */ bool IsFrameworkOnApple() const; - /** Return whether this target is a CFBundle (plugin) on Apple. */ - bool IsCFBundleOnApple() const; - /** Return whether this target is an executable Bundle on Apple. */ bool IsAppBundleOnApple() const; -- cgit v0.12