cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget.

This commit is contained in:
Stephen Kelly 2015-10-09 23:59:10 +02:00
parent 7550879f57
commit d8f8940bc6
9 changed files with 26 additions and 26 deletions

View File

@ -1095,7 +1095,7 @@ cmExportFileGenerator
<< " PROPERTY MACOSX_BUNDLE 1)\n"; << " PROPERTY MACOSX_BUNDLE 1)\n";
} }
if (target->Target->IsCFBundleOnApple()) if (target->IsCFBundleOnApple())
{ {
os << "set_property(TARGET " << targetName os << "set_property(TARGET " << targetName
<< " PROPERTY BUNDLE 1)\n"; << " PROPERTY BUNDLE 1)\n";

View File

@ -1574,7 +1574,7 @@ bool cmGeneratorTarget::IsBundleOnApple() const
{ {
return this->IsFrameworkOnApple() return this->IsFrameworkOnApple()
|| this->IsAppBundleOnApple() || this->IsAppBundleOnApple()
|| this->Target->IsCFBundleOnApple(); || this->IsCFBundleOnApple();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1943,7 +1943,7 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
{ {
fpath += this->GetFrameworkDirectory(config, contentOnly); fpath += this->GetFrameworkDirectory(config, contentOnly);
} }
if(this->Target->IsCFBundleOnApple()) if(this->IsCFBundleOnApple())
{ {
fpath += this->GetCFBundleDirectory(config, contentOnly); fpath += this->GetCFBundleDirectory(config, contentOnly);
} }
@ -3483,7 +3483,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
targetSuffix = 0; targetSuffix = 0;
} }
if(this->Target->IsCFBundleOnApple()) if(this->IsCFBundleOnApple())
{ {
fw_prefix = this->GetCFBundleDirectory(config, false); fw_prefix = this->GetCFBundleDirectory(config, false);
fw_prefix += "/"; fw_prefix += "/";
@ -5966,6 +5966,14 @@ bool cmGeneratorTarget::IsAppBundleOnApple() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorTarget::IsXCTestOnApple() const bool cmGeneratorTarget::IsXCTestOnApple() const
{ {
return (this->Target->IsCFBundleOnApple() && return (this->IsCFBundleOnApple() &&
this->GetPropertyAsBool("XCTEST")); this->GetPropertyAsBool("XCTEST"));
} }
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsCFBundleOnApple() const
{
return (this->GetType() == cmState::MODULE_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("BUNDLE"));
}

View File

@ -425,6 +425,9 @@ public:
/** Return whether this target is a XCTest on Apple. */ /** Return whether this target is a XCTest on Apple. */
bool IsXCTestOnApple() const; bool IsXCTestOnApple() const;
/** Return whether this target is a CFBundle (plugin) on Apple. */
bool IsCFBundleOnApple() const;
struct SourceFileFlags struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const; GetTargetSourceFileFlags(const cmSourceFile* sf) const;

View File

@ -1197,7 +1197,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// some build phases only apply to bundles and/or frameworks // some build phases only apply to bundles and/or frameworks
bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"); bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
bool isCFBundleTarget = cmtarget.IsCFBundleOnApple(); bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
cmXCodeObject* buildFiles = 0; cmXCodeObject* buildFiles = 0;
@ -1993,7 +1993,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
pndir = gtgt->GetDirectory(configName); pndir = gtgt->GetDirectory(configName);
} }
if(gtgt->IsFrameworkOnApple() || target.IsCFBundleOnApple()) if(gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple())
{ {
pnprefix = ""; pnprefix = "";
} }
@ -2046,7 +2046,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{ {
buildSettings->AddAttribute("LIBRARY_STYLE", buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE")); this->CreateString("BUNDLE"));
if (target.IsCFBundleOnApple()) if (gtgt->IsCFBundleOnApple())
{ {
// It turns out that a BUNDLE is basically the same // It turns out that a BUNDLE is basically the same
// in many ways as an application bundle, as far as // in many ways as an application bundle, as far as
@ -2653,7 +2653,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (target->IsXCTestOnApple()) if (target->IsXCTestOnApple())
return "wrapper.cfbundle"; return "wrapper.cfbundle";
else if (target->Target->IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "wrapper.plug-in"; return "wrapper.plug-in";
else else
return ((this->XcodeVersion >= 22)? return ((this->XcodeVersion >= 22)?
@ -2680,7 +2680,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (target->IsXCTestOnApple()) if (target->IsXCTestOnApple())
return "com.apple.product-type.bundle.unit-test"; return "com.apple.product-type.bundle.unit-test";
else if (target->Target->IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "com.apple.product-type.bundle"; return "com.apple.product-type.bundle";
else else
return ((this->XcodeVersion >= 22)? return ((this->XcodeVersion >= 22)?

View File

@ -226,7 +226,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1); filesFrom.push_back(from1);
filesTo.push_back(to1); filesTo.push_back(to1);
} }
else if(this->Target->Target->IsCFBundleOnApple()) else if(this->Target->IsCFBundleOnApple())
{ {
// Install the whole app bundle directory. // Install the whole app bundle directory.
type = cmInstallType_DIRECTORY; type = cmInstallType_DIRECTORY;

View File

@ -279,7 +279,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
this->OSXBundleGenerator->CreateFramework(targetName, outpath); this->OSXBundleGenerator->CreateFramework(targetName, outpath);
outpath += "/"; outpath += "/";
} }
else if(this->Target->IsCFBundleOnApple()) else if(this->GeneratorTarget->IsCFBundleOnApple())
{ {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateCFBundle(targetName, outpath); this->OSXBundleGenerator->CreateCFBundle(targetName, outpath);
@ -360,7 +360,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
buildEcho += " shared library "; buildEcho += " shared library ";
break; break;
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (this->Target->IsCFBundleOnApple()) if (this->GeneratorTarget->IsCFBundleOnApple())
buildEcho += " CFBundle"; buildEcho += " CFBundle";
buildEcho += " shared module "; buildEcho += " shared module ";
break; break;

View File

@ -139,7 +139,7 @@ const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
return "shared library"; return "shared library";
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (this->GetTarget()->IsCFBundleOnApple()) if (this->GetGeneratorTarget()->IsCFBundleOnApple())
return "CFBundle shared module"; return "CFBundle shared module";
else else
return "shared module"; return "shared module";
@ -434,7 +434,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
gt.GetDirectory(cfgName)); gt.GetDirectory(cfgName));
} }
else if(target.IsCFBundleOnApple()) else if(gt.IsCFBundleOnApple())
{ {
// Create the core foundation bundle. // Create the core foundation bundle.
this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut,

View File

@ -368,14 +368,6 @@ bool cmTarget::IsAppBundleOnApple() const
this->GetPropertyAsBool("MACOSX_BUNDLE")); this->GetPropertyAsBool("MACOSX_BUNDLE"));
} }
//----------------------------------------------------------------------------
bool cmTarget::IsCFBundleOnApple() const
{
return (this->GetType() == cmState::MODULE_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("BUNDLE"));
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
{ {

View File

@ -235,9 +235,6 @@ public:
Apple. */ Apple. */
bool IsFrameworkOnApple() const; 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. */ /** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const; bool IsAppBundleOnApple() const;