KWSys Nightly Date Stamp
[cmake.git] / Source / cmMarkAsAdvancedCommand.cxx
blobf5692ade1dc31a964a8def473f7d6fdc17d19164
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMarkAsAdvancedCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.15 $
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 "cmMarkAsAdvancedCommand.h"
19 // cmMarkAsAdvancedCommand
20 bool cmMarkAsAdvancedCommand
21 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 if(args.size() < 1 )
25 this->SetError("called with incorrect number of arguments");
26 return false;
29 unsigned int i =0;
30 const char* value = "1";
31 bool overwrite = false;
32 if(args[0] == "CLEAR" || args[0] == "FORCE")
34 overwrite = true;
35 if(args[0] == "CLEAR")
37 value = "0";
39 i = 1;
41 for(; i < args.size(); ++i)
43 std::string variable = args[i];
44 cmCacheManager* manager = this->Makefile->GetCacheManager();
45 cmCacheManager::CacheIterator it =
46 manager->GetCacheIterator(variable.c_str());
47 if ( it.IsAtEnd() )
49 this->Makefile->GetCacheManager()
50 ->AddCacheEntry(variable.c_str(), 0, 0,
51 cmCacheManager::UNINITIALIZED);
52 overwrite = true;
54 it.Find(variable.c_str());
55 if ( it.IsAtEnd() )
57 cmSystemTools::Error("This should never happen...");
58 return false;
60 if ( !it.PropertyExists("ADVANCED") || overwrite )
62 it.SetProperty("ADVANCED", value);
65 return true;