BUG: fix some bad changes in progress calc
[cmake.git] / Source / cmSetDirectoryPropertiesCommand.cxx
blob29fa262b5917da17874ce6bf9b0824453a7cd9fb
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetDirectoryPropertiesCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.7 $
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 "cmSetDirectoryPropertiesCommand.h"
19 #include "cmake.h"
21 // cmSetDirectoryPropertiesCommand
22 bool cmSetDirectoryPropertiesCommand
23 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
25 if(args.size() < 1 )
27 this->SetError("called with incorrect number of arguments");
28 return false;
31 std::string errors;
32 bool ret =
33 cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile,
34 args.begin() + 1,
35 args.end(), errors);
36 if (!ret)
38 this->SetError(errors.c_str());
40 return ret;
43 bool cmSetDirectoryPropertiesCommand
44 ::RunCommand(cmMakefile *mf,
45 std::vector<std::string>::const_iterator ait,
46 std::vector<std::string>::const_iterator aitend,
47 std::string &errors)
49 for (; ait != aitend; ait += 2 )
51 if ( ait +1 == aitend)
53 errors = "Wrong number of arguments";
54 return false;
56 const std::string& prop = *ait;
57 const std::string& value = *(ait+1);
58 if ( prop == "VARIABLES" )
60 errors =
61 "Variables and cache variables should be set using SET command";
62 return false;
64 else if ( prop == "MACROS" )
66 errors =
67 "Commands and macros cannot be set using SET_CMAKE_PROPERTIES";
68 return false;
70 mf->SetProperty(prop.c_str(), value.c_str());
73 return true;