ENH: Cleaned up signature of cmMakefile::AddUtilityCommand. It is not valid to have an output from a utility rule and no calls to the method asked for an output anyway. The argument has been removed.

This commit is contained in:
Brad King 2006-09-28 13:55:26 -04:00
parent 506dca3990
commit 7d2de52c1a
11 changed files with 17 additions and 43 deletions

View File

@ -149,8 +149,7 @@ bool cmAddCustomTargetCommand::InitialPass(
// Add the utility target to the makefile. // Add the utility target to the makefile.
bool escapeOldStyle = !verbatim; bool escapeOldStyle = !verbatim;
const char* no_output = 0; this->Makefile->AddUtilityCommand(args[0].c_str(), all,
this->Makefile->AddUtilityCommand(args[0].c_str(), all, no_output,
working_directory.c_str(), depends, working_directory.c_str(), depends,
commandLines, escapeOldStyle); commandLines, escapeOldStyle);

View File

@ -206,8 +206,8 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
int all, int all,
int numDepends, int numDepends,
const char **depends, const char **depends,
int numOutputs, int,
const char **outputs) const char **)
{ {
// Get the makefile instance. Perform an extra variable expansion // Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it. // now because the API caller expects it.
@ -234,19 +234,9 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
depends2.push_back(mf->ExpandVariablesInString(expand)); depends2.push_back(mf->ExpandVariablesInString(expand));
} }
// Only one output is allowed.
const char* output = 0;
std::string outputStr;
if(numOutputs > 0)
{
expand = outputs[0];
outputStr = mf->ExpandVariablesInString(expand);
output = outputStr.c_str();
}
// Pass the call to the makefile instance. // Pass the call to the makefile instance.
mf->AddUtilityCommand(utilityName, (all ? true : false), mf->AddUtilityCommand(utilityName, (all ? true : false),
output, 0, depends2, commandLines); 0, depends2, commandLines);
} }
void CCONV cmAddCustomCommand(void *arg, const char* source, void CCONV cmAddCustomCommand(void *arg, const char* source,
const char* command, const char* command,

View File

@ -1300,7 +1300,6 @@ void cmGlobalGenerator::SetupTests()
// If the file doesn't exist, then ENABLE_TESTING hasn't been run // If the file doesn't exist, then ENABLE_TESTING hasn't been run
if (total_tests > 0) if (total_tests > 0)
{ {
const char* no_output = 0;
const char* no_working_dir = 0; const char* no_working_dir = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -1313,7 +1312,7 @@ void cmGlobalGenerator::SetupTests()
cmMakefile* mf = gen[0]->GetMakefile(); cmMakefile* mf = gen[0]->GetMakefile();
if(const char* outDir = mf->GetDefinition("CMAKE_CFG_INTDIR")) if(const char* outDir = mf->GetDefinition("CMAKE_CFG_INTDIR"))
{ {
mf->AddUtilityCommand("RUN_TESTS", false, no_output, no_depends, mf->AddUtilityCommand("RUN_TESTS", false, no_depends,
no_working_dir, no_working_dir,
ctest.c_str(), "-C", outDir); ctest.c_str(), "-C", outDir);
} }

View File

@ -162,7 +162,6 @@ void cmGlobalVisualStudio6Generator::Generate()
{ {
// add a special target that depends on ALL projects for easy build // add a special target that depends on ALL projects for easy build
// of one configuration only. // of one configuration only.
const char* no_output = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
const char* no_working_dir = 0; const char* no_working_dir = 0;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -173,7 +172,7 @@ void cmGlobalVisualStudio6Generator::Generate()
if(gen.size()) if(gen.size())
{ {
gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false, gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false,
no_output, no_depends, no_depends,
no_working_dir, no_working_dir,
"echo", "Build all projects"); "echo", "Build all projects");
} }

View File

@ -216,7 +216,6 @@ void cmGlobalVisualStudio7Generator::Generate()
{ {
// add a special target that depends on ALL projects for easy build // add a special target that depends on ALL projects for easy build
// of one configuration only. // of one configuration only.
const char* no_output = 0;
const char* no_working_dir = 0; const char* no_working_dir = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -227,7 +226,7 @@ void cmGlobalVisualStudio7Generator::Generate()
if(gen.size()) if(gen.size())
{ {
gen[0]->GetMakefile()-> gen[0]->GetMakefile()->
AddUtilityCommand("ALL_BUILD", false, no_output, no_depends, AddUtilityCommand("ALL_BUILD", false, no_depends,
no_working_dir, no_working_dir,
"echo", "Build all projects"); "echo", "Build all projects");
std::string cmake_command = std::string cmake_command =

View File

@ -75,7 +75,6 @@ void cmGlobalVisualStudio8Generator::Generate()
{ {
// Add a special target on which all other targets depend that // Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake. // checks the build system and optionally re-runs CMake.
const char* no_output = 0;
const char* no_working_directory = 0; const char* no_working_directory = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -90,10 +89,10 @@ void cmGlobalVisualStudio8Generator::Generate()
static_cast<cmLocalVisualStudio7Generator*>(generators[0]); static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLines noCommandLines;
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true,
no_output, no_depends, no_working_directory, no_depends,
no_working_directory, noCommandLines);
"echo", "Checking build system");
cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
if(!tgt) if(!tgt)
{ {

View File

@ -281,10 +281,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
{ {
cmMakefile* mf = root->GetMakefile(); cmMakefile* mf = root->GetMakefile();
// Add ALL_BUILD // Add ALL_BUILD
const char* no_output = 0;
const char* no_working_directory = 0; const char* no_working_directory = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
mf->AddUtilityCommand("ALL_BUILD", false, no_output, no_depends, mf->AddUtilityCommand("ALL_BUILD", false, no_depends,
no_working_directory, no_working_directory,
"echo", "Build all projects"); "echo", "Build all projects");
cmTarget* allbuild = mf->FindTarget("ALL_BUILD"); cmTarget* allbuild = mf->FindTarget("ALL_BUILD");
@ -307,7 +306,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
} }
cmCustomCommandLines commandLines; cmCustomCommandLines commandLines;
commandLines.push_back(makecommand); commandLines.push_back(makecommand);
mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, no_output, mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false,
no_working_directory, no_working_directory,
no_depends, no_depends,
commandLines); commandLines);

View File

@ -46,10 +46,9 @@ bool cmIncludeExternalMSProjectCommand
utility_name += args[0]; utility_name += args[0];
std::string path = args[1]; std::string path = args[1];
cmSystemTools::ConvertToUnixSlashes(path); cmSystemTools::ConvertToUnixSlashes(path);
const char* no_output = 0;
const char* no_working_directory = 0; const char* no_working_directory = 0;
this->Makefile->AddUtilityCommand(utility_name.c_str(), true, this->Makefile->AddUtilityCommand(utility_name.c_str(), true,
no_output, depends, depends,
no_working_directory, no_working_directory,
args[0].c_str(), path.c_str()); args[0].c_str(), path.c_str());

View File

@ -783,7 +783,6 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all, void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
const char* output,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* workingDirectory, const char* workingDirectory,
const char* command, const char* command,
@ -815,13 +814,12 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
commandLines.push_back(commandLine); commandLines.push_back(commandLine);
// Call the real signature of this method. // Call the real signature of this method.
this->AddUtilityCommand(utilityName, all, output, workingDirectory, this->AddUtilityCommand(utilityName, all, workingDirectory,
depends, commandLines); depends, commandLines);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all, void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
const char* output,
const char* workingDirectory, const char* workingDirectory,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
@ -834,10 +832,6 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
target.SetMakefile(this); target.SetMakefile(this);
// Store the custom command in the target. // Store the custom command in the target.
std::vector<std::string> outputs; std::vector<std::string> outputs;
if(output)
{
outputs.push_back(output);
}
cmCustomCommand cc(outputs, depends, commandLines, 0, workingDirectory); cmCustomCommand cc(outputs, depends, commandLines, 0, workingDirectory);
cc.SetEscapeOldStyle(escapeOldStyle); cc.SetEscapeOldStyle(escapeOldStyle);
target.GetPostBuildCommands().push_back(cc); target.GetPostBuildCommands().push_back(cc);

View File

@ -183,7 +183,6 @@ public:
* is run every time the target is built. * is run every time the target is built.
*/ */
void AddUtilityCommand(const char* utilityName, bool all, void AddUtilityCommand(const char* utilityName, bool all,
const char* output,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* workingDirectory, const char* workingDirectory,
const char* command, const char* command,
@ -192,7 +191,6 @@ public:
const char* arg3=0, const char* arg3=0,
const char* arg4=0); const char* arg4=0);
void AddUtilityCommand(const char* utilityName, bool all, void AddUtilityCommand(const char* utilityName, bool all,
const char* output,
const char* workingDirectory, const char* workingDirectory,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,

View File

@ -190,9 +190,8 @@ void cmVTKWrapJavaCommand::FinalPass()
alldepends.push_back(res2); alldepends.push_back(res2);
} }
const char* no_output = 0;
const char* no_working_directory = 0; const char* no_working_directory = 0;
this->Makefile->AddUtilityCommand((this->LibraryName+"JavaClasses").c_str(), this->Makefile->AddUtilityCommand(
true, no_output, (this->LibraryName+"JavaClasses").c_str(),
alldepends, no_working_directory, ""); true, alldepends, no_working_directory, "");
} }