mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 22:30:07 -05:00
ENH: Add ARGV and ARGN support to MACRO command. ARGV is the list of all arguments and ARGN is the list of all nonexpected arguments
This commit is contained in:
@@ -105,6 +105,45 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
|
||||
variable = "${ARGC}";
|
||||
cmSystemTools::ReplaceString(tmps, variable.c_str(),argcDef.c_str());
|
||||
}
|
||||
for (unsigned int j = 1; j < m_Args.size(); ++j)
|
||||
{
|
||||
variable = "${ARGV}";
|
||||
std::vector<std::string>::iterator eit;
|
||||
std::string var = "";
|
||||
for ( eit = expandedArguments.begin();
|
||||
eit != expandedArguments.end();
|
||||
++ eit )
|
||||
{
|
||||
if ( var.size() > 0 )
|
||||
{
|
||||
var += ";";
|
||||
}
|
||||
var += *eit;
|
||||
}
|
||||
cmSystemTools::ReplaceString(tmps, variable.c_str(),var.c_str());
|
||||
}
|
||||
for (unsigned int j = 1; j < m_Args.size(); ++j)
|
||||
{
|
||||
variable = "${ARGN}";
|
||||
std::vector<std::string>::iterator eit;
|
||||
std::string var = "";
|
||||
std::vector<std::string>::size_type cnt = 0;
|
||||
for ( eit = expandedArguments.begin();
|
||||
eit != expandedArguments.end();
|
||||
++ eit )
|
||||
{
|
||||
if ( cnt >= m_Args.size()-1 )
|
||||
{
|
||||
if ( var.size() > 0 )
|
||||
{
|
||||
var += ";";
|
||||
}
|
||||
var += *eit;
|
||||
}
|
||||
cnt ++;
|
||||
}
|
||||
cmSystemTools::ReplaceString(tmps, variable.c_str(),var.c_str());
|
||||
}
|
||||
for (unsigned int j = 1; j < m_Args.size(); ++j)
|
||||
{
|
||||
// since this could be slow, first check if there is an ARGV
|
||||
|
||||
@@ -106,7 +106,9 @@ public:
|
||||
"the variable ARGC which will be set to the number of arguments "
|
||||
"passed into the function as well as ARGV0 ARGV1 ARGV2 ... which "
|
||||
"will have the actual values of the arguments passed in. This "
|
||||
"fascilitates creating macros with optional arguments.";
|
||||
"fascilitates creating macros with optional arguments. Additionally "
|
||||
"ARGV holds the list of all arguments given to the macro and ARGN "
|
||||
"holds the list of argument pass the last expected argument.";
|
||||
}
|
||||
|
||||
cmTypeMacro(cmMacroCommand, cmCommand);
|
||||
|
||||
Reference in New Issue
Block a user