ERR: Fix problems with OPTION and -D on command line. Fix Bug #408 - Using -D without a type does not always work

This commit is contained in:
Andy Cedilnik 2003-12-29 15:26:01 -05:00
parent b753a6794b
commit d97e79c971
1 changed files with 18 additions and 9 deletions

View File

@ -46,13 +46,22 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args)
return false;
}
std::string initialValue = "Off";
// 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
= m_Makefile->GetDefinition(args[0].c_str());
if(!cacheValue)
cmCacheManager::CacheIterator it =
m_Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str());
if(!it.IsAtEnd())
{
std::string initialValue = "Off";
if ( it.GetType() != cmCacheManager::UNINITIALIZED )
{
return true;
}
if ( it.GetValue() )
{
initialValue = it.GetValue();
}
}
if(args.size() == 3)
{
initialValue = args[2];
@ -60,6 +69,6 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args)
m_Makefile->AddCacheDefinition(args[0].c_str(),
cmSystemTools::IsOn(initialValue.c_str()),
args[1].c_str());
}
return true;
}