2001-05-09 16:51:54 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: Insight Segmentation & Registration Toolkit
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2000 National Library of Medicine
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
See COPYRIGHT.txt for copyright details.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmLoadCacheCommand.h"
|
|
|
|
|
|
|
|
|
|
|
|
// cmLoadcacheCommand
|
2001-09-20 23:08:30 +04:00
|
|
|
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
|
2001-05-09 16:51:54 +04:00
|
|
|
{
|
2001-09-20 23:08:30 +04:00
|
|
|
if (argsIn.size()< 1)
|
2001-05-09 16:51:54 +04:00
|
|
|
{
|
2001-08-15 21:40:56 +04:00
|
|
|
this->SetError("called with wrong number of arguments.");
|
2001-05-09 16:51:54 +04:00
|
|
|
}
|
2001-09-20 23:08:30 +04:00
|
|
|
std::vector<std::string> args = argsIn;
|
2001-05-09 16:51:54 +04:00
|
|
|
|
2001-08-16 19:41:44 +04:00
|
|
|
// Cache entries to be excluded from the import list.
|
|
|
|
// If this set is empty, all cache entries are brought in
|
|
|
|
// and they can not be overridden.
|
2001-08-15 21:40:56 +04:00
|
|
|
bool excludeFiles=false;
|
|
|
|
unsigned int i;
|
|
|
|
std::set<std::string> excludes;
|
|
|
|
|
|
|
|
for(i=0; i<args.size(); i++)
|
2001-05-09 16:51:54 +04:00
|
|
|
{
|
2001-08-15 21:40:56 +04:00
|
|
|
if (excludeFiles)
|
|
|
|
{
|
|
|
|
m_Makefile->ExpandVariablesInString(args[i]);
|
|
|
|
excludes.insert(args[i]);
|
|
|
|
}
|
|
|
|
if (args[i] == "EXCLUDE")
|
|
|
|
{
|
|
|
|
excludeFiles=true;
|
|
|
|
}
|
2001-08-16 19:41:44 +04:00
|
|
|
if (excludeFiles && (args[i] == "INCLUDE_INTERNALS"))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2001-05-09 16:51:54 +04:00
|
|
|
}
|
|
|
|
|
2001-08-16 19:41:44 +04:00
|
|
|
// Internal cache entries to be imported.
|
|
|
|
// If this set is empty, no internal cache entries are
|
|
|
|
// brought in.
|
|
|
|
bool includeFiles=false;
|
|
|
|
std::set<std::string> includes;
|
|
|
|
|
2001-08-15 21:40:56 +04:00
|
|
|
for(i=0; i<args.size(); i++)
|
|
|
|
{
|
2001-08-16 19:41:44 +04:00
|
|
|
if (includeFiles)
|
|
|
|
{
|
|
|
|
m_Makefile->ExpandVariablesInString(args[i]);
|
|
|
|
includes.insert(args[i]);
|
|
|
|
}
|
|
|
|
if (args[i] == "INCLUDE_INTERNALS")
|
|
|
|
{
|
|
|
|
includeFiles=true;
|
|
|
|
}
|
|
|
|
if (includeFiles && (args[i] == "EXCLUDE"))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0; i<args.size(); i++)
|
|
|
|
{
|
|
|
|
if ((args[i] == "EXCLUDE") || (args[i] == "INCLUDE_INTERNALS"))
|
2001-08-15 21:40:56 +04:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
m_Makefile->ExpandVariablesInString(args[i]);
|
2001-08-16 19:41:44 +04:00
|
|
|
cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
|
|
|
|
excludes, includes);
|
2001-08-15 21:40:56 +04:00
|
|
|
cmCacheManager::GetInstance()->DefineCache(m_Makefile);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-09 16:51:54 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|