Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmDefinePropertyCommand.cxx
blob2d15c945bdb89ff1f34aac1129c9abc74a00d8bf
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDefinePropertyCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008/01/23 15:27:59 $
7 Version: $Revision: 1.3 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmDefinePropertyCommand.h"
18 #include "cmake.h"
20 // cmDefinePropertiesCommand
21 bool cmDefinePropertyCommand
22 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
24 if(args.size() < 5 )
26 this->SetError("called with incorrect number of arguments");
27 return false;
30 // determine the scope
31 cmProperty::ScopeType scope;
32 if (args[1] == "GLOBAL")
34 scope = cmProperty::GLOBAL;
36 else if (args[1] == "DIRECTORY")
38 scope = cmProperty::DIRECTORY;
40 else if (args[1] == "TARGET")
42 scope = cmProperty::TARGET;
44 else if (args[1] == "SOURCE_FILE")
46 scope = cmProperty::SOURCE_FILE;
48 else if (args[1] == "TEST")
50 scope = cmProperty::TEST;
52 else if (args[1] == "VARIABLE")
54 scope = cmProperty::VARIABLE;
56 else if (args[1] == "CACHED_VARIABLE")
58 scope = cmProperty::CACHED_VARIABLE;
60 else
62 this->SetError("called with illegal arguments.");
63 return false;
66 this->Makefile->GetCMakeInstance()->DefineProperty
67 (args[0].c_str(), scope,args[2].c_str(), args[3].c_str(),
68 cmSystemTools::IsOn(args[4].c_str()));
70 return true;