diff options
author | Brad King <brad.king@kitware.com> | 2006-02-10 19:41:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-02-10 19:41:31 (GMT) |
commit | 84923605cf89d24c1748256b271e0b79bf1f1e79 (patch) | |
tree | 00eb4665588067be4765e1b4ba94711dea511dac /Source/cmIfCommand.cxx | |
parent | 8de6e9557b614ce71e4216078350b0b2d5e3100e (diff) | |
download | CMake-84923605cf89d24c1748256b271e0b79bf1f1e79.zip CMake-84923605cf89d24c1748256b271e0b79bf1f1e79.tar.gz CMake-84923605cf89d24c1748256b271e0b79bf1f1e79.tar.bz2 |
ENH: Allow IF(DEFINED ENV{somevar}) to work.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r-- | Source/cmIfCommand.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index c99bb73..f92c647 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -262,7 +262,17 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, // is a variable defined 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) { *arg = "1"; |