ENH: Started implementing INSTALL(DIRECTORY) command mode. This is not yet finished so it is undocumented and there is no test. These changes also separate the notions of file and directory permissions.

This commit is contained in:
Brad King 2006-08-17 14:48:54 -04:00
parent b642ffa7a8
commit 8a72d43c17
12 changed files with 571 additions and 102 deletions

View File

@ -122,6 +122,8 @@ SET(SRCS
cmInstallScriptGenerator.cxx
cmInstallTargetGenerator.h
cmInstallTargetGenerator.cxx
cmInstallDirectoryGenerator.h
cmInstallDirectoryGenerator.cxx
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c

View File

@ -315,6 +315,121 @@ bool cmFileCommand::HandleMakeDirectoryCommand(
return true;
}
//----------------------------------------------------------------------------
struct cmFileInstaller
{
bool InstallFile(const char* fromFile, const char* toFile, bool always);
bool InstallDirectory(const char* source,
const char* destination,
bool always,
std::string& smanifest_files,
int destDirLength);
cmFileInstaller(cmFileCommand* fc, cmMakefile* mf):
FileCommand(fc), Makefile(mf) {}
cmFileCommand* FileCommand;
cmMakefile* Makefile;
mode_t FilePermissions;
mode_t DirPermissions;
};
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
bool always)
{
// Inform the user about this file installation.
std::string message = "Installing ";
message += toFile;
this->Makefile->DisplayStatus(message.c_str(), -1);
// Copy the file.
if(!cmSystemTools::CopyAFile(fromFile, toFile, always))
{
cmOStringStream e;
e << "INSTALL cannot copy file \"" << fromFile
<< "\" to \"" << toFile << "\".";
this->FileCommand->SetError(e.str().c_str());
return false;
}
// Set permissions of the destination file.
if(!cmSystemTools::SetPermissions(toFile, this->FilePermissions))
{
cmOStringStream e;
e << "Problem setting permissions on file \"" << toFile << "\"";
this->FileCommand->SetError(e.str().c_str());
return false;
}
return true;
}
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallDirectory(const char* source,
const char* destination,
bool always,
std::string& smanifest_files,
int destDirLength)
{
cmsys::Directory dir;
dir.Load(source);
if(!cmSystemTools::MakeDirectory(destination))
{
return false;
}
// TODO: Make sure destination directory has write permissions
// before installing files. User requested permissions may be
// restored later.
unsigned long numFiles = static_cast<unsigned long>(dir.GetNumberOfFiles());
for(unsigned long fileNum = 0; fileNum < numFiles; ++fileNum)
{
if(!(strcmp(dir.GetFile(fileNum), ".") == 0 ||
strcmp(dir.GetFile(fileNum), "..") == 0))
{
kwsys_stl::string fromPath = source;
fromPath += "/";
fromPath += dir.GetFile(fileNum);
if(cmSystemTools::FileIsDirectory(fromPath.c_str()))
{
kwsys_stl::string toDir = destination;
toDir += "/";
toDir += dir.GetFile(fileNum);
if(!this->InstallDirectory(fromPath.c_str(), toDir.c_str(), always,
smanifest_files, destDirLength))
{
return false;
}
}
else
{
// Install this file.
std::string toFile = destination;
toFile += "/";
toFile += dir.GetFile(fileNum);
if(this->InstallFile(fromPath.c_str(), toFile.c_str(), always))
{
smanifest_files += ";";
smanifest_files += toFile.substr(destDirLength);
}
else
{
return false;
}
}
}
}
// Set the requested permissions on the destination directory.
if(!cmSystemTools::SetPermissions(destination, this->DirPermissions))
{
cmOStringStream e;
e << "Problem setting permissions on directory \"" << destination << "\"";
this->FileCommand->SetError(e.str().c_str());
return false;
}
return true;
}
//----------------------------------------------------------------------------
bool cmFileCommand::HandleInstallCommand(
std::vector<std::string> const& args)
@ -369,11 +484,14 @@ bool cmFileCommand::HandleInstallCommand(
bool in_files = false;
bool in_properties = false;
bool in_permissions = false;
bool in_permissions_file = false;
bool in_permissions_dir = false;
bool in_components = false;
bool in_configurations = false;
bool use_given_permissions = false;
mode_t permissions = 0;
bool use_given_permissions_file = false;
bool use_given_permissions_dir = false;
mode_t permissions_file = 0;
mode_t permissions_dir = 0;
bool optional = false;
for ( ; i != args.size(); ++i )
{
@ -384,7 +502,8 @@ bool cmFileCommand::HandleInstallCommand(
destination = args[i];
in_files = false;
in_properties = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
@ -399,7 +518,8 @@ bool cmFileCommand::HandleInstallCommand(
}
in_properties = false;
in_files = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
@ -409,7 +529,8 @@ bool cmFileCommand::HandleInstallCommand(
rename = args[i];
in_properties = false;
in_files = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
@ -417,16 +538,28 @@ bool cmFileCommand::HandleInstallCommand(
{
in_properties = true;
in_files = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
else if ( *cstr == "PERMISSIONS" )
else if ( *cstr == "PERMISSIONS" )
{
use_given_permissions = true;
use_given_permissions_file = true;
in_properties = false;
in_files = false;
in_permissions = true;
in_permissions_file = true;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
else if ( *cstr == "DIR_PERMISSIONS" )
{
use_given_permissions_dir = true;
in_properties = false;
in_files = false;
in_permissions_file = false;
in_permissions_dir = true;
in_components = false;
in_configurations = false;
}
@ -434,7 +567,8 @@ bool cmFileCommand::HandleInstallCommand(
{
in_properties = false;
in_files = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = true;
in_configurations = false;
}
@ -442,7 +576,8 @@ bool cmFileCommand::HandleInstallCommand(
{
in_properties = false;
in_files = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = true;
}
@ -450,7 +585,8 @@ bool cmFileCommand::HandleInstallCommand(
{
in_files = true;
in_properties = false;
in_permissions = false;
in_permissions_file = false;
in_permissions_dir = false;
in_components = false;
in_configurations = false;
}
@ -471,49 +607,93 @@ bool cmFileCommand::HandleInstallCommand(
{
configurations.insert(cmSystemTools::UpperCase(*cstr));
}
else if(in_permissions && args[i] == "OWNER_READ")
else if(in_permissions_file && args[i] == "OWNER_READ")
{
permissions |= mode_owner_read;
permissions_file |= mode_owner_read;
}
else if(in_permissions && args[i] == "OWNER_WRITE")
else if(in_permissions_file && args[i] == "OWNER_WRITE")
{
permissions |= mode_owner_write;
permissions_file |= mode_owner_write;
}
else if(in_permissions && args[i] == "OWNER_EXECUTE")
else if(in_permissions_file && args[i] == "OWNER_EXECUTE")
{
permissions |= mode_owner_execute;
permissions_file |= mode_owner_execute;
}
else if(in_permissions && args[i] == "GROUP_READ")
else if(in_permissions_file && args[i] == "GROUP_READ")
{
permissions |= mode_group_read;
permissions_file |= mode_group_read;
}
else if(in_permissions && args[i] == "GROUP_WRITE")
else if(in_permissions_file && args[i] == "GROUP_WRITE")
{
permissions |= mode_group_write;
permissions_file |= mode_group_write;
}
else if(in_permissions && args[i] == "GROUP_EXECUTE")
else if(in_permissions_file && args[i] == "GROUP_EXECUTE")
{
permissions |= mode_group_execute;
permissions_file |= mode_group_execute;
}
else if(in_permissions && args[i] == "WORLD_READ")
else if(in_permissions_file && args[i] == "WORLD_READ")
{
permissions |= mode_world_read;
permissions_file |= mode_world_read;
}
else if(in_permissions && args[i] == "WORLD_WRITE")
else if(in_permissions_file && args[i] == "WORLD_WRITE")
{
permissions |= mode_world_write;
permissions_file |= mode_world_write;
}
else if(in_permissions && args[i] == "WORLD_EXECUTE")
else if(in_permissions_file && args[i] == "WORLD_EXECUTE")
{
permissions |= mode_world_execute;
permissions_file |= mode_world_execute;
}
else if(in_permissions && args[i] == "SETUID")
else if(in_permissions_file && args[i] == "SETUID")
{
permissions |= mode_setuid;
permissions_file |= mode_setuid;
}
else if(in_permissions && args[i] == "SETGID")
else if(in_permissions_file && args[i] == "SETGID")
{
permissions |= mode_setgid;
permissions_file |= mode_setgid;
}
else if(in_permissions_dir && args[i] == "OWNER_READ")
{
permissions_dir |= mode_owner_read;
}
else if(in_permissions_dir && args[i] == "OWNER_WRITE")
{
permissions_dir |= mode_owner_write;
}
else if(in_permissions_dir && args[i] == "OWNER_EXECUTE")
{
permissions_dir |= mode_owner_execute;
}
else if(in_permissions_dir && args[i] == "GROUP_READ")
{
permissions_dir |= mode_group_read;
}
else if(in_permissions_dir && args[i] == "GROUP_WRITE")
{
permissions_dir |= mode_group_write;
}
else if(in_permissions_dir && args[i] == "GROUP_EXECUTE")
{
permissions_dir |= mode_group_execute;
}
else if(in_permissions_dir && args[i] == "WORLD_READ")
{
permissions_dir |= mode_world_read;
}
else if(in_permissions_dir && args[i] == "WORLD_WRITE")
{
permissions_dir |= mode_world_write;
}
else if(in_permissions_dir && args[i] == "WORLD_EXECUTE")
{
permissions_dir |= mode_world_execute;
}
else if(in_permissions_dir && args[i] == "SETUID")
{
permissions_dir |= mode_setuid;
}
else if(in_permissions_dir && args[i] == "SETGID")
{
permissions_dir |= mode_setgid;
}
else
{
@ -683,9 +863,9 @@ bool cmFileCommand::HandleInstallCommand(
}
}
// If permissions were not specified set default permissions for
// this target type.
if(!use_given_permissions)
// If file permissions were not specified set default permissions
// for this target type.
if(!use_given_permissions_file)
{
switch(itype)
{
@ -693,36 +873,55 @@ bool cmFileCommand::HandleInstallCommand(
case cmTarget::MODULE_LIBRARY:
#if defined(__linux__)
// Use read/write permissions.
permissions = 0;
permissions |= mode_owner_read;
permissions |= mode_owner_write;
permissions |= mode_group_read;
permissions |= mode_world_read;
permissions_file = 0;
permissions_file |= mode_owner_read;
permissions_file |= mode_owner_write;
permissions_file |= mode_group_read;
permissions_file |= mode_world_read;
break;
#endif
case cmTarget::EXECUTABLE:
case cmTarget::INSTALL_PROGRAMS:
// Use read/write/executable permissions.
permissions = 0;
permissions |= mode_owner_read;
permissions |= mode_owner_write;
permissions |= mode_owner_execute;
permissions |= mode_group_read;
permissions |= mode_group_execute;
permissions |= mode_world_read;
permissions |= mode_world_execute;
permissions_file = 0;
permissions_file |= mode_owner_read;
permissions_file |= mode_owner_write;
permissions_file |= mode_owner_execute;
permissions_file |= mode_group_read;
permissions_file |= mode_group_execute;
permissions_file |= mode_world_read;
permissions_file |= mode_world_execute;
break;
default:
// Use read/write permissions.
permissions = 0;
permissions |= mode_owner_read;
permissions |= mode_owner_write;
permissions |= mode_group_read;
permissions |= mode_world_read;
permissions_file = 0;
permissions_file |= mode_owner_read;
permissions_file |= mode_owner_write;
permissions_file |= mode_group_read;
permissions_file |= mode_world_read;
break;
}
}
// If directory permissions were not specified set default permissions.
if(!use_given_permissions_dir)
{
// Use read/write/executable permissions.
permissions_dir = 0;
permissions_dir |= mode_owner_read;
permissions_dir |= mode_owner_write;
permissions_dir |= mode_owner_execute;
permissions_dir |= mode_group_read;
permissions_dir |= mode_group_execute;
permissions_dir |= mode_world_read;
permissions_dir |= mode_world_execute;
}
// Construct a file installer object.
cmFileInstaller installer(this, this->Makefile);
installer.FilePermissions = permissions_file;
installer.DirPermissions = permissions_dir;
// Get the current manifest.
const char* manifest_files =
this->Makefile->GetDefinition("CMAKE_INSTALL_MANIFEST_FILES");
@ -870,35 +1069,20 @@ bool cmFileCommand::HandleInstallCommand(
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(),
copy_always))
// Try installing this directory.
if(!installer.InstallDirectory(fromFile.c_str(), toFile.c_str(),
copy_always, smanifest_files,
destDirLength))
{
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.
message = "Installing ";
message += toFile.c_str();
this->Makefile->DisplayStatus(message.c_str(), -1);
// Copy the file.
if(!cmSystemTools::CopyAFile(fromFile.c_str(), toFile.c_str(),
copy_always))
// Install this file.
if(!installer.InstallFile(fromFile.c_str(), toFile.c_str(),
copy_always))
{
cmOStringStream e;
e << "INSTALL cannot copy file \"" << fromFile
<< "\" to \"" << toFile + "\".";
this->SetError(e.str().c_str());
return false;
}
@ -920,16 +1104,6 @@ bool cmFileCommand::HandleInstallCommand(
}
#endif
// Set permissions of the destination file.
if(!cmSystemTools::SetPermissions(toFile.c_str(), permissions))
{
cmOStringStream e;
e << "Problem setting permissions on file \""
<< toFile.c_str() << "\"";
this->SetError(e.str().c_str());
return false;
}
// Add the file to the manifest.
smanifest_files += ";";
smanifest_files += toFile.substr(destDirLength);

View File

@ -16,6 +16,7 @@
=========================================================================*/
#include "cmInstallCommand.h"
#include "cmInstallDirectoryGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.h"
@ -51,6 +52,10 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args)
{
return this->HandleFilesMode(args);
}
else if(args[0] == "DIRECTORY")
{
return this->HandleDirectoryMode(args);
}
// Unknown mode.
cmStdString e = "called with unknown mode ";
@ -675,6 +680,180 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
return true;
}
//----------------------------------------------------------------------------
bool
cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
bool doing_dirs = true;
bool doing_destination = false;
bool doing_permissions_file = false;
bool doing_permissions_dir = false;
bool doing_configurations = false;
bool doing_component = false;
std::vector<std::string> dirs;
const char* destination = 0;
std::string permissions_file;
std::string permissions_dir;
std::vector<std::string> configurations;
std::string component;
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "DESTINATION")
{
// Switch to setting the destination property.
doing_dirs = false;
doing_destination = true;
doing_permissions_file = false;
doing_permissions_dir = false;
doing_configurations = false;
doing_component = false;
}
else if(args[i] == "FILE_PERMISSIONS")
{
// Switch to setting the file permissions property.
doing_dirs = false;
doing_destination = false;
doing_permissions_file = true;
doing_permissions_dir = false;
doing_configurations = false;
doing_component = false;
}
else if(args[i] == "DIRECTORY_PERMISSIONS")
{
// Switch to setting the directory permissions property.
doing_dirs = false;
doing_destination = false;
doing_permissions_file = false;
doing_permissions_dir = true;
doing_configurations = false;
doing_component = false;
}
else if(args[i] == "CONFIGURATIONS")
{
// Switch to setting the configurations property.
doing_dirs = false;
doing_destination = false;
doing_permissions_file = false;
doing_permissions_dir = false;
doing_configurations = true;
doing_component = false;
}
else if(args[i] == "COMPONENT")
{
// Switch to setting the component property.
doing_dirs = false;
doing_destination = false;
doing_permissions_file = false;
doing_permissions_dir = false;
doing_configurations = false;
doing_component = true;
}
else if(doing_dirs)
{
// Convert this directory to a full path.
std::string dir = args[i];
if(!cmSystemTools::FileIsFullPath(dir.c_str()))
{
dir = this->Makefile->GetCurrentDirectory();
dir += "/";
dir += args[i];
}
// Make sure the name is a directory.
if(!cmSystemTools::FileIsDirectory(dir.c_str()))
{
cmOStringStream e;
e << args[0] << " given non-directory \""
<< args[i] << "\" to install.";
this->SetError(e.str().c_str());
return false;
}
// Store the directory for installation.
dirs.push_back(dir);
}
else if(doing_configurations)
{
configurations.push_back(args[i]);
}
else if(doing_destination)
{
destination = args[i].c_str();
doing_destination = false;
}
else if(doing_component)
{
component = args[i];
doing_component = false;
}
else if(doing_permissions_file)
{
// Check the requested permission.
if(!this->CheckPermissions(args[i], permissions_file))
{
cmOStringStream e;
e << args[0] << " given invalid file permission \""
<< args[i] << "\".";
this->SetError(e.str().c_str());
return false;
}
}
else if(doing_permissions_dir)
{
// Check the requested permission.
if(!this->CheckPermissions(args[i], permissions_dir))
{
cmOStringStream e;
e << args[0] << " given invalid directory permission \""
<< args[i] << "\".";
this->SetError(e.str().c_str());
return false;
}
}
else
{
// Unknown argument.
cmOStringStream e;
e << args[0] << " given unknown argument \"" << args[i] << "\".";
this->SetError(e.str().c_str());
return false;
}
}
// Check if there is something to do.
if(dirs.empty())
{
return true;
}
if(!destination)
{
// A destination is required.
cmOStringStream e;
e << args[0] << " given no DESTINATION!";
this->SetError(e.str().c_str());
return false;
}
// Compute destination path.
std::string dest;
this->ComputeDestination(destination, dest);
// Create the directory install generator.
this->Makefile->AddInstallGenerator(
new cmInstallDirectoryGenerator(dirs, dest.c_str(),
permissions_file.c_str(),
permissions_dir.c_str(),
configurations,
component.c_str()));
// Tell the global generator about any installation component names
// specified.
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->AddInstallComponent(component.c_str());
return true;
}
//----------------------------------------------------------------------------
void cmInstallCommand::ComputeDestination(const char* destination,
std::string& dest)

View File

@ -191,6 +191,7 @@ private:
bool HandleScriptMode(std::vector<std::string> const& args);
bool HandleTargetsMode(std::vector<std::string> const& args);
bool HandleFilesMode(std::vector<std::string> const& args);
bool HandleDirectoryMode(std::vector<std::string> const& args);
void ComputeDestination(const char* destination, std::string& dest);
bool CheckPermissions(std::string const& arg, std::string& permissions);
};

View File

@ -0,0 +1,59 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmInstallDirectoryGenerator.h"
#include "cmTarget.h"
//----------------------------------------------------------------------------
cmInstallDirectoryGenerator
::cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
const char* dest,
const char* file_permissions,
const char* dir_permissions,
std::vector<std::string> const& configurations,
const char* component):
Directories(dirs), Destination(dest),
FilePermissions(file_permissions), DirPermissions(dir_permissions),
Configurations(configurations), Component(component)
{
}
//----------------------------------------------------------------------------
cmInstallDirectoryGenerator
::~cmInstallDirectoryGenerator()
{
}
//----------------------------------------------------------------------------
void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os)
{
// Write code to install the directories.
for(std::vector<std::string>::const_iterator di = this->Directories.begin();
di != this->Directories.end(); ++di)
{
bool not_optional = false;
const char* no_properties = 0;
const char* no_rename = 0;
this->AddInstallRule(os, this->Destination.c_str(),
cmTarget::INSTALL_DIRECTORY, di->c_str(),
not_optional, no_properties,
this->FilePermissions.c_str(),
this->DirPermissions.c_str(),
this->Configurations, this->Component.c_str(),
no_rename);
}
}

View File

@ -0,0 +1,46 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmInstallDirectoryGenerator_h
#define cmInstallDirectoryGenerator_h
#include "cmInstallGenerator.h"
/** \class cmInstallDirectoryGenerator
* \brief Generate directory installation rules.
*/
class cmInstallDirectoryGenerator: public cmInstallGenerator
{
public:
cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
const char* dest,
const char* file_permissions,
const char* dir_permissions,
std::vector<std::string> const& configurations,
const char* component);
virtual ~cmInstallDirectoryGenerator();
protected:
virtual void GenerateScript(std::ostream& os);
std::vector<std::string> Directories;
std::string Destination;
std::string FilePermissions;
std::string DirPermissions;
std::vector<std::string> Configurations;
std::string Component;
};
#endif

View File

@ -22,12 +22,12 @@
cmInstallFilesGenerator
::cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
const char* permissions,
const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
const char* rename):
Files(files), Destination(dest), Programs(programs),
Permissions(permissions), Configurations(configurations),
FilePermissions(file_permissions), Configurations(configurations),
Component(component), Rename(rename)
{
}
@ -47,12 +47,13 @@ void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
{
bool not_optional = false;
const char* no_properties = 0;
const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->Destination.c_str(),
(this->Programs
? cmTarget::INSTALL_PROGRAMS
: cmTarget::INSTALL_FILES), fi->c_str(),
not_optional, no_properties,
this->Permissions.c_str(),
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
this->Rename.c_str());

View File

@ -27,7 +27,7 @@ class cmInstallFilesGenerator: public cmInstallGenerator
public:
cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
const char* permissions,
const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
const char* rename);
@ -38,7 +38,7 @@ protected:
std::vector<std::string> Files;
std::string Destination;
bool Programs;
std::string Permissions;
std::string FilePermissions;
std::vector<std::string> Configurations;
std::string Component;
std::string Rename;

View File

@ -55,7 +55,8 @@ void cmInstallGenerator
const char* file,
bool optional /* = false */,
const char* properties /* = 0 */,
const char* permissions /* = 0 */,
const char* permissions_file /* = 0 */,
const char* permissions_dir /* = 0 */,
std::vector<std::string> const& configurations,
const char* component /* = 0 */,
const char* rename /* = 0 */
@ -83,9 +84,13 @@ void cmInstallGenerator
{
os << " PROPERTIES" << properties;
}
if(permissions && *permissions)
if(permissions_file && *permissions_file)
{
os << " PERMISSIONS" << permissions;
os << " PERMISSIONS" << permissions_file;
}
if(permissions_dir && *permissions_dir)
{
os << " DIR_PERMISSIONS" << permissions_dir;
}
if(rename && *rename)
{

View File

@ -38,7 +38,8 @@ public:
std::ostream& os, const char* dest, int type,
const char* file, bool optional = false,
const char* properties = 0,
const char* permissions = 0,
const char* permissions_file = 0,
const char* permissions_dir = 0,
std::vector<std::string> const& configurations
= std::vector<std::string>(),
const char* component = 0,

View File

@ -25,11 +25,11 @@
//----------------------------------------------------------------------------
cmInstallTargetGenerator
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
const char* permissions,
const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component):
Target(&t), Destination(dest), ImportLibrary(implib),
Permissions(permissions), Configurations(configurations),
FilePermissions(file_permissions), Configurations(configurations),
Component(component)
{
this->Target->SetHaveInstallRule(true);
@ -158,9 +158,10 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
}
// Write code to install the target file.
const char* no_dir_permissions = 0;
this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(),
this->ImportLibrary, properties,
this->Permissions.c_str(),
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str());

View File

@ -29,7 +29,7 @@ class cmInstallTargetGenerator: public cmInstallGenerator
public:
cmInstallTargetGenerator(
cmTarget& t, const char* dest, bool implib,
const char* permissions = "",
const char* file_permissions = "",
std::vector<std::string> const& configurations
= std::vector<std::string>(),
const char* component = ""
@ -47,7 +47,7 @@ protected:
cmTarget* Target;
std::string Destination;
bool ImportLibrary;
std::string Permissions;
std::string FilePermissions;
std::vector<std::string> Configurations;
std::string Component;
};