cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.
Leave the cmTarget method behind for now to implement cmInstallCommand.
This commit is contained in:
parent
8e20ea6ef2
commit
b5f5de70c0
|
@ -1111,7 +1111,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
|
|||
|
||||
// For compatibility with CMake 2.4 include the item's directory in
|
||||
// the linker search path.
|
||||
if(this->OldLinkDirMode && !target->Target->IsFrameworkOnApple() &&
|
||||
if(this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
|
||||
this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
|
||||
this->OldLinkDirMask.end())
|
||||
{
|
||||
|
|
|
@ -1082,7 +1082,7 @@ cmExportFileGenerator
|
|||
}
|
||||
|
||||
// Mark the imported library if it is a framework.
|
||||
if(target->Target->IsFrameworkOnApple())
|
||||
if(target->IsFrameworkOnApple())
|
||||
{
|
||||
os << "set_property(TARGET " << targetName
|
||||
<< " PROPERTY FRAMEWORK 1)\n";
|
||||
|
|
|
@ -1572,7 +1572,7 @@ cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
|
|||
//----------------------------------------------------------------------------
|
||||
bool cmGeneratorTarget::IsBundleOnApple() const
|
||||
{
|
||||
return this->Target->IsFrameworkOnApple()
|
||||
return this->IsFrameworkOnApple()
|
||||
|| this->Target->IsAppBundleOnApple()
|
||||
|| this->Target->IsCFBundleOnApple();
|
||||
}
|
||||
|
@ -1939,7 +1939,7 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
|
|||
{
|
||||
fpath += this->GetAppBundleDirectory(config, contentOnly);
|
||||
}
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->IsFrameworkOnApple())
|
||||
{
|
||||
fpath += this->GetFrameworkDirectory(config, contentOnly);
|
||||
}
|
||||
|
@ -1959,7 +1959,7 @@ cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
|
|||
std::string fpath = this->GetDirectory(config, implib);
|
||||
fpath += "/";
|
||||
bool contentOnly = true;
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->IsFrameworkOnApple())
|
||||
{
|
||||
// additional files with a framework go into the version specific
|
||||
// directory
|
||||
|
@ -3227,7 +3227,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
|
|||
const char* version = this->GetProperty("VERSION");
|
||||
const char* soversion = this->GetProperty("SOVERSION");
|
||||
if(!this->HasSOName(config) ||
|
||||
this->Target->IsFrameworkOnApple())
|
||||
this->IsFrameworkOnApple())
|
||||
{
|
||||
// Versioning is supported only for shared libraries and modules,
|
||||
// and then only when the platform supports an soname flag.
|
||||
|
@ -3255,7 +3255,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
|
|||
// The library name.
|
||||
name = prefix+base+suffix;
|
||||
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->IsFrameworkOnApple())
|
||||
{
|
||||
realName = prefix;
|
||||
if(!this->Makefile->PlatformIsAppleIos())
|
||||
|
@ -3439,7 +3439,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
|
|||
// Mac application bundles and frameworks have no postfix.
|
||||
if(configPostfix &&
|
||||
(this->Target->IsAppBundleOnApple()
|
||||
|| this->Target->IsFrameworkOnApple()))
|
||||
|| this->IsFrameworkOnApple()))
|
||||
{
|
||||
configPostfix = 0;
|
||||
}
|
||||
|
@ -3476,7 +3476,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
|
|||
|
||||
// frameworks have directory prefix but no suffix
|
||||
std::string fw_prefix;
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->IsFrameworkOnApple())
|
||||
{
|
||||
fw_prefix = this->GetOutputName(config, false);
|
||||
fw_prefix += ".framework/";
|
||||
|
@ -5947,3 +5947,11 @@ bool cmGeneratorTarget::IsLinkable() const
|
|||
this->GetType() == cmState::INTERFACE_LIBRARY ||
|
||||
this->Target->IsExecutableWithExports());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmGeneratorTarget::IsFrameworkOnApple() const
|
||||
{
|
||||
return (this->GetType() == cmState::SHARED_LIBRARY &&
|
||||
this->Makefile->IsOn("APPLE") &&
|
||||
this->GetPropertyAsBool("FRAMEWORK"));
|
||||
}
|
||||
|
|
|
@ -415,6 +415,10 @@ public:
|
|||
/** Return whether this target may be used to link another target. */
|
||||
bool IsLinkable() const;
|
||||
|
||||
/** Return whether this target is a shared library Framework on
|
||||
Apple. */
|
||||
bool IsFrameworkOnApple() const;
|
||||
|
||||
struct SourceFileFlags
|
||||
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
||||
|
||||
|
|
|
@ -2208,7 +2208,8 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
|
|||
|
||||
if(cmTarget* tgt = this->FindTarget(libname))
|
||||
{
|
||||
if(tgt->IsFrameworkOnApple())
|
||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt);
|
||||
if(gt->IsFrameworkOnApple())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -917,11 +917,13 @@ cmGlobalNinjaGenerator
|
|||
std::string configName =
|
||||
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
|
||||
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
|
||||
|
||||
// for frameworks, we want the real name, not smple name
|
||||
// frameworks always appear versioned, and the build.ninja
|
||||
// will always attempt to manage symbolic links instead
|
||||
// of letting cmOSXBundleGenerator do it.
|
||||
bool realname = target->IsFrameworkOnApple();
|
||||
bool realname = gtgt->IsFrameworkOnApple();
|
||||
|
||||
switch (target->GetType()) {
|
||||
case cmState::EXECUTABLE:
|
||||
|
@ -929,7 +931,6 @@ cmGlobalNinjaGenerator
|
|||
case cmState::STATIC_LIBRARY:
|
||||
case cmState::MODULE_LIBRARY:
|
||||
{
|
||||
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
|
||||
outputs.push_back(this->ConvertToNinjaPath(
|
||||
gtgt->GetFullPath(configName, false, realname)));
|
||||
break;
|
||||
|
|
|
@ -787,14 +787,16 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
|
|||
|
||||
// Is this a resource file in this target? Add it to the resources group...
|
||||
//
|
||||
|
||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||
this->GetGeneratorTarget(&cmtarget)->GetTargetSourceFileFlags(sf);
|
||||
gtgt->GetTargetSourceFileFlags(sf);
|
||||
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
|
||||
|
||||
// Is this a "private" or "public" framework header file?
|
||||
// Set the ATTRIBUTES attribute appropriately...
|
||||
//
|
||||
if(cmtarget.IsFrameworkOnApple())
|
||||
if(gtgt->IsFrameworkOnApple())
|
||||
{
|
||||
if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader)
|
||||
{
|
||||
|
@ -1193,7 +1195,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||
}
|
||||
|
||||
// some build phases only apply to bundles and/or frameworks
|
||||
bool isFrameworkTarget = cmtarget.IsFrameworkOnApple();
|
||||
bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
|
||||
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
|
||||
bool isCFBundleTarget = cmtarget.IsCFBundleOnApple();
|
||||
|
||||
|
@ -1289,7 +1291,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
|
||||
this->CreateString("6"));
|
||||
std::ostringstream ostr;
|
||||
if (cmtarget.IsFrameworkOnApple())
|
||||
if (gtgt->IsFrameworkOnApple())
|
||||
{
|
||||
// dstPath in frameworks is relative to Versions/<version>
|
||||
ostr << mit->first;
|
||||
|
@ -1467,8 +1469,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
|
|||
std::vector<cmCustomCommand> postbuild
|
||||
= cmtarget.GetPostBuildCommands();
|
||||
|
||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||
|
||||
if(cmtarget.GetType() == cmState::SHARED_LIBRARY &&
|
||||
!cmtarget.IsFrameworkOnApple())
|
||||
!gtgt->IsFrameworkOnApple())
|
||||
{
|
||||
cmCustomCommandLines cmd;
|
||||
cmd.resize(1);
|
||||
|
@ -1500,7 +1504,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
|
|||
}
|
||||
|
||||
std::vector<cmSourceFile*> classes;
|
||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||
if (!gtgt->GetConfigCommonSourceFiles(classes))
|
||||
{
|
||||
return;
|
||||
|
@ -1943,7 +1946,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
|||
|
||||
const char* version = target.GetProperty("VERSION");
|
||||
const char* soversion = target.GetProperty("SOVERSION");
|
||||
if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
|
||||
if(!gtgt->HasSOName(configName) || gtgt->IsFrameworkOnApple())
|
||||
{
|
||||
version = 0;
|
||||
soversion = 0;
|
||||
|
@ -1990,7 +1993,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
|||
pndir = gtgt->GetDirectory(configName);
|
||||
}
|
||||
|
||||
if(target.IsFrameworkOnApple() || target.IsCFBundleOnApple())
|
||||
if(gtgt->IsFrameworkOnApple() || target.IsCFBundleOnApple())
|
||||
{
|
||||
pnprefix = "";
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
// An import library looks like a static library.
|
||||
type = cmInstallType_STATIC_LIBRARY;
|
||||
}
|
||||
else if(this->Target->Target->IsFrameworkOnApple())
|
||||
else if(this->Target->IsFrameworkOnApple())
|
||||
{
|
||||
// There is a bug in cmInstallCommand if this fails.
|
||||
assert(this->NamelinkMode == NamelinkModeNone);
|
||||
|
@ -605,7 +605,7 @@ cmInstallTargetGenerator
|
|||
std::string for_install =
|
||||
this->Target->GetInstallNameDirForInstallTree();
|
||||
|
||||
if(this->Target->Target->IsFrameworkOnApple() && for_install.empty())
|
||||
if(this->Target->IsFrameworkOnApple() && for_install.empty())
|
||||
{
|
||||
// Frameworks seem to have an id corresponding to their own full
|
||||
// path.
|
||||
|
|
|
@ -153,7 +153,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
|
|||
//----------------------------------------------------------------------------
|
||||
void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
|
||||
{
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->GeneratorTarget->IsFrameworkOnApple())
|
||||
{
|
||||
this->WriteFrameworkRules(relink);
|
||||
return;
|
||||
|
@ -273,7 +273,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
// Construct the full path version of the names.
|
||||
std::string outpath;
|
||||
std::string outpathImp;
|
||||
if(this->Target->IsFrameworkOnApple())
|
||||
if(this->GeneratorTarget->IsFrameworkOnApple())
|
||||
{
|
||||
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
|
||||
this->OSXBundleGenerator->CreateFramework(targetName, outpath);
|
||||
|
@ -791,7 +791,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
|
||||
// Add a rule to create necessary symlinks for the library.
|
||||
// Frameworks are handled by cmOSXBundleGenerator.
|
||||
if(targetOutPath != targetOutPathReal && !this->Target->IsFrameworkOnApple())
|
||||
if(targetOutPath != targetOutPathReal
|
||||
&& !this->GeneratorTarget->IsFrameworkOnApple())
|
||||
{
|
||||
std::string symlink = "$(CMAKE_COMMAND) -E cmake_symlink_library ";
|
||||
symlink += targetOutPathReal;
|
||||
|
|
|
@ -281,7 +281,7 @@ cmNinjaNormalTargetGenerator
|
|||
}
|
||||
|
||||
if (this->TargetNameOut != this->TargetNameReal &&
|
||||
!this->GetTarget()->IsFrameworkOnApple()) {
|
||||
!this->GetGeneratorTarget()->IsFrameworkOnApple()) {
|
||||
std::string cmakeCommand =
|
||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
|
||||
|
@ -428,7 +428,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
targetOutputReal += this->TargetNameReal;
|
||||
targetOutputReal = this->ConvertToNinjaPath(targetOutputReal);
|
||||
}
|
||||
else if (target.IsFrameworkOnApple())
|
||||
else if (gt.IsFrameworkOnApple())
|
||||
{
|
||||
// Create the library framework.
|
||||
this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
|
||||
|
@ -732,7 +732,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
&usedResponseFile);
|
||||
this->WriteLinkRule(usedResponseFile);
|
||||
|
||||
if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple())
|
||||
if (targetOutput != targetOutputReal && !gt.IsFrameworkOnApple())
|
||||
{
|
||||
if (targetType == cmState::EXECUTABLE)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue