summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-12-29 20:26:01 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-12-29 20:26:01 (GMT)
commitd97e79c971e9e66c32ef7a6e201518542cc239e8 (patch)
treef1b0cb9f224300b90a2c9ddeaa52df768b807ee5 /Source
parentb753a6794b6b96acb2499a4a9e67cb8bc16afdc6 (diff)
downloadCMake-d97e79c971e9e66c32ef7a6e201518542cc239e8.zip
CMake-d97e79c971e9e66c32ef7a6e201518542cc239e8.tar.gz
CMake-d97e79c971e9e66c32ef7a6e201518542cc239e8.tar.bz2
ERR: Fix problems with OPTION and -D on command line. Fix Bug #408 - Using -D without a type does not always work
Diffstat (limited to 'Source')
-rw-r--r--Source/cmOptionCommand.cxx27
1 files changed, 18 insertions, 9 deletions
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index a86ad22..8c3b55f 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -46,20 +46,29 @@ 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(args.size() == 3)
+ if ( it.GetType() != cmCacheManager::UNINITIALIZED )
{
- initialValue = args[2];
+ return true;
+ }
+ if ( it.GetValue() )
+ {
+ initialValue = it.GetValue();
}
- m_Makefile->AddCacheDefinition(args[0].c_str(),
- cmSystemTools::IsOn(initialValue.c_str()),
- args[1].c_str());
}
+ if(args.size() == 3)
+ {
+ initialValue = args[2];
+ }
+ m_Makefile->AddCacheDefinition(args[0].c_str(),
+ cmSystemTools::IsOn(initialValue.c_str()),
+ args[1].c_str());
+
return true;
}