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.
bool escapeOldStyle = !verbatim;
const char* no_output = 0;
this->Makefile->AddUtilityCommand(args[0].c_str(), all, no_output,
this->Makefile->AddUtilityCommand(args[0].c_str(), all,
working_directory.c_str(), depends,
commandLines, escapeOldStyle);

View File

@ -206,8 +206,8 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
int all,
int numDepends,
const char **depends,
int numOutputs,
const char **outputs)
int,
const char **)
{
// Get the makefile instance. Perform an extra variable expansion
// 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));
}
// 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.
mf->AddUtilityCommand(utilityName, (all ? true : false),
output, 0, depends2, commandLines);
0, depends2, commandLines);
}
void CCONV cmAddCustomCommand(void *arg, const char* source,
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 (total_tests > 0)
{
const char* no_output = 0;
const char* no_working_dir = 0;
std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -1313,7 +1312,7 @@ void cmGlobalGenerator::SetupTests()
cmMakefile* mf = gen[0]->GetMakefile();
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,
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
// of one configuration only.
const char* no_output = 0;
std::vector<std::string> no_depends;
const char* no_working_dir = 0;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -173,7 +172,7 @@ void cmGlobalVisualStudio6Generator::Generate()
if(gen.size())
{
gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false,
no_output, no_depends,
no_depends,
no_working_dir,
"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
// of one configuration only.
const char* no_output = 0;
const char* no_working_dir = 0;
std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@ -227,7 +226,7 @@ void cmGlobalVisualStudio7Generator::Generate()
if(gen.size())
{
gen[0]->GetMakefile()->
AddUtilityCommand("ALL_BUILD", false, no_output, no_depends,
AddUtilityCommand("ALL_BUILD", false, no_depends,
no_working_dir,
"echo", "Build all projects");
std::string cmake_command =

View File

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

View File

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

View File

@ -46,10 +46,9 @@ bool cmIncludeExternalMSProjectCommand
utility_name += args[0];
std::string path = args[1];
cmSystemTools::ConvertToUnixSlashes(path);
const char* no_output = 0;
const char* no_working_directory = 0;
this->Makefile->AddUtilityCommand(utility_name.c_str(), true,
no_output, depends,
depends,
no_working_directory,
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,
const char* output,
const std::vector<std::string>& depends,
const char* workingDirectory,
const char* command,
@ -815,13 +814,12 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
commandLines.push_back(commandLine);
// Call the real signature of this method.
this->AddUtilityCommand(utilityName, all, output, workingDirectory,
this->AddUtilityCommand(utilityName, all, workingDirectory,
depends, commandLines);
}
//----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
const char* output,
const char* workingDirectory,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
@ -834,10 +832,6 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
target.SetMakefile(this);
// Store the custom command in the target.
std::vector<std::string> outputs;
if(output)
{
outputs.push_back(output);
}
cmCustomCommand cc(outputs, depends, commandLines, 0, workingDirectory);
cc.SetEscapeOldStyle(escapeOldStyle);
target.GetPostBuildCommands().push_back(cc);

View File

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

View File

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