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

View File

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

View File

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

View File

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

View File

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

View File

@ -132,11 +132,13 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), false,
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,
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
const char* rename,
bool optional):
cmInstallGenerator(dest, configurations, component),
cmInstallGenerator(dest, configurations, component, message),
Makefile(mf),
Files(files), Programs(programs),
FilePermissions(file_permissions),

View File

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

View File

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

View File

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

View File

@ -93,11 +93,13 @@ void cmInstallProgramsCommand::FinalPass()
std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::MessageDefault;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), true,
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(const char* script, bool code,
const char* component) :
cmInstallGenerator(0, std::vector<std::string>(), component),
cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault),
Script(script), Code(code)
{
}

View File

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

View File

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

View File

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