[cmake-commits] alex committed cmake.cxx 1.291 1.292 cmake.h 1.77 1.78
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Jun 1 14:16:48 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv23647/Source
Modified Files:
cmake.cxx cmake.h
Log Message:
BUG: also put a variable into the cache when defined using -D if no type is
given, then STRING is used. Also add command line option -U as suggested for
undefining cache variables. This fixes #4896 and #4264.
Alex
Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- cmake.h 28 May 2007 16:23:32 -0000 1.77
+++ cmake.h 1 Jun 2007 18:16:46 -0000 1.78
@@ -388,6 +388,11 @@
"for the project. This option may be used to specify a setting " \
"that takes priority over the project's default value. The option " \
"may be repeated for as many cache entries as desired."}, \
+ {"-U <var>", "Remove one or more cmake cache entries.", \
+ "This option may be used to remove one or more variables from the " \
+ "CMakeCache.txt file, so that CMake will search them again. All " \
+ "variables which contain \"<var>\" will be removed. The option may be "\
+ "repeated for as many cache entries as desired."}, \
{"-G <generator-name>", "Specify a makefile generator.", \
"CMake may support multiple native build systems on certain platforms. " \
"A makefile generator is responsible for generating a particular build " \
Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -d -r1.291 -r1.292
--- cmake.cxx 11 Apr 2007 19:13:05 -0000 1.291
+++ cmake.cxx 1 Jun 2007 18:16:46 -0000 1.292
@@ -299,7 +299,7 @@
{
this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
"No help, variable specified on the command line.",
- type);
+ type==cmCacheManager::UNINITIALIZED?cmCacheManager::STRING:type);
}
else
{
@@ -309,6 +309,49 @@
return false;
}
}
+ else if(arg.find("-U",0) == 0)
+ {
+ std::string entryPattern = arg.substr(2);
+ if(entryPattern.size() == 0)
+ {
+ ++i;
+ if(i < args.size())
+ {
+ entryPattern = args[i];
+ }
+ else
+ {
+ cmSystemTools::Error("-U must be followed with VAR.");
+ return false;
+ }
+ }
+
+ //go through all cache entries and collect the vars which will be removed
+ std::vector<std::string> entriesToDelete;
+ cmCacheManager::CacheIterator it =
+ this->CacheManager->GetCacheIterator();
+ for ( it.Begin(); !it.IsAtEnd(); it.Next() )
+ {
+ cmCacheManager::CacheEntryType t = it.GetType();
+ if(t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED)
+ {
+ std::string entryName = it.GetName();
+ if (entryName.find(entryPattern) != std::string::npos)
+ {
+ entriesToDelete.push_back(entryName);
+ }
+ }
+ }
+
+ // now remove them from the cache
+ for(std::vector<std::string>::const_iterator currentEntry =
+ entriesToDelete.begin();
+ currentEntry != entriesToDelete.end();
+ ++currentEntry)
+ {
+ this->CacheManager->RemoveCacheEntry(currentEntry->c_str());
+ }
+ }
else if(arg.find("-C",0) == 0)
{
std::string path = arg.substr(2);
@@ -432,6 +475,10 @@
{
// skip for now
}
+ else if(arg.find("-U",0) == 0)
+ {
+ // skip for now
+ }
else if(arg.find("-C",0) == 0)
{
// skip for now
More information about the Cmake-commits
mailing list