install: Thread message level setting through internal API

Create a cmInstallGenerator::MessageLevel enumeration for future use in
specifying install message verbosity.  Thread values of the type through
constructors and save the value as a member of cmInstallGenerator.
Use only a "MessageDefault" value for now.
This commit is contained in:
Brad King 2014-06-24 10:45:07 -04:00
parent abebcd235c
commit ec7cf7ea13
15 changed files with 49 additions and 12 deletions

View File

@ -25,9 +25,12 @@
static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false) const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false)
{ {
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
return new cmInstallTargetGenerator(target, args.GetDestination().c_str(), return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
impLib, args.GetPermissions().c_str(), impLib, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(), args.GetConfigurations(), args.GetComponent().c_str(),
message,
args.GetOptional() || forceOpt); args.GetOptional() || forceOpt);
} }
@ -36,10 +39,13 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
const std::vector<std::string>& absFiles, const std::vector<std::string>& absFiles,
const cmInstallCommandArguments& args, bool programs) const cmInstallCommandArguments& args, bool programs)
{ {
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
return new cmInstallFilesGenerator(mf, return new cmInstallFilesGenerator(mf,
absFiles, args.GetDestination().c_str(), absFiles, args.GetDestination().c_str(),
programs, args.GetPermissions().c_str(), programs, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(), args.GetConfigurations(), args.GetComponent().c_str(),
message,
args.GetRename().c_str(), args.GetOptional()); args.GetRename().c_str(), args.GetOptional());
} }
@ -1208,6 +1214,9 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
return false; return false;
} }
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
// Create the directory install generator. // Create the directory install generator.
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
new cmInstallDirectoryGenerator(dirs, destination, new cmInstallDirectoryGenerator(dirs, destination,
@ -1215,6 +1224,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
permissions_dir.c_str(), permissions_dir.c_str(),
configurations, configurations,
component.c_str(), component.c_str(),
message,
literal_args.c_str(), literal_args.c_str(),
optional)); optional));
@ -1333,13 +1343,16 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
} }
} }
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
// Create the export install generator. // Create the export install generator.
cmInstallExportGenerator* exportGenerator = cmInstallExportGenerator* exportGenerator =
new cmInstallExportGenerator( new cmInstallExportGenerator(
exportSet, exportSet,
ica.GetDestination().c_str(), ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetPermissions().c_str(), ica.GetConfigurations(),
ica.GetComponent().c_str(), fname.c_str(), ica.GetComponent().c_str(), message, fname.c_str(),
name_space.GetCString(), exportOld.IsEnabled(), this->Makefile); name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
this->Makefile->AddInstallGenerator(exportGenerator); this->Makefile->AddInstallGenerator(exportGenerator);

View File

@ -21,9 +21,11 @@ cmInstallDirectoryGenerator
const char* dir_permissions, const char* dir_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
const char* literal_args, const char* literal_args,
bool optional): bool optional):
cmInstallGenerator(dest, configurations, component), Directories(dirs), cmInstallGenerator(dest, configurations, component, message),
Directories(dirs),
FilePermissions(file_permissions), DirPermissions(dir_permissions), FilePermissions(file_permissions), DirPermissions(dir_permissions),
LiteralArguments(literal_args), Optional(optional) LiteralArguments(literal_args), Optional(optional)
{ {

View File

@ -26,6 +26,7 @@ public:
const char* dir_permissions, const char* dir_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
const char* literal_args, const char* literal_args,
bool optional = false); bool optional = false);
virtual ~cmInstallDirectoryGenerator(); virtual ~cmInstallDirectoryGenerator();

View File

@ -32,10 +32,11 @@ cmInstallExportGenerator::cmInstallExportGenerator(
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
const char* filename, const char* name_space, const char* filename, const char* name_space,
bool exportOld, bool exportOld,
cmMakefile* mf) cmMakefile* mf)
:cmInstallGenerator(destination, configurations, component) :cmInstallGenerator(destination, configurations, component, message)
,ExportSet(exportSet) ,ExportSet(exportSet)
,FilePermissions(file_permissions) ,FilePermissions(file_permissions)
,FileName(filename) ,FileName(filename)

View File

@ -30,6 +30,7 @@ public:
const char* dest, const char* file_permissions, const char* dest, const char* file_permissions,
const std::vector<std::string>& configurations, const std::vector<std::string>& configurations,
const char* component, const char* component,
MessageLevel message,
const char* filename, const char* name_space, const char* filename, const char* name_space,
bool exportOld, cmMakefile* mf); bool exportOld, cmMakefile* mf);
~cmInstallExportGenerator(); ~cmInstallExportGenerator();

View File

@ -132,11 +132,13 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
std::string no_component = this->Makefile->GetSafeDefinition( std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations; std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files, new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), false, destination.c_str(), false,
no_permissions, no_configurations, no_permissions, no_configurations,
no_component.c_str(), no_rename)); no_component.c_str(), message, no_rename));
} }

View File

@ -23,9 +23,10 @@ cmInstallFilesGenerator
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
const char* rename, const char* rename,
bool optional): bool optional):
cmInstallGenerator(dest, configurations, component), cmInstallGenerator(dest, configurations, component, message),
Makefile(mf), Makefile(mf),
Files(files), Programs(programs), Files(files), Programs(programs),
FilePermissions(file_permissions), FilePermissions(file_permissions),

View File

@ -28,6 +28,7 @@ public:
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
const char* rename, const char* rename,
bool optional = false); bool optional = false);
virtual ~cmInstallFilesGenerator(); virtual ~cmInstallFilesGenerator();

View File

@ -17,10 +17,12 @@
cmInstallGenerator cmInstallGenerator
::cmInstallGenerator(const char* destination, ::cmInstallGenerator(const char* destination,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component): const char* component,
MessageLevel message):
cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations), cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations),
Destination(destination? destination:""), Destination(destination? destination:""),
Component(component? component:"") Component(component? component:""),
Message(message)
{ {
} }

View File

@ -24,9 +24,15 @@ class cmLocalGenerator;
class cmInstallGenerator: public cmScriptGenerator class cmInstallGenerator: public cmScriptGenerator
{ {
public: public:
enum MessageLevel
{
MessageDefault,
};
cmInstallGenerator(const char* destination, cmInstallGenerator(const char* destination,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component); const char* component,
MessageLevel message);
virtual ~cmInstallGenerator(); virtual ~cmInstallGenerator();
void AddInstallRule( void AddInstallRule(
@ -58,6 +64,7 @@ protected:
// Information shared by most generator types. // Information shared by most generator types.
std::string Destination; std::string Destination;
std::string Component; std::string Component;
MessageLevel Message;
}; };
#endif #endif

View File

@ -93,11 +93,13 @@ void cmInstallProgramsCommand::FinalPass()
std::string no_component = this->Makefile->GetSafeDefinition( std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations; std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files, new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), true, destination.c_str(), true,
no_permissions, no_configurations, no_permissions, no_configurations,
no_component.c_str(), no_rename)); no_component.c_str(), message, no_rename));
} }
/** /**

View File

@ -15,7 +15,7 @@
cmInstallScriptGenerator cmInstallScriptGenerator
::cmInstallScriptGenerator(const char* script, bool code, ::cmInstallScriptGenerator(const char* script, bool code,
const char* component) : const char* component) :
cmInstallGenerator(0, std::vector<std::string>(), component), cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault),
Script(script), Code(code) Script(script), Code(code)
{ {
} }

View File

@ -24,8 +24,10 @@ cmInstallTargetGenerator
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, ::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, bool optional): const char* component,
cmInstallGenerator(dest, configurations, component), Target(&t), MessageLevel message,
bool optional):
cmInstallGenerator(dest, configurations, component, message), Target(&t),
ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
{ {
this->ActionsPerConfig = true; this->ActionsPerConfig = true;

View File

@ -27,6 +27,7 @@ public:
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
const char* component, const char* component,
MessageLevel message,
bool optional bool optional
); );
virtual ~cmInstallTargetGenerator(); virtual ~cmInstallTargetGenerator();

View File

@ -3004,6 +3004,7 @@ public:
cmInstallTargetGeneratorLocal(cmTarget& t, const char* dest, bool implib): cmInstallTargetGeneratorLocal(cmTarget& t, const char* dest, bool implib):
cmInstallTargetGenerator( cmInstallTargetGenerator(
t, dest, implib, "", std::vector<std::string>(), "Unspecified", t, dest, implib, "", std::vector<std::string>(), "Unspecified",
MessageDefault,
false) {} false) {}
}; };