168
168
return this->HandleTimestampCommand(args);
170
else if ( subCommand == "GENERATE" )
172
return this->HandleGenerateCommand(args);
171
175
std::string e = "does not recognize sub-command "+subCommand;
172
176
this->SetError(e.c_str());
1985
1989
// allow for / to be a valid destination
1986
1990
if ( destination.size() < 2 && destination != "/" )
1988
this->FileCommand->SetError("called with inapropriate arguments. "
1992
this->FileCommand->SetError("called with inappropriate arguments. "
1989
1993
"No DESTINATION provided or .");
2485
2489
cmWriteToFileCallback(void *ptr, size_t size, size_t nmemb,
2488
register int realsize = (int)(size * nmemb);
2492
int realsize = (int)(size * nmemb);
2489
2493
std::ofstream* fout = static_cast<std::ofstream*>(data);
2490
2494
const char* chPtr = static_cast<char*>(ptr);
2491
2495
fout->write(chPtr, realsize);
2497
2501
cmWriteToMemoryCallback(void *ptr, size_t size, size_t nmemb,
2500
register int realsize = (int)(size * nmemb);
2504
int realsize = (int)(size * nmemb);
2501
2505
cmFileCommandVectorOfChar *vec
2502
2506
= static_cast<cmFileCommandVectorOfChar*>(data);
2503
2507
const char* chPtr = static_cast<char*>(ptr);
3252
3256
//----------------------------------------------------------------------------
3257
void cmFileCommand::AddEvaluationFile(const std::string &inputName,
3258
const std::string &outputExpr,
3259
const std::string &condition,
3263
cmListFileBacktrace lfbt;
3264
this->Makefile->GetBacktrace(lfbt);
3266
cmGeneratorExpression outputGe(lfbt);
3267
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge
3268
= outputGe.Parse(outputExpr);
3270
cmGeneratorExpression conditionGe(lfbt);
3271
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
3272
= conditionGe.Parse(condition);
3274
this->Makefile->GetLocalGenerator()
3275
->GetGlobalGenerator()->AddEvaluationFile(inputName,
3282
//----------------------------------------------------------------------------
3283
bool cmFileCommand::HandleGenerateCommand(
3284
std::vector<std::string> const& args)
3286
if (args.size() < 5)
3288
this->SetError("Incorrect arguments to GENERATE subcommand.");
3291
if (args[1] != "OUTPUT")
3293
this->SetError("Incorrect arguments to GENERATE subcommand.");
3296
std::string condition;
3297
if (args.size() > 5)
3299
if (args[5] != "CONDITION")
3301
this->SetError("Incorrect arguments to GENERATE subcommand.");
3304
if (args.size() != 7)
3306
this->SetError("Incorrect arguments to GENERATE subcommand.");
3309
condition = args[6];
3310
if (condition.empty())
3312
this->SetError("CONDITION of sub-command GENERATE must not be empty if "
3317
std::string output = args[2];
3318
const bool inputIsContent = args[3] != "INPUT";
3319
if (inputIsContent && args[3] != "CONTENT")
3321
this->SetError("Incorrect arguments to GENERATE subcommand.");
3324
std::string input = args[4];
3326
this->AddEvaluationFile(input, output, condition, inputIsContent);
3330
//----------------------------------------------------------------------------
3253
3331
bool cmFileCommand::HandleTimestampCommand(
3254
3332
std::vector<std::string> const& args)