From 88d10d55ac68f2251a549cf09292af8a1fb66ba3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 9 Oct 2015 23:58:19 +0200 Subject: cmGeneratorTarget: Copy IsAppBundleOnApple from cmTarget. Leave the cmTarget method behind for now to implement cmInstallCommand. --- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmGeneratorTarget.cxx | 19 +++++++++++++------ Source/cmGeneratorTarget.h | 3 +++ Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 781220d..3af7b71 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -202,7 +202,7 @@ cmExportBuildFileGenerator std::string prop = "IMPORTED_LOCATION"; prop += suffix; std::string value; - if(target->Target->IsAppBundleOnApple()) + if(target->IsAppBundleOnApple()) { value = target->GetFullPath(config, false); } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 132c0b5..9bdf2f5 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1089,7 +1089,7 @@ cmExportFileGenerator } // Mark the imported executable if it is an application bundle. - if(target->Target->IsAppBundleOnApple()) + if(target->IsAppBundleOnApple()) { os << "set_property(TARGET " << targetName << " PROPERTY MACOSX_BUNDLE 1)\n"; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index d57d67f..a2d6ad1 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -433,7 +433,7 @@ cmExportInstallFileGenerator prop += suffix; // Append the installed file name. - if(target->Target->IsAppBundleOnApple()) + if(target->IsAppBundleOnApple()) { value += itgen->GetInstallFilename(target, config); value += ".app/Contents/MacOS/"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 42b5c63..ab0d02b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -851,7 +851,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const location += cfgid; } - if(this->Target->IsAppBundleOnApple()) + if(this->IsAppBundleOnApple()) { std::string macdir = this->BuildMacContentDirectory("", "", false); @@ -1573,7 +1573,7 @@ cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, bool cmGeneratorTarget::IsBundleOnApple() const { return this->IsFrameworkOnApple() - || this->Target->IsAppBundleOnApple() + || this->IsAppBundleOnApple() || this->Target->IsCFBundleOnApple(); } @@ -1935,7 +1935,7 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base, bool contentOnly) const { std::string fpath = base; - if(this->Target->IsAppBundleOnApple()) + if(this->IsAppBundleOnApple()) { fpath += this->GetAppBundleDirectory(config, contentOnly); } @@ -3143,7 +3143,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config, { std::string fpath = this->GetDirectory(config, implib); fpath += "/"; - if(this->Target->IsAppBundleOnApple()) + if(this->IsAppBundleOnApple()) { fpath = this->BuildMacContentDirectory(fpath, config, false); fpath += "/"; @@ -3438,8 +3438,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, configPostfix = this->GetProperty(configProp); // Mac application bundles and frameworks have no postfix. if(configPostfix && - (this->Target->IsAppBundleOnApple() - || this->IsFrameworkOnApple())) + (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) { configPostfix = 0; } @@ -5955,3 +5954,11 @@ bool cmGeneratorTarget::IsFrameworkOnApple() const this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("FRAMEWORK")); } + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsAppBundleOnApple() const +{ + return (this->GetType() == cmState::EXECUTABLE && + this->Makefile->IsOn("APPLE") && + this->GetPropertyAsBool("MACOSX_BUNDLE")); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 471a500..24a1c2c 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -419,6 +419,9 @@ public: Apple. */ bool IsFrameworkOnApple() const; + /** Return whether this target is an executable Bundle on Apple. */ + bool IsAppBundleOnApple() const; + struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf) const; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 9c0aca0..e16dfd7 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -150,7 +150,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::string to1 = toDir + targetName; // Handle OSX Bundles. - if(this->Target->Target->IsAppBundleOnApple()) + if(this->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 178b462..31fb37b 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -100,7 +100,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Construct the full path version of the names. std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); - if(this->Target->IsAppBundleOnApple()) + if(this->GeneratorTarget->IsAppBundleOnApple()) { this->OSXBundleGenerator->CreateAppBundle(targetName, outpath); } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 4cfbda5..8a4f17e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -412,7 +412,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() gt.GetFullPath(cfgName, /*implib=*/true)); - if (target.IsAppBundleOnApple()) + if (gt.IsAppBundleOnApple()) { // Create the app bundle std::string outpath = gt.GetDirectory(cfgName); -- cgit v0.12