cmGeneratorTarget: Copy IsAppBundleOnApple from cmTarget.

Leave the cmTarget method behind for now to implement cmInstallCommand.
This commit is contained in:
Stephen Kelly 2015-10-09 23:58:19 +02:00
parent b5f5de70c0
commit 88d10d55ac
8 changed files with 22 additions and 12 deletions

View File

@ -202,7 +202,7 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_LOCATION"; std::string prop = "IMPORTED_LOCATION";
prop += suffix; prop += suffix;
std::string value; std::string value;
if(target->Target->IsAppBundleOnApple()) if(target->IsAppBundleOnApple())
{ {
value = target->GetFullPath(config, false); value = target->GetFullPath(config, false);
} }

View File

@ -1089,7 +1089,7 @@ cmExportFileGenerator
} }
// Mark the imported executable if it is an application bundle. // Mark the imported executable if it is an application bundle.
if(target->Target->IsAppBundleOnApple()) if(target->IsAppBundleOnApple())
{ {
os << "set_property(TARGET " << targetName os << "set_property(TARGET " << targetName
<< " PROPERTY MACOSX_BUNDLE 1)\n"; << " PROPERTY MACOSX_BUNDLE 1)\n";

View File

@ -433,7 +433,7 @@ cmExportInstallFileGenerator
prop += suffix; prop += suffix;
// Append the installed file name. // Append the installed file name.
if(target->Target->IsAppBundleOnApple()) if(target->IsAppBundleOnApple())
{ {
value += itgen->GetInstallFilename(target, config); value += itgen->GetInstallFilename(target, config);
value += ".app/Contents/MacOS/"; value += ".app/Contents/MacOS/";

View File

@ -851,7 +851,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
location += cfgid; location += cfgid;
} }
if(this->Target->IsAppBundleOnApple()) if(this->IsAppBundleOnApple())
{ {
std::string macdir = this->BuildMacContentDirectory("", "", std::string macdir = this->BuildMacContentDirectory("", "",
false); false);
@ -1573,7 +1573,7 @@ cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
bool cmGeneratorTarget::IsBundleOnApple() const bool cmGeneratorTarget::IsBundleOnApple() const
{ {
return this->IsFrameworkOnApple() return this->IsFrameworkOnApple()
|| this->Target->IsAppBundleOnApple() || this->IsAppBundleOnApple()
|| this->Target->IsCFBundleOnApple(); || this->Target->IsCFBundleOnApple();
} }
@ -1935,7 +1935,7 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
bool contentOnly) const bool contentOnly) const
{ {
std::string fpath = base; std::string fpath = base;
if(this->Target->IsAppBundleOnApple()) if(this->IsAppBundleOnApple())
{ {
fpath += this->GetAppBundleDirectory(config, contentOnly); fpath += this->GetAppBundleDirectory(config, contentOnly);
} }
@ -3143,7 +3143,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
{ {
std::string fpath = this->GetDirectory(config, implib); std::string fpath = this->GetDirectory(config, implib);
fpath += "/"; fpath += "/";
if(this->Target->IsAppBundleOnApple()) if(this->IsAppBundleOnApple())
{ {
fpath = this->BuildMacContentDirectory(fpath, config, false); fpath = this->BuildMacContentDirectory(fpath, config, false);
fpath += "/"; fpath += "/";
@ -3438,8 +3438,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
configPostfix = this->GetProperty(configProp); configPostfix = this->GetProperty(configProp);
// Mac application bundles and frameworks have no postfix. // Mac application bundles and frameworks have no postfix.
if(configPostfix && if(configPostfix &&
(this->Target->IsAppBundleOnApple() (this->IsAppBundleOnApple() || this->IsFrameworkOnApple()))
|| this->IsFrameworkOnApple()))
{ {
configPostfix = 0; configPostfix = 0;
} }
@ -5955,3 +5954,11 @@ bool cmGeneratorTarget::IsFrameworkOnApple() const
this->Makefile->IsOn("APPLE") && this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("FRAMEWORK")); this->GetPropertyAsBool("FRAMEWORK"));
} }
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsAppBundleOnApple() const
{
return (this->GetType() == cmState::EXECUTABLE &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}

View File

@ -419,6 +419,9 @@ public:
Apple. */ Apple. */
bool IsFrameworkOnApple() const; bool IsFrameworkOnApple() const;
/** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const;
struct SourceFileFlags struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const; GetTargetSourceFileFlags(const cmSourceFile* sf) const;

View File

@ -150,7 +150,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetName; std::string to1 = toDir + targetName;
// Handle OSX Bundles. // Handle OSX Bundles.
if(this->Target->Target->IsAppBundleOnApple()) if(this->Target->IsAppBundleOnApple())
{ {
// Install the whole app bundle directory. // Install the whole app bundle directory.
type = cmInstallType_DIRECTORY; type = cmInstallType_DIRECTORY;

View File

@ -100,7 +100,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct the full path version of the names. // Construct the full path version of the names.
std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
if(this->Target->IsAppBundleOnApple()) if(this->GeneratorTarget->IsAppBundleOnApple())
{ {
this->OSXBundleGenerator->CreateAppBundle(targetName, outpath); this->OSXBundleGenerator->CreateAppBundle(targetName, outpath);
} }

View File

@ -412,7 +412,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
gt.GetFullPath(cfgName, gt.GetFullPath(cfgName,
/*implib=*/true)); /*implib=*/true));
if (target.IsAppBundleOnApple()) if (gt.IsAppBundleOnApple())
{ {
// Create the app bundle // Create the app bundle
std::string outpath = gt.GetDirectory(cfgName); std::string outpath = gt.GetDirectory(cfgName);