1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmOptionCommand.h"
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
18 bool argError = false;
23 // for VTK 4.0 we have to support the option command with more than 3
24 // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if
25 // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter
27 if(this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"))
36 std::string m = "called with incorrect number of arguments: ";
37 for(size_t i =0; i < args.size(); ++i)
42 this->SetError(m.c_str());
46 std::string initialValue = "Off";
47 // Now check and see if the value has been stored in the cache
48 // already, if so use that value and don't look for the program
49 cmCacheManager::CacheIterator it =
50 this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str());
53 if ( it.GetType() != cmCacheManager::UNINITIALIZED )
55 it.SetProperty("HELPSTRING", args[1].c_str());
60 initialValue = it.GetValue();
65 initialValue = args[2];
67 bool init = cmSystemTools::IsOn(initialValue.c_str());
68 this->Makefile->AddCacheDefinition(args[0].c_str(), init? "ON":"OFF",
69 args[1].c_str(), cmCacheManager::BOOL);