FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmMarkAsAdvancedCommand.cxx
blob6a3b807cb3189f2ca9b1995a82757aefd84057fd
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmMarkAsAdvancedCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-03-29 19:20:22 $
7 Version: $Revision: 1.5 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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::InitialPass(std::vector<std::string> const& argsIn)
22 if(argsIn.size() < 1 )
24 this->SetError("called with incorrect number of arguments");
25 return false;
27 std::vector<std::string> args;
28 cmSystemTools::ExpandListArguments(argsIn, args);
30 unsigned int i =0;
31 const char* value = "1";
32 bool overwrite = false;
33 if(args[0] == "CLEAR" || args[0] == "FORCE")
35 overwrite = true;
36 if(args[0] == "CLEAR")
38 value = "0";
40 i = 1;
42 for(; i < args.size(); ++i)
44 std::string variable = args[i];
45 variable += "-ADVANCED";
46 std::string doc = "Advanced flag for variable: ";
47 doc += args[i];
48 // if not CLEAR or FORCE or it is not yet defined,
49 // then define variable-ADVANCED
50 if(overwrite || !m_Makefile->GetDefinition(variable.c_str()))
52 m_Makefile->AddCacheDefinition(variable.c_str(), value,
53 doc.c_str(),
54 cmCacheManager::INTERNAL);
57 return true;