cmMarkAsAdvancedCommand.cxx 1.67 KB
Newer Older
1 2 3
/*============================================================================
  CMake - Cross Platform Makefile Generator
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4

5 6
  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.
7

8 9 10 11
  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
12 13 14
#include "cmMarkAsAdvancedCommand.h"

// cmMarkAsAdvancedCommand
Ken Martin's avatar
Ken Martin committed
15
bool cmMarkAsAdvancedCommand
16
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
17
{
18
  if(args.size() < 1 )
19 20 21 22
    {
    this->SetError("called with incorrect number of arguments");
    return false;
    }
23

24 25 26 27 28 29 30 31 32 33 34 35 36
  unsigned int i =0;
  const char* value = "1";
  bool overwrite = false;
  if(args[0] == "CLEAR" || args[0] == "FORCE")
    {
    overwrite = true;
    if(args[0] == "CLEAR")
      {
      value = "0";
      }
    i = 1;
    }
  for(; i < args.size(); ++i)
37 38
    {
    std::string variable = args[i];
39
    cmCacheManager* manager = this->Makefile->GetCacheManager();
40
    if (!manager->GetCacheEntryValue(variable))
41
      {
42
      manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
43
      overwrite = true;
44
      }
45
    if (!manager->GetCacheEntryValue(variable))
46 47 48 49
      {
      cmSystemTools::Error("This should never happen...");
      return false;
      }
50
    if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
51
      {
52
      manager->SetCacheEntryProperty(variable, "ADVANCED", value);
53
      }
54 55 56 57
    }
  return true;
}