2001-04-24 00:33:24 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: Insight Segmentation & Registration Toolkit
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2000 National Library of Medicine
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
See COPYRIGHT.txt for copyright details.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmOptionCommand.h"
|
|
|
|
|
|
|
|
// cmOptionCommand
|
|
|
|
bool cmOptionCommand::Invoke(std::vector<std::string>& args)
|
|
|
|
{
|
2001-04-26 23:41:18 +04:00
|
|
|
if(args.size() < 2)
|
2001-04-24 00:33:24 +04:00
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now check and see if the value has been stored in the cache
|
|
|
|
// already, if so use that value and don't look for the program
|
|
|
|
const char* cacheValue
|
|
|
|
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
|
|
|
if(!cacheValue)
|
|
|
|
{
|
2001-04-26 22:53:44 +04:00
|
|
|
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
|
|
|
false,
|
2001-04-26 23:41:18 +04:00
|
|
|
args[1].c_str());
|
|
|
|
m_Makefile->AddDefinition(args[0].c_str(), "Off");
|
2001-04-24 00:33:24 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-25 00:49:12 +04:00
|
|
|
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
2001-04-26 23:41:18 +04:00
|
|
|
cmCacheManager::GetInstance()->
|
|
|
|
AddCacheEntry(args[0].c_str(),
|
|
|
|
cmSystemTools::IsOn(cacheValue), args[1].c_str());
|
2001-04-24 00:33:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|