1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmOptionCommand.cxx,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.23 $
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 "cmOptionCommand.h"
21 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
23 bool argError
= false;
28 // for VTK 4.0 we have to support the option command with more than 3
29 // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if
30 // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter
32 if(this->Makefile
->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"))
41 std::string m
= "called with incorrect number of arguments: ";
42 for(size_t i
=0; i
< args
.size(); ++i
)
47 this->SetError(m
.c_str());
51 std::string initialValue
= "Off";
52 // Now check and see if the value has been stored in the cache
53 // already, if so use that value and don't look for the program
54 cmCacheManager::CacheIterator it
=
55 this->Makefile
->GetCacheManager()->GetCacheIterator(args
[0].c_str());
58 if ( it
.GetType() != cmCacheManager::UNINITIALIZED
)
60 it
.SetProperty("HELPSTRING", args
[1].c_str());
65 initialValue
= it
.GetValue();
70 initialValue
= args
[2];
72 this->Makefile
->AddCacheDefinition(args
[0].c_str(),
73 cmSystemTools::IsOn(initialValue
.c_str()),