Commit 2fb2207c authored by Ken Martin's avatar Ken Martin

bug fixes

parent e7519358
......@@ -51,7 +51,7 @@ bool cmElseCommand::Invoke(std::vector<std::string>& args)
// check to see if the argument is defined first
const char *def = m_Makefile->GetDefinition(args[0].c_str());
if(cmSystemTools::IsOn(def))
if(!cmSystemTools::IsOff(def))
{
// add block
cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
......
......@@ -63,17 +63,14 @@ bool cmFindFileCommand::Invoke(std::vector<std::string>& args)
helpString += args[1] + " file be found";
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(define);
if(cacheValue)
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
{
if(strcmp(cacheValue, "NOTFOUND") != 0)
{
m_Makefile->AddDefinition(define, cacheValue);
// update help string if changed
cmCacheManager::GetInstance()->AddCacheEntry(define,
cacheValue,
helpString.c_str(),
cmCacheManager::FILEPATH);
}
return true;
}
// if it is not in the cache, then search the system path
......
......@@ -55,16 +55,13 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args)
helpString += args[1] + " library be found";
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
if(cacheValue)
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
{
if(strcmp(cacheValue, "NOTFOUND") != 0)
{
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
cacheValue,
helpString.c_str(),
cmCacheManager::PATH);
}
return true;
}
......
......@@ -56,16 +56,13 @@ bool cmFindPathCommand::Invoke(std::vector<std::string>& args)
helpString += args[1] + " can be found";
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
if(cacheValue)
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
{
if(strcmp(cacheValue, "NOTFOUND") != 0)
{
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
cacheValue,
helpString.c_str(),
cmCacheManager::PATH);
}
return true;
}
......
......@@ -73,7 +73,7 @@ bool cmIfCommand::Invoke(std::vector<std::string>& args)
// check to see if the argument is defined first
const char *def = m_Makefile->GetDefinition(args[0].c_str());
if(cmSystemTools::IsOn(def))
if(!cmSystemTools::IsOff(def))
{
// do nothing
}
......
......@@ -544,3 +544,20 @@ bool cmSystemTools::IsOn(const char* val)
}
return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y");
}
bool cmSystemTools::IsOff(const char* val)
{
if (!val)
{
return true;
}
std::basic_string<char> v = val;
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = toupper(*c);
}
return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
v == "N" || v == "NOTFOUND");
}
......@@ -151,9 +151,21 @@ public:
///! Remove a file.
static void RemoveFile(const char* source);
///! does a string indicate a true or on value ?
/**
* does a string indicate a true or on value ? This is not the same
* as ifdef.
*/
static bool IsOn(const char* val);
/**
* does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
* NOTFOUND will cause IsOff to return true.
*/
static bool IsOff(const char* val);
static long int ModifiedTime(const char* filename);
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment