summaryrefslogtreecommitdiffstats
path: root/Source/cmElseCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2001-04-19 21:39:03 (GMT)
committerKen Martin <ken.martin@kitware.com>2001-04-19 21:39:03 (GMT)
commitb5f62159ca57dfa074b3985e17df2b2a29ab6d0f (patch)
treeafc12bc65ac93fbba86f360ca8d73eef2fba4867 /Source/cmElseCommand.cxx
parent24bce99cbff13cb337c543dce55f056351caa2fc (diff)
downloadCMake-b5f62159ca57dfa074b3985e17df2b2a29ab6d0f.zip
CMake-b5f62159ca57dfa074b3985e17df2b2a29ab6d0f.tar.gz
CMake-b5f62159ca57dfa074b3985e17df2b2a29ab6d0f.tar.bz2
added if else endif add definition
Diffstat (limited to 'Source/cmElseCommand.cxx')
-rw-r--r--Source/cmElseCommand.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx
new file mode 100644
index 0000000..ff396fc
--- /dev/null
+++ b/Source/cmElseCommand.cxx
@@ -0,0 +1,45 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+
+ Copyright (c) 2000 National Library of Medicine
+ All rights reserved.
+
+ See COPYRIGHT.txt for copyright details.
+
+=========================================================================*/
+#include "cmElseCommand.h"
+#include "cmCacheManager.h"
+
+bool cmElseCommand::Invoke(std::vector<std::string>& args)
+{
+ if(args.size() < 1 )
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ // check to see if the argument is defined first
+ const char *def = m_Makefile->GetDefinition(args[0].c_str());
+ if(def && strcmp(def,"0") && strcmp(def,"false") && strcmp(def,"") &&
+ strcmp(def,"NOTFOUND"))
+ {
+ // add block
+ cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
+ f->m_Define = args[0];
+ m_Makefile->AddFunctionBlocker(f);
+ }
+ else
+ {
+ // remove any function blockers for this define
+ m_Makefile->RemoveFunctionBlocker("ENDIF",args);
+ }
+
+ return true;
+}
+