ENH: add support for OUTPUT_NAME

This commit is contained in:
Bill Hoffman 2005-08-19 17:17:13 -04:00
parent 8d8c3be72b
commit c69c9e0134
1 changed files with 24 additions and 7 deletions

View File

@ -1011,13 +1011,24 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
case cmTarget::EXECUTABLE: case cmTarget::EXECUTABLE:
{ {
const char* outname = target.GetProperty("OUTPUT_NAME");
std::string name;
if(outname)
{
productName = outname;
name = outname;
}
else
{
name = target.GetName();
}
std::string symRoot; std::string symRoot;
if(m_ExecutableOutputPath.size()) if(m_ExecutableOutputPath.size())
{ {
std::string path = m_ExecutableOutputPath; std::string path = m_ExecutableOutputPath;
if(target.GetPropertyAsBool("MACOSX_BUNDLE")) if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
{ {
path += target.GetName(); path += name;
path += ".app/Contents/MacOS/"; path += ".app/Contents/MacOS/";
} }
symRoot = path; symRoot = path;
@ -1027,7 +1038,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{ {
if(symRoot.size() == 0) if(symRoot.size() == 0)
{ {
symRoot = target.GetName(); symRoot = name;
symRoot += ".app/Contents/MacOS/"; symRoot += ".app/Contents/MacOS/";
} }
productType = "com.apple.product-type.tool"; productType = "com.apple.product-type.tool";
@ -1111,6 +1122,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
pname = "lib"; pname = "lib";
} }
pname += target.GetName(); pname += target.GetName();
if(target.GetType() == cmTarget::EXECUTABLE
&& target.GetProperty("OUTPUT_NAME") )
{
pname = target.GetProperty("OUTPUT_NAME");
}
buildSettings->AddAttribute("PRODUCT_NAME", buildSettings->AddAttribute("PRODUCT_NAME",
this->CreateString(pname.c_str())); this->CreateString(pname.c_str()));
} }
@ -1153,8 +1170,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
target->AddAttribute("buildSettings", buildSettings); target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(cmtarget.GetName())); target->AddAttribute("name", this->CreateString(productName.c_str()));
target->AddAttribute("productName",this->CreateString(cmtarget.GetName())); target->AddAttribute("productName",this->CreateString(productName.c_str()));
target->SetcmTarget(&cmtarget); target->SetcmTarget(&cmtarget);
return target; return target;
} }
@ -1180,8 +1197,8 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
target->AddAttribute("buildSettings", buildSettings); target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(cmtarget.GetName())); target->AddAttribute("name", this->CreateString(productName.c_str()));
target->AddAttribute("productName",this->CreateString(cmtarget.GetName())); target->AddAttribute("productName",this->CreateString(productName.c_str()));
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
fileRef->AddAttribute("explicitFileType", fileRef->AddAttribute("explicitFileType",