ENH: mark some vars as advanced (and resort the list)
[cmake.git] / Source / cmOptionCommand.cxx
blob32b14f4fce69341e2ff5f6799b6ef36b01381809
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmOptionCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-04-25 11:59:57 $
7 Version: $Revision: 1.17 $
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 "cmOptionCommand.h"
19 // cmOptionCommand
20 bool cmOptionCommand::InitialPass(std::vector<std::string> const& args)
22 bool argError = false;
23 if(args.size() < 2)
25 argError = true;
27 // for VTK 4.0 we have to support the option command with more than 3 arguments
28 // if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if CMAKE_MINIMUM_REQUIRED_VERSION
29 // is defined, then we can have stricter checking.
30 if(m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"))
32 if(args.size() > 3)
34 argError = true;
37 if(argError)
39 std::string m = "called with incorrect number of arguments: ";
40 for(size_t i =0; i < args.size(); ++i)
42 m += args[i];
43 m += " ";
45 this->SetError(m.c_str());
46 return false;
49 // Now check and see if the value has been stored in the cache
50 // already, if so use that value and don't look for the program
51 const char* cacheValue
52 = m_Makefile->GetDefinition(args[0].c_str());
53 if(!cacheValue)
55 std::string initialValue = "Off";
56 if(args.size() == 3)
58 initialValue = args[2];
60 m_Makefile->AddCacheDefinition(args[0].c_str(),
61 cmSystemTools::IsOn(initialValue.c_str()),
62 args[1].c_str());
64 return true;