ENH: some more cleanup

This commit is contained in:
Ken Martin 2007-03-13 15:18:27 -04:00
parent 5891ba16ce
commit c53b26baf2
8 changed files with 20 additions and 16 deletions

View File

@ -73,13 +73,13 @@ bool cmAddCustomTargetCommand::InitialPass(
tdoing doing = doing_command; tdoing doing = doing_command;
// Look for the ALL option. // Look for the ALL option.
bool all = false; bool excludeFromAll = true;
unsigned int start = 1; unsigned int start = 1;
if(args.size() > 1) if(args.size() > 1)
{ {
if(args[1] == "ALL") if(args[1] == "ALL")
{ {
all = true; excludeFromAll = false;
start = 2; start = 2;
} }
} }
@ -160,7 +160,7 @@ bool cmAddCustomTargetCommand::InitialPass(
// Add the utility target to the makefile. // Add the utility target to the makefile.
bool escapeOldStyle = !verbatim; bool escapeOldStyle = !verbatim;
this->Makefile->AddUtilityCommand(args[0].c_str(), all, this->Makefile->AddUtilityCommand(args[0].c_str(), excludeFromAll,
working_directory.c_str(), depends, working_directory.c_str(), depends,
commandLines, escapeOldStyle, comment); commandLines, escapeOldStyle, comment);

View File

@ -236,7 +236,7 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
} }
// Pass the call to the makefile instance. // Pass the call to the makefile instance.
mf->AddUtilityCommand(utilityName, (all ? true : false), mf->AddUtilityCommand(utilityName, (all ? false : true),
0, depends2, commandLines); 0, depends2, commandLines);
} }
void CCONV cmAddCustomCommand(void *arg, const char* source, void CCONV cmAddCustomCommand(void *arg, const char* source,

View File

@ -171,7 +171,7 @@ void cmGlobalVisualStudio6Generator::Generate()
// add the ALL_BUILD to the first local generator of each project // add the ALL_BUILD to the first local generator of each project
if(gen.size()) if(gen.size())
{ {
gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false, gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", true,
no_depends, no_depends,
no_working_dir, no_working_dir,
"echo", "Build all projects"); "echo", "Build all projects");

View File

@ -226,7 +226,7 @@ void cmGlobalVisualStudio7Generator::Generate()
if(gen.size()) if(gen.size())
{ {
gen[0]->GetMakefile()-> gen[0]->GetMakefile()->
AddUtilityCommand("ALL_BUILD", false, no_depends, AddUtilityCommand("ALL_BUILD", true, 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

@ -91,7 +91,7 @@ void cmGlobalVisualStudio8Generator::Generate()
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; cmCustomCommandLines noCommandLines;
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
no_working_directory, no_depends, no_working_directory, no_depends,
noCommandLines); noCommandLines);
cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);

View File

@ -252,7 +252,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
// Add ALL_BUILD // Add ALL_BUILD
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_depends, mf->AddUtilityCommand("ALL_BUILD", true, 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");
@ -275,7 +275,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
} }
cmCustomCommandLines commandLines; cmCustomCommandLines commandLines;
commandLines.push_back(makecommand); commandLines.push_back(makecommand);
mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, mf->AddUtilityCommand("XCODE_DEPEND_HELPER", true,
no_working_directory, no_working_directory,
no_depends, no_depends,
commandLines); commandLines);

View File

@ -771,7 +771,8 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all, void cmMakefile::AddUtilityCommand(const char* utilityName,
bool excludeFromAll,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* workingDirectory, const char* workingDirectory,
const char* command, const char* command,
@ -803,12 +804,13 @@ 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, workingDirectory, this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory,
depends, commandLines); depends, commandLines);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all, void cmMakefile::AddUtilityCommand(const char* utilityName,
bool excludeFromAll,
const char* workingDirectory, const char* workingDirectory,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
@ -818,8 +820,10 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
cmTarget target; cmTarget target;
target.SetMakefile(this); target.SetMakefile(this);
target.SetType(cmTarget::UTILITY, utilityName); target.SetType(cmTarget::UTILITY, utilityName);
target.SetProperty("EXCLUDE_FROM_ALL", (all) ?"FALSE" : "TRUE"); if (excludeFromAll)
{
target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
if(!comment) if(!comment)
{ {
// Use an empty comment to avoid generation of default comment. // Use an empty comment to avoid generation of default comment.

View File

@ -176,7 +176,7 @@ public:
* Add a utility to the build. A utiltity target is a command that * Add a utility to the build. A utiltity target is a command that
* 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 excludeFromAll,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* workingDirectory, const char* workingDirectory,
const char* command, const char* command,
@ -184,7 +184,7 @@ public:
const char* arg2=0, const char* arg2=0,
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 excludeFromAll,
const char* workingDirectory, const char* workingDirectory,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,