summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBerk Geveci <berk.geveci@kitware.com>2001-08-16 15:41:44 (GMT)
committerBerk Geveci <berk.geveci@kitware.com>2001-08-16 15:41:44 (GMT)
commit3b9f97f32d019520c372551ab4c6a321cb560094 (patch)
tree2a365aa2b73ea78499bee77b045e93d58adfb52c /Source
parent06a0f67f93435e49d14c45c234a0bf2246b28b83 (diff)
downloadCMake-3b9f97f32d019520c372551ab4c6a321cb560094.zip
CMake-3b9f97f32d019520c372551ab4c6a321cb560094.tar.gz
CMake-3b9f97f32d019520c372551ab4c6a321cb560094.tar.bz2
Adding new options to LoadCache.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCacheManager.cxx20
-rw-r--r--Source/cmCacheManager.h3
-rw-r--r--Source/cmLoadCacheCommand.cxx36
-rw-r--r--Source/cmLoadCacheCommand.h8
4 files changed, 56 insertions, 11 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 7c01fe2..46e0ea2 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -111,12 +111,13 @@ bool cmCacheManager::LoadCache(const char* path,
bool internal)
{
std::set<std::string> emptySet;
- return this->LoadCache(path, internal, emptySet);
+ return this->LoadCache(path, internal, emptySet, emptySet);
}
bool cmCacheManager::LoadCache(const char* path,
bool internal,
- std::set<std::string>& excludes)
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes)
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt";
@@ -164,8 +165,12 @@ bool cmCacheManager::LoadCache(const char* path,
if ( excludes.find(entryKey) == excludes.end() )
{
e.m_Type = cmCacheManager::StringToType(regQuoted.match(2).c_str());
- // only load internal values if internal is set
- if (internal || e.m_Type != INTERNAL)
+ // Load internal values if internal is set.
+ // If the entry is not internal to the cache being loaded
+ // or if it is in the list of internal entries to be
+ // imported, load it.
+ if ( internal || (e.m_Type != INTERNAL) ||
+ (includes.find(entryKey) != includes.end()) )
{
// If we are loading the cache from another project,
// make all loaded entries internal so that it is
@@ -186,7 +191,12 @@ bool cmCacheManager::LoadCache(const char* path,
{
e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str());
// only load internal values if internal is set
- if (internal || e.m_Type != INTERNAL)
+ // Load internal values if internal is set.
+ // If the entry is not internal to the cache being loaded
+ // or if it is in the list of internal entries to be
+ // imported, load it.
+ if ( internal || (e.m_Type != INTERNAL) ||
+ (includes.find(entryKey) != includes.end()) )
{
// If we are loading the cache from another project,
// make all loaded entries internal so that it is
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 206cec8..d1b6c21 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -79,7 +79,8 @@ public:
bool LoadCache(const char* path);
bool LoadCache(const char* path, bool internal);
bool LoadCache(const char* path, bool internal,
- std::set<std::string>& excludes);
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes);
///! Put cache definitions into makefile
void DefineCache(cmMakefile*);
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 09e0480..93afbd6 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -24,8 +24,10 @@ bool cmLoadCacheCommand::InitialPass(std::vector<std::string>& args)
this->SetError("called with wrong number of arguments.");
}
+ // 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.
bool excludeFiles=false;
- unsigned int excludeIndex=0;
unsigned int i;
std::set<std::string> excludes;
@@ -40,16 +42,44 @@ bool cmLoadCacheCommand::InitialPass(std::vector<std::string>& args)
{
excludeFiles=true;
}
+ if (excludeFiles && (args[i] == "INCLUDE_INTERNALS"))
+ {
+ break;
+ }
}
+ // 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;
+
for(i=0; i<args.size(); i++)
{
- if (args[i] == "EXCLUDE")
+ 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"))
{
break;
}
m_Makefile->ExpandVariablesInString(args[i]);
- cmCacheManager::GetInstance()->LoadCache(args[i].c_str(),false,excludes);
+ cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
+ excludes, includes);
cmCacheManager::GetInstance()->DefineCache(m_Makefile);
}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index a184f88..3a80af9 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -88,8 +88,12 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "LOAD_CACHE(pathToCacheFile)\n"
- "Load in the values from another cache. This is useful for a project that depends on another project built in a different tree.";
+ "LOAD_CACHE(pathToCacheFile [EXCLUDE entry1...] [INCLUDE_INTERNALS entry1...])\n"
+ "Load in the values from another cache. This is useful for a project "
+ "that depends on another project built in a different tree."
+ "EXCLUDE option can be used to provide a list of entries to be included."
+ "INCLUDE_INTERNALS can be used to provide a list of internal entries"
+ "to be included. Normally, no internal entries are brougt in.";
}
cmTypeMacro(cmLoadCacheCommand, cmCommand);