diff options
Diffstat (limited to 'Source/cmInstallCommand.cxx')
-rw-r--r-- | Source/cmInstallCommand.cxx | 109 |
1 files changed, 69 insertions, 40 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 0878aae..ec500d9 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -25,9 +25,12 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false) { + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(target.GetMakefile()); 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::SelectMessageLevel(mf); 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()); } @@ -97,9 +103,9 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, } // Unknown mode. - cmStdString e = "called with unknown mode "; + std::string e = "called with unknown mode "; e += args[0]; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -269,7 +275,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << "TARGETS given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -370,7 +376,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is an alias."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Lookup this target in the current directory. @@ -387,7 +393,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is not an executable, library, or module."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } else if(target->GetType() == cmTarget::OBJECT_LIBRARY) @@ -395,7 +401,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given OBJECT library \"" << (*targetIt) << "\" which may not be installed."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the target in the list to be installed. @@ -407,7 +413,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which does not exist in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -499,7 +505,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no FRAMEWORK DESTINATION for shared library " "FRAMEWORK target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -519,7 +525,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for shared library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -539,7 +545,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no ARCHIVE DESTINATION for static library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -560,7 +566,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for module target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -595,7 +601,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE " "executable target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -612,7 +618,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no RUNTIME DESTINATION for executable " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -851,7 +857,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -866,7 +872,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // The rename option works only with one file. cmOStringStream e; e << args[0] << " given RENAME option with more than one file."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -886,7 +892,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -911,6 +917,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) Doing doing = DoingDirs; bool in_match_mode = false; bool optional = false; + bool message_never = false; std::vector<std::string> dirs; const char* destination = 0; std::string permissions_file; @@ -927,7 +934,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -941,7 +948,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -949,6 +956,21 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) optional = true; doing = DoingNone; } + else if(args[i] == "MESSAGE_NEVER") + { + if(in_match_mode) + { + cmOStringStream e; + e << args[0] << " does not allow \"" + << args[i] << "\" after PATTERN or REGEX."; + this->SetError(e.str()); + return false; + } + + // Mark the rule as quiet. + message_never = true; + doing = DoingNone; + } else if(args[i] == "PATTERN") { // Switch to a new pattern match rule. @@ -969,7 +991,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } literal_args += " EXCLUDE"; @@ -982,7 +1004,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -997,7 +1019,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1011,7 +1033,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1025,7 +1047,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1040,7 +1062,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1055,7 +1077,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1069,7 +1091,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1094,7 +1116,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given non-directory \"" << args[i] << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1150,7 +1172,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid file permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1162,7 +1184,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid directory permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1174,7 +1196,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1183,7 +1205,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1204,10 +1226,13 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile, message_never); + // Create the directory install generator. this->Makefile->AddInstallGenerator( new cmInstallDirectoryGenerator(dirs, destination, @@ -1215,6 +1240,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) permissions_dir.c_str(), configurations, component.c_str(), + message, literal_args.c_str(), optional)); @@ -1247,7 +1273,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1262,7 +1288,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1274,7 +1300,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument may not contain a path. " << "Specify the path in the DESTINATION argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1285,7 +1311,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument must specify a name ending in \".cmake\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1302,7 +1328,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1327,19 +1353,22 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \"" << te->Target->GetName() << "\" does not have policy CMP0022 set to NEW."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } } + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); + // 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); @@ -1368,7 +1397,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, { cmOStringStream e; e << modeName << " given directory \"" << (*fileIt) << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the file for installation. |