diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-09 21:57:17 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-19 18:27:41 (GMT) |
commit | b5f5de70c0b754010f151cde75783a2cc62db835 (patch) | |
tree | c350c97df9ba3cdbaca221e8001fc4eefab44252 | |
parent | 8e20ea6ef2258867bd6554536fa7b914f266df96 (diff) | |
download | CMake-b5f5de70c0b754010f151cde75783a2cc62db835.zip CMake-b5f5de70c0b754010f151cde75783a2cc62db835.tar.gz CMake-b5f5de70c0b754010f151cde75783a2cc62db835.tar.bz2 |
cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.
Leave the cmTarget method behind for now to implement cmInstallCommand.
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 2 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 22 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 6 |
10 files changed, 46 insertions, 28 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 889c55c..2497f82 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -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()) { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index fdc21db..132c0b5 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -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"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index bdf29b2..42b5c63 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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")); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a4a432c..471a500 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -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; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f54f936..1142ddd 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 02da028..89a6dff 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -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; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index faaf823..527a84f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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 = ""; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c2798b2..9c0aca0 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -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. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2ed5f70..015c880 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index e5e4b7f..4cfbda5 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -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) { |