ENH: Add proper support for installing bundles
This commit is contained in:
parent
0d540b31e0
commit
ed5f95cf23
@ -571,6 +571,10 @@ bool cmFileCommand::HandleInstallCommand(
|
|||||||
{
|
{
|
||||||
itype = cmTarget::MODULE_LIBRARY;
|
itype = cmTarget::MODULE_LIBRARY;
|
||||||
}
|
}
|
||||||
|
else if ( stype == "DIRECTORY" )
|
||||||
|
{
|
||||||
|
itype = cmTarget::INSTALL_DIRECTORY;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !cmSystemTools::FileExists(destination.c_str()) )
|
if ( !cmSystemTools::FileExists(destination.c_str()) )
|
||||||
{
|
{
|
||||||
@ -775,7 +779,23 @@ bool cmFileCommand::HandleInstallCommand(
|
|||||||
std::string message;
|
std::string message;
|
||||||
if(!cmSystemTools::SameFile(fromFile.c_str(), toFile.c_str()))
|
if(!cmSystemTools::SameFile(fromFile.c_str(), toFile.c_str()))
|
||||||
{
|
{
|
||||||
if(cmSystemTools::FileExists(fromFile.c_str()))
|
if(itype == cmTarget::INSTALL_DIRECTORY &&
|
||||||
|
cmSystemTools::FileIsDirectory(fromFile.c_str()))
|
||||||
|
{
|
||||||
|
// We will install this file. Display the information.
|
||||||
|
message = "Installing ";
|
||||||
|
message += toFile.c_str();
|
||||||
|
this->Makefile->DisplayStatus(message.c_str(), -1);
|
||||||
|
if(!cmSystemTools::CopyADirectory(fromFile.c_str(), toFile.c_str()))
|
||||||
|
{
|
||||||
|
cmOStringStream e;
|
||||||
|
e << "INSTALL cannot copy directory \"" << fromFile
|
||||||
|
<< "\" to \"" << toFile + "\".";
|
||||||
|
this->SetError(e.str().c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(cmSystemTools::FileExists(fromFile.c_str()))
|
||||||
{
|
{
|
||||||
// We will install this file. Display the information.
|
// We will install this file. Display the information.
|
||||||
message = "Installing ";
|
message = "Installing ";
|
||||||
|
@ -60,6 +60,7 @@ void cmInstallGenerator::AddInstallRule(std::ostream& os,
|
|||||||
std::string stype;
|
std::string stype;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
case cmTarget::INSTALL_DIRECTORY:stype = "DIRECTORY"; break;
|
||||||
case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break;
|
case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break;
|
||||||
case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break;
|
case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break;
|
||||||
case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break;
|
case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break;
|
||||||
|
@ -123,24 +123,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
|
|||||||
// Info.plist file.
|
// Info.plist file.
|
||||||
this->PrepareScriptReference(os, this->Target, "INSTALL",
|
this->PrepareScriptReference(os, this->Target, "INSTALL",
|
||||||
false, false);
|
false, false);
|
||||||
std::string plist = fromFile;
|
fromFile += ".app";
|
||||||
plist += ".app/Contents/Info.plist";
|
type = cmTarget::INSTALL_DIRECTORY;
|
||||||
fromFile += ".app/Contents/MacOS/";
|
|
||||||
fromFile += this->GetScriptReference(this->Target, "INSTALL",
|
|
||||||
false);
|
|
||||||
|
|
||||||
// Compute the destination locations of the bundle Info.plist file.
|
|
||||||
destination += "/";
|
|
||||||
destination += this->GetScriptReference(this->Target, "INSTALL",
|
|
||||||
false);
|
|
||||||
destination += ".app/Contents";
|
|
||||||
|
|
||||||
// Install the Info.plist file.
|
|
||||||
this->AddInstallRule(os, destination.c_str(), cmTarget::INSTALL_FILES,
|
|
||||||
plist.c_str());
|
|
||||||
|
|
||||||
// Compute the destination locations of the bundle executable file.
|
|
||||||
destination += "/MacOS";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
cmTarget();
|
cmTarget();
|
||||||
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
|
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
|
||||||
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET,
|
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET,
|
||||||
INSTALL_FILES, INSTALL_PROGRAMS};
|
INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY};
|
||||||
|
|
||||||
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
|
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user