|
|
@@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|
|
std::string cachedValue;
|
|
|
if(this->WarnUnusedCli)
|
|
|
{
|
|
|
- if(const char *v = this->CacheManager->GetCacheValue(var))
|
|
|
+ if(const char *v = this->CacheManager
|
|
|
+ ->GetInitializedCacheValue(var))
|
|
|
{
|
|
|
haveValue = true;
|
|
|
cachedValue = v;
|
|
|
@@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|
|
if(this->WarnUnusedCli)
|
|
|
{
|
|
|
if (!haveValue ||
|
|
|
- cachedValue != this->CacheManager->GetCacheValue(var))
|
|
|
+ cachedValue != this->CacheManager
|
|
|
+ ->GetInitializedCacheValue(var))
|
|
|
{
|
|
|
this->WatchUnusedCli(var);
|
|
|
}
|
|
|
@@ -401,17 +403,18 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|
|
cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
|
|
|
//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() )
|
|
|
+ std::vector<std::string> cacheKeys =
|
|
|
+ this->CacheManager->GetCacheEntryKeys();
|
|
|
+ for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
|
|
+ it != cacheKeys.end(); ++it)
|
|
|
{
|
|
|
- cmCacheManager::CacheEntryType t = it.GetType();
|
|
|
+ cmCacheManager::CacheEntryType t =
|
|
|
+ this->CacheManager->GetCacheEntryType(*it);
|
|
|
if(t != cmCacheManager::STATIC)
|
|
|
{
|
|
|
- std::string entryName = it.GetName();
|
|
|
- if (regex.find(entryName.c_str()))
|
|
|
+ if (regex.find(it->c_str()))
|
|
|
{
|
|
|
- entriesToDelete.push_back(entryName);
|
|
|
+ entriesToDelete.push_back(*it);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -915,16 +918,18 @@ void cmake::SetDirectoriesFromFile(const char* arg)
|
|
|
// If there is a CMakeCache.txt file, use its settings.
|
|
|
if(!cachePath.empty())
|
|
|
{
|
|
|
- cmCacheManager* cachem = this->GetCacheManager();
|
|
|
- cmCacheManager::CacheIterator it = cachem->NewIterator();
|
|
|
- if(cachem->LoadCache(cachePath) &&
|
|
|
- it.Find("CMAKE_HOME_DIRECTORY"))
|
|
|
+ if(this->LoadCache(cachePath))
|
|
|
{
|
|
|
- this->SetHomeOutputDirectory(cachePath);
|
|
|
- this->SetStartOutputDirectory(cachePath);
|
|
|
- this->SetHomeDirectory(it.GetValue());
|
|
|
- this->SetStartDirectory(it.GetValue());
|
|
|
- return;
|
|
|
+ const char* existingValue =
|
|
|
+ this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
|
|
+ if (existingValue)
|
|
|
+ {
|
|
|
+ this->SetHomeOutputDirectory(cachePath);
|
|
|
+ this->SetStartOutputDirectory(cachePath);
|
|
|
+ this->SetHomeDirectory(existingValue);
|
|
|
+ this->SetStartDirectory(existingValue);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1203,10 +1208,10 @@ int cmake::DoPreConfigureChecks()
|
|
|
}
|
|
|
|
|
|
// do a sanity check on some values
|
|
|
- if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
|
|
|
+ if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"))
|
|
|
{
|
|
|
std::string cacheStart =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
|
|
|
cacheStart += "/CMakeLists.txt";
|
|
|
std::string currentStart = this->GetHomeDirectory();
|
|
|
currentStart += "/CMakeLists.txt";
|
|
|
@@ -1355,9 +1360,9 @@ int cmake::ActualConfigure()
|
|
|
if(!this->GlobalGenerator)
|
|
|
{
|
|
|
const char* genName =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR");
|
|
|
const char* extraGenName =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
|
|
if(genName)
|
|
|
{
|
|
|
std::string fullName = cmExternalMakefileProjectGenerator::
|
|
|
@@ -1435,7 +1440,8 @@ int cmake::ActualConfigure()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
|
|
|
+ const char* genName = this->CacheManager
|
|
|
+ ->GetInitializedCacheValue("CMAKE_GENERATOR");
|
|
|
if(genName)
|
|
|
{
|
|
|
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
|
|
|
@@ -1451,7 +1457,7 @@ int cmake::ActualConfigure()
|
|
|
return -2;
|
|
|
}
|
|
|
}
|
|
|
- if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
|
|
|
+ if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"))
|
|
|
{
|
|
|
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
|
|
|
this->GlobalGenerator->GetName().c_str(),
|
|
|
@@ -1464,7 +1470,7 @@ int cmake::ActualConfigure()
|
|
|
}
|
|
|
|
|
|
if(const char* platformName =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM"))
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM"))
|
|
|
{
|
|
|
if(this->GeneratorPlatform.empty())
|
|
|
{
|
|
|
@@ -1492,7 +1498,7 @@ int cmake::ActualConfigure()
|
|
|
}
|
|
|
|
|
|
if(const char* tsName =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET"))
|
|
|
{
|
|
|
if(this->GeneratorToolset.empty())
|
|
|
{
|
|
|
@@ -1546,16 +1552,18 @@ int cmake::ActualConfigure()
|
|
|
// project requires compatibility with CMake 2.4. We detect this
|
|
|
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
|
|
|
// variable created when CMP0001 is not set to NEW.
|
|
|
- if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
|
|
+ if(this->GetCacheManager()
|
|
|
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
|
|
{
|
|
|
- if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH"))
|
|
|
+ if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
|
|
|
{
|
|
|
this->CacheManager->AddCacheEntry
|
|
|
("LIBRARY_OUTPUT_PATH", "",
|
|
|
"Single output directory for building all libraries.",
|
|
|
cmCacheManager::PATH);
|
|
|
}
|
|
|
- if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
|
|
+ if(!this->CacheManager
|
|
|
+ ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
|
|
{
|
|
|
this->CacheManager->AddCacheEntry
|
|
|
("EXECUTABLE_OUTPUT_PATH", "",
|
|
|
@@ -1563,24 +1571,25 @@ int cmake::ActualConfigure()
|
|
|
cmCacheManager::PATH);
|
|
|
}
|
|
|
}
|
|
|
- if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
|
|
+ if(!this->CacheManager
|
|
|
+ ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
|
|
{
|
|
|
this->CacheManager->AddCacheEntry
|
|
|
("CMAKE_USE_RELATIVE_PATHS", "OFF",
|
|
|
"If true, cmake will use relative paths in makefiles and projects.",
|
|
|
cmCacheManager::BOOL);
|
|
|
- cmCacheManager::CacheIterator it =
|
|
|
- this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS");
|
|
|
- if ( !it.PropertyExists("ADVANCED") )
|
|
|
+ if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
|
|
+ "ADVANCED"))
|
|
|
{
|
|
|
- it.SetProperty("ADVANCED", "1");
|
|
|
+ this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
|
|
+ "ADVANCED", "1");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(cmSystemTools::GetFatalErrorOccured() &&
|
|
|
- (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
|
|
|
+ (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") ||
|
|
|
cmSystemTools::IsOff(this->CacheManager->
|
|
|
- GetCacheValue("CMAKE_MAKE_PROGRAM"))))
|
|
|
+ GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"))))
|
|
|
{
|
|
|
// We must have a bad generator selection. Wipe the cache entry so the
|
|
|
// user can select another.
|
|
|
@@ -1796,7 +1805,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
|
|
|
|
|
|
const char* cmake::GetCacheDefinition(const std::string& name) const
|
|
|
{
|
|
|
- return this->CacheManager->GetCacheValue(name);
|
|
|
+ return this->CacheManager->GetInitializedCacheValue(name);
|
|
|
}
|
|
|
|
|
|
void cmake::AddDefaultCommands()
|
|
|
@@ -1860,10 +1869,18 @@ void cmake::AddDefaultGenerators()
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+bool cmake::ParseCacheEntry(const std::string& entry,
|
|
|
+ std::string& var,
|
|
|
+ std::string& value,
|
|
|
+ cmCacheManager::CacheEntryType& type)
|
|
|
+{
|
|
|
+ return cmCacheManager::ParseEntry(entry, var, value, type);
|
|
|
+}
|
|
|
+
|
|
|
int cmake::LoadCache()
|
|
|
{
|
|
|
// could we not read the cache
|
|
|
- if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory()))
|
|
|
+ if (!this->LoadCache(this->GetHomeOutputDirectory()))
|
|
|
{
|
|
|
// if it does exist, but isn't readable then warn the user
|
|
|
std::string cacheFile = this->GetHomeOutputDirectory();
|
|
|
@@ -1886,6 +1903,28 @@ int cmake::LoadCache()
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+bool cmake::LoadCache(const std::string& path)
|
|
|
+{
|
|
|
+ return this->CacheManager->LoadCache(path);
|
|
|
+}
|
|
|
+
|
|
|
+bool cmake::LoadCache(const std::string& path, bool internal,
|
|
|
+ std::set<std::string>& excludes,
|
|
|
+ std::set<std::string>& includes)
|
|
|
+{
|
|
|
+ return this->CacheManager->LoadCache(path, internal, excludes, includes);
|
|
|
+}
|
|
|
+
|
|
|
+bool cmake::SaveCache(const std::string& path)
|
|
|
+{
|
|
|
+ return this->CacheManager->SaveCache(path);
|
|
|
+}
|
|
|
+
|
|
|
+bool cmake::DeleteCache(const std::string& path)
|
|
|
+{
|
|
|
+ return this->CacheManager->DeleteCache(path);
|
|
|
+}
|
|
|
+
|
|
|
void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
|
|
|
{
|
|
|
this->ProgressCallback = f;
|
|
|
@@ -1926,7 +1965,8 @@ void cmake::UpdateConversionPathTable()
|
|
|
{
|
|
|
// Update the path conversion table with any specified file:
|
|
|
const char* tablepath =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
|
|
+ this->CacheManager
|
|
|
+ ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
|
|
|
|
|
if(tablepath)
|
|
|
{
|
|
|
@@ -2160,7 +2200,7 @@ void cmake::TruncateOutputLog(const char* fname)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
|
|
|
+ if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") )
|
|
|
{
|
|
|
cmSystemTools::RemoveFile(fullPath);
|
|
|
return;
|
|
|
@@ -2277,17 +2317,9 @@ const char *cmake::GetProperty(const std::string& prop,
|
|
|
std::string output = "";
|
|
|
if ( prop == "CACHE_VARIABLES" )
|
|
|
{
|
|
|
- cmCacheManager::CacheIterator cit =
|
|
|
- this->GetCacheManager()->GetCacheIterator();
|
|
|
- for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
|
|
|
- {
|
|
|
- if (!output.empty())
|
|
|
- {
|
|
|
- output += ";";
|
|
|
- }
|
|
|
- output += cit.GetName();
|
|
|
- }
|
|
|
- this->SetProperty("CACHE_VARIABLES", output.c_str());
|
|
|
+ std::vector<std::string> cacheKeys =
|
|
|
+ this->CacheManager->GetCacheEntryKeys();
|
|
|
+ this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
|
|
|
}
|
|
|
else if ( prop == "COMMANDS" )
|
|
|
{
|
|
|
@@ -2439,7 +2471,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
|
|
|
// we have to find the module directory, so we can copy the files
|
|
|
this->AddCMakePaths();
|
|
|
std::string modulesPath =
|
|
|
- this->CacheManager->GetCacheValue("CMAKE_ROOT");
|
|
|
+ this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT");
|
|
|
modulesPath += "/Modules";
|
|
|
std::string inFile = modulesPath;
|
|
|
inFile += "/SystemInformation.cmake";
|
|
|
@@ -2649,9 +2681,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
|
|
|
if(t == cmake::AUTHOR_WARNING)
|
|
|
{
|
|
|
// Allow suppression of these warnings.
|
|
|
- cmCacheManager::CacheIterator it = this->CacheManager
|
|
|
- ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
|
|
- if(!it.IsAtEnd() && it.GetValueAsBool())
|
|
|
+ const char* suppress = this->CacheManager->GetCacheEntryValue(
|
|
|
+ "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
|
|
+ if(suppress && cmSystemTools::IsOn(suppress))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -2764,38 +2796,42 @@ int cmake::Build(const std::string& dir,
|
|
|
}
|
|
|
std::string cachePath = dir;
|
|
|
cmSystemTools::ConvertToUnixSlashes(cachePath);
|
|
|
- cmCacheManager* cachem = this->GetCacheManager();
|
|
|
- cmCacheManager::CacheIterator it = cachem->NewIterator();
|
|
|
- if(!cachem->LoadCache(cachePath))
|
|
|
+ if(!this->LoadCache(cachePath))
|
|
|
{
|
|
|
std::cerr << "Error: could not load cache\n";
|
|
|
return 1;
|
|
|
}
|
|
|
- if(!it.Find("CMAKE_GENERATOR"))
|
|
|
+ const char* cachedGenerator =
|
|
|
+ this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR");
|
|
|
+ if(!cachedGenerator)
|
|
|
{
|
|
|
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
|
|
return 1;
|
|
|
}
|
|
|
cmsys::auto_ptr<cmGlobalGenerator> gen(
|
|
|
- this->CreateGlobalGenerator(it.GetValue()));
|
|
|
+ this->CreateGlobalGenerator(cachedGenerator));
|
|
|
if(!gen.get())
|
|
|
{
|
|
|
std::cerr << "Error: could create CMAKE_GENERATOR \""
|
|
|
- << it.GetValue() << "\"\n";
|
|
|
+ << cachedGenerator << "\"\n";
|
|
|
return 1;
|
|
|
}
|
|
|
std::string output;
|
|
|
std::string projName;
|
|
|
- if(!it.Find("CMAKE_PROJECT_NAME"))
|
|
|
+ const char* cachedProjectName =
|
|
|
+ this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME");
|
|
|
+ if(!cachedProjectName)
|
|
|
{
|
|
|
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
|
|
|
return 1;
|
|
|
}
|
|
|
- projName = it.GetValue();
|
|
|
+ projName = cachedProjectName;
|
|
|
bool verbose = false;
|
|
|
- if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
|
|
|
+ const char* cachedVerbose =
|
|
|
+ this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
|
|
|
+ if(cachedVerbose)
|
|
|
{
|
|
|
- verbose = it.GetValueAsBool();
|
|
|
+ verbose = cmSystemTools::IsOn(cachedVerbose);
|
|
|
}
|
|
|
return gen->Build("", dir,
|
|
|
projName, target,
|