diff options
author | Nicolas Despres <nicolas.despres@gmail.com> | 2012-07-11 09:19:25 (GMT) |
---|---|---|
committer | Peter Kümmel <syntheticpp@gmx.net> | 2012-07-17 12:03:08 (GMT) |
commit | 54d9713adb016423d20c610163726f80da435588 (patch) | |
tree | 2242d14486a7503b6b0ae395c341f5a3b9fa7aef /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 10686a17f4457fd6032543992538850be5cc8d88 (diff) | |
download | CMake-54d9713adb016423d20c610163726f80da435588.zip CMake-54d9713adb016423d20c610163726f80da435588.tar.gz CMake-54d9713adb016423d20c610163726f80da435588.tar.bz2 |
Ninja: Add support for CFBundle.
This patch fixes test CFBundleTest on Darwin.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 45a4f68..d4fc02b 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -36,6 +36,13 @@ cmNinjaNormalTargetGenerator(cmTarget* target) , TargetNamePDB() , TargetLinkLanguage(0) { + // TODO: Re-factor with cmMakefileLibraryTargetGenerator's constructor. + if(target->IsCFBundleOnApple()) + { + target->SetProperty("PREFIX", ""); + target->SetProperty("SUFFIX", ""); + } + this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName()); if (target->GetType() == cmTarget::EXECUTABLE) target->GetExecutableNames(this->TargetNameOut, @@ -376,6 +383,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Create the library framework. this->OSXBundleGenerator->CreateFramework(this->TargetNameOut); } + // TODO: Re-factor with cmMakefileLibraryTargetGenerator::WriteLibraryRules. + else if(this->GetTarget()->IsCFBundleOnApple()) + { + std::string outpath; + outpath = this->GetTarget()->GetDirectory(this->GetConfigName()); + outpath += "/"; + this->CreateCFBundle(this->TargetNameOut, outpath); + } // Write comments. cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream()); @@ -602,3 +617,25 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement() this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), this->GetTarget()); } + +//---------------------------------------------------------------------------- +// TODO: Re-factor with cmMakefileLibraryTargetGenerator::CreateCFBundle. +void cmNinjaNormalTargetGenerator::CreateCFBundle(std::string& targetName, + std::string& outpath) +{ + // Compute bundle directory names. + outpath = this->OSXBundleGenerator->GetMacContentDirectory(); + outpath += "MacOS"; + cmSystemTools::MakeDirectory(outpath.c_str()); + this->GetMakefile()->AddCMakeOutputFile(outpath.c_str()); + outpath += "/"; + + // Configure the Info.plist file. Note that it needs the executable name + // to be set. + std::string plist = this->OSXBundleGenerator->GetMacContentDirectory(); + plist += "Info.plist"; + this->GetLocalGenerator()->GenerateAppleInfoPList(this->GetTarget(), + targetName.c_str(), + plist.c_str()); + this->GetMakefile()->AddCMakeOutputFile(plist.c_str()); +} |