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