bug fixes
This commit is contained in:
parent
e7519358e7
commit
2fb2207c10
|
@ -51,7 +51,7 @@ bool cmElseCommand::Invoke(std::vector<std::string>& args)
|
||||||
|
|
||||||
// check to see if the argument is defined first
|
// check to see if the argument is defined first
|
||||||
const char *def = m_Makefile->GetDefinition(args[0].c_str());
|
const char *def = m_Makefile->GetDefinition(args[0].c_str());
|
||||||
if(cmSystemTools::IsOn(def))
|
if(!cmSystemTools::IsOff(def))
|
||||||
{
|
{
|
||||||
// add block
|
// add block
|
||||||
cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
|
cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
|
||||||
|
|
|
@ -63,9 +63,7 @@ bool cmFindFileCommand::Invoke(std::vector<std::string>& args)
|
||||||
helpString += args[1] + " file be found";
|
helpString += args[1] + " file be found";
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(define);
|
= cmCacheManager::GetInstance()->GetCacheValue(define);
|
||||||
if(cacheValue)
|
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
|
||||||
{
|
|
||||||
if(strcmp(cacheValue, "NOTFOUND") != 0)
|
|
||||||
{
|
{
|
||||||
m_Makefile->AddDefinition(define, cacheValue);
|
m_Makefile->AddDefinition(define, cacheValue);
|
||||||
// update help string if changed
|
// update help string if changed
|
||||||
|
@ -73,7 +71,6 @@ bool cmFindFileCommand::Invoke(std::vector<std::string>& args)
|
||||||
cacheValue,
|
cacheValue,
|
||||||
helpString.c_str(),
|
helpString.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmCacheManager::FILEPATH);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// if it is not in the cache, then search the system path
|
// 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";
|
helpString += args[1] + " library be found";
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
= 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);
|
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
||||||
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
||||||
cacheValue,
|
cacheValue,
|
||||||
helpString.c_str(),
|
helpString.c_str(),
|
||||||
cmCacheManager::PATH);
|
cmCacheManager::PATH);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,16 +56,13 @@ bool cmFindPathCommand::Invoke(std::vector<std::string>& args)
|
||||||
helpString += args[1] + " can be found";
|
helpString += args[1] + " can be found";
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
= 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);
|
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
||||||
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
||||||
cacheValue,
|
cacheValue,
|
||||||
helpString.c_str(),
|
helpString.c_str(),
|
||||||
cmCacheManager::PATH);
|
cmCacheManager::PATH);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool cmIfCommand::Invoke(std::vector<std::string>& args)
|
||||||
|
|
||||||
// check to see if the argument is defined first
|
// check to see if the argument is defined first
|
||||||
const char *def = m_Makefile->GetDefinition(args[0].c_str());
|
const char *def = m_Makefile->GetDefinition(args[0].c_str());
|
||||||
if(cmSystemTools::IsOn(def))
|
if(!cmSystemTools::IsOff(def))
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,3 +544,20 @@ bool cmSystemTools::IsOn(const char* val)
|
||||||
}
|
}
|
||||||
return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y");
|
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.
|
///! Remove a file.
|
||||||
static void RemoveFile(const char* source);
|
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);
|
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);
|
static long int ModifiedTime(const char* filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue