Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmGetCMakePropertyCommand.cxx
blobd7ae46a7631c14ec7b3997e14d40058661a95392
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGetCMakePropertyCommand.cxx,v $
5 Language: C++
6 <<<<<<< cmGetCMakePropertyCommand.cxx
7 Date: $Date: 2008/01/23 15:27:59 $
8 Version: $Revision: 1.8 $
9 =======
10 Date: $Date: 2008-07-08 15:52:25 $
11 Version: $Revision: 1.9 $
12 >>>>>>> 1.9
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #include "cmGetCMakePropertyCommand.h"
24 #include "cmake.h"
26 // cmGetCMakePropertyCommand
27 bool cmGetCMakePropertyCommand
28 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
30 if(args.size() < 2 )
32 this->SetError("called with incorrect number of arguments");
33 return false;
36 std::vector<std::string>::size_type cc;
37 std::string variable = args[0];
38 std::string output = "NOTFOUND";
40 if ( args[1] == "VARIABLES")
42 int cacheonly = 0;
43 std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
44 for ( cc = 0; cc < vars.size(); cc ++ )
46 if ( cc > 0 )
48 output += ";";
50 output += vars[cc];
53 else if ( args[1] == "MACROS" )
55 this->Makefile->GetListOfMacros(output);
57 else if ( args[1] == "COMPONENTS" )
59 const std::set<cmStdString>* components
60 = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
61 ->GetInstallComponents();
62 std::set<cmStdString>::const_iterator compIt;
63 output = "";
64 for (compIt = components->begin(); compIt != components->end(); ++compIt)
66 if (compIt != components->begin())
68 output += ";";
70 output += *compIt;
73 else
75 const char *prop =
76 this->Makefile->GetCMakeInstance()->GetProperty(args[1].c_str());
77 if (prop)
79 output = prop;
82 this->Makefile->AddDefinition(variable.c_str(), output.c_str());
84 return true;