ENH: Allow IF(DEFINED ENV{somevar}) to work.
This commit is contained in:
parent
8de6e9557b
commit
84923605cf
|
@ -262,7 +262,17 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
|
||||||
// is a variable defined
|
// is a variable defined
|
||||||
if (*arg == "DEFINED" && argP1 != newArgs.end())
|
if (*arg == "DEFINED" && argP1 != newArgs.end())
|
||||||
{
|
{
|
||||||
def = makefile->GetDefinition((argP1)->c_str());
|
unsigned int argP1len = argP1->size();
|
||||||
|
if(argP1len > 4 && argP1->substr(0, 4) == "ENV{" &&
|
||||||
|
argP1->operator[](argP1len-1) == '}')
|
||||||
|
{
|
||||||
|
std::string env = argP1->substr(4, argP1len-5);
|
||||||
|
def = cmSystemTools::GetEnv(env.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
def = makefile->GetDefinition((argP1)->c_str());
|
||||||
|
}
|
||||||
if(def)
|
if(def)
|
||||||
{
|
{
|
||||||
*arg = "1";
|
*arg = "1";
|
||||||
|
|
Loading…
Reference in New Issue