Merge topic 'refactor-cache-api'
9410e24a
cmCacheManager: Port consumers to non-iterator API.7b7ae3b1
Port QtDialog to non-iterator cache API.228c629c
Port CursesDialog to non-iterator cache API.2e50f5e7
cmMakefile: Port away from CacheEntry.Initialized.e6224367
cmCacheManager: Add non-iterator-based API.9ada4c04
cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.1fe7f24c
Add API for cache loading, deleting and saving to the cmake class.08c642c6
cmMakefile: Remove cache version accessors.cec8f97e
cmMakefile: Simplify GetDefinitions implementation.
This commit is contained in:
commit
678493d60f
|
@ -18,7 +18,6 @@
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include <cmsys/Process.h>
|
#include <cmsys/Process.h>
|
||||||
#include "cmCTestTestHandler.h"
|
#include "cmCTestTestHandler.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
|
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
|
||||||
|
@ -255,7 +254,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
|
||||||
cm.SetGeneratorToolset(this->BuildGeneratorToolset);
|
cm.SetGeneratorToolset(this->BuildGeneratorToolset);
|
||||||
|
|
||||||
// Load the cache to make CMAKE_MAKE_PROGRAM available.
|
// Load the cache to make CMAKE_MAKE_PROGRAM available.
|
||||||
cm.GetCacheManager()->LoadCache(this->BinaryDir);
|
cm.LoadCache(this->BinaryDir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
#include "cmCursesFilePathWidget.h"
|
#include "cmCursesFilePathWidget.h"
|
||||||
#include "cmCursesDummyWidget.h"
|
#include "cmCursesDummyWidget.h"
|
||||||
#include "../cmSystemTools.h"
|
#include "../cmSystemTools.h"
|
||||||
|
#include "../cmake.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
|
@ -32,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew,
|
const std::string& key, cmake *cm, bool isNew,
|
||||||
int labelwidth, int entrywidth)
|
int labelwidth, int entrywidth)
|
||||||
: Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
|
: Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
|
||||||
{
|
{
|
||||||
|
@ -47,11 +50,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Entry = 0;
|
this->Entry = 0;
|
||||||
switch ( it.GetType() )
|
const char* value = cm->GetCacheManager()->GetCacheEntryValue(key);
|
||||||
|
assert(value);
|
||||||
|
switch (cm->GetCacheManager()->GetCacheEntryType(key))
|
||||||
{
|
{
|
||||||
case cmCacheManager::BOOL:
|
case cmCacheManager::BOOL:
|
||||||
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
|
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
|
||||||
if (cmSystemTools::IsOn(it.GetValue().c_str()))
|
if (cmSystemTools::IsOn(value))
|
||||||
{
|
{
|
||||||
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
|
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
|
||||||
}
|
}
|
||||||
|
@ -62,40 +67,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::PATH:
|
case cmCacheManager::PATH:
|
||||||
this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
|
this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
|
||||||
static_cast<cmCursesPathWidget*>(this->Entry)->SetString(
|
static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
|
||||||
it.GetValue());
|
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::FILEPATH:
|
case cmCacheManager::FILEPATH:
|
||||||
this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
|
this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
|
||||||
static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(
|
static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
|
||||||
it.GetValue());
|
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::STRING:
|
case cmCacheManager::STRING:
|
||||||
if(it.PropertyExists("STRINGS"))
|
{
|
||||||
|
const char* stringsProp = cm->GetCacheManager()
|
||||||
|
->GetCacheEntryProperty(key, "STRINGS");
|
||||||
|
if(stringsProp)
|
||||||
{
|
{
|
||||||
cmCursesOptionsWidget* ow =
|
cmCursesOptionsWidget* ow =
|
||||||
new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
|
new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
|
||||||
this->Entry = ow;
|
this->Entry = ow;
|
||||||
std::vector<std::string> options;
|
std::vector<std::string> options;
|
||||||
cmSystemTools::ExpandListArgument(
|
cmSystemTools::ExpandListArgument(stringsProp, options);
|
||||||
std::string(it.GetProperty("STRINGS")), options);
|
|
||||||
for(std::vector<std::string>::iterator
|
for(std::vector<std::string>::iterator
|
||||||
si = options.begin(); si != options.end(); ++si)
|
si = options.begin(); si != options.end(); ++si)
|
||||||
{
|
{
|
||||||
ow->AddOption(*si);
|
ow->AddOption(*si);
|
||||||
}
|
}
|
||||||
ow->SetOption(it.GetValue());
|
ow->SetOption(value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
|
this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
|
||||||
static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
|
static_cast<cmCursesStringWidget*>(this->Entry)->SetString(value);
|
||||||
it.GetValue());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case cmCacheManager::UNINITIALIZED:
|
case cmCacheManager::UNINITIALIZED:
|
||||||
cmSystemTools::Error("Found an undefined variable: ",
|
cmSystemTools::Error("Found an undefined variable: ",
|
||||||
it.GetName().c_str());
|
key.c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO : put warning message here
|
// TODO : put warning message here
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
|
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
|
||||||
int entrywidth);
|
int entrywidth);
|
||||||
cmCursesCacheEntryComposite(const std::string& key,
|
cmCursesCacheEntryComposite(const std::string& key,
|
||||||
const cmCacheManager::CacheIterator& it,
|
cmake *cm,
|
||||||
bool isNew, int labelwidth, int entrywidth);
|
bool isNew, int labelwidth, int entrywidth);
|
||||||
~cmCursesCacheEntryComposite();
|
~cmCursesCacheEntryComposite();
|
||||||
const char* GetValue();
|
const char* GetValue();
|
||||||
|
|
|
@ -111,13 +111,17 @@ void cmCursesMainForm::InitializeUI()
|
||||||
|
|
||||||
// Count non-internal and non-static entries
|
// Count non-internal and non-static entries
|
||||||
int count=0;
|
int count=0;
|
||||||
for(cmCacheManager::CacheIterator i =
|
std::vector<std::string> cacheKeys =
|
||||||
this->CMakeInstance->GetCacheManager()->NewIterator();
|
this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys();
|
||||||
!i.IsAtEnd(); i.Next())
|
|
||||||
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
if ( i.GetType() != cmCacheManager::INTERNAL &&
|
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
||||||
i.GetType() != cmCacheManager::STATIC &&
|
->GetCacheEntryType(*it);
|
||||||
i.GetType() != cmCacheManager::UNINITIALIZED)
|
if (t != cmCacheManager::INTERNAL &&
|
||||||
|
t != cmCacheManager::STATIC &&
|
||||||
|
t != cmCacheManager::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
@ -139,45 +143,49 @@ void cmCursesMainForm::InitializeUI()
|
||||||
// Create the composites.
|
// Create the composites.
|
||||||
|
|
||||||
// First add entries which are new
|
// First add entries which are new
|
||||||
for(cmCacheManager::CacheIterator i =
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
this->CMakeInstance->GetCacheManager()->NewIterator();
|
it != cacheKeys.end(); ++it)
|
||||||
!i.IsAtEnd(); i.Next())
|
|
||||||
{
|
{
|
||||||
std::string key = i.GetName();
|
std::string key = *it;
|
||||||
if ( i.GetType() == cmCacheManager::INTERNAL ||
|
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
||||||
i.GetType() == cmCacheManager::STATIC ||
|
->GetCacheEntryType(*it);
|
||||||
i.GetType() == cmCacheManager::UNINITIALIZED )
|
if (t == cmCacheManager::INTERNAL ||
|
||||||
|
t == cmCacheManager::STATIC ||
|
||||||
|
t == cmCacheManager::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->LookForCacheEntry(key))
|
if (!this->LookForCacheEntry(key))
|
||||||
{
|
{
|
||||||
newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
|
newEntries->push_back(new cmCursesCacheEntryComposite(key,
|
||||||
true, 30,
|
this->CMakeInstance,
|
||||||
entrywidth));
|
true, 30,
|
||||||
|
entrywidth));
|
||||||
this->OkToGenerate = false;
|
this->OkToGenerate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// then add entries which are old
|
// then add entries which are old
|
||||||
for(cmCacheManager::CacheIterator i =
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
this->CMakeInstance->GetCacheManager()->NewIterator();
|
it != cacheKeys.end(); ++it)
|
||||||
!i.IsAtEnd(); i.Next())
|
|
||||||
{
|
{
|
||||||
std::string key = i.GetName();
|
std::string key = *it;
|
||||||
if ( i.GetType() == cmCacheManager::INTERNAL ||
|
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
||||||
i.GetType() == cmCacheManager::STATIC ||
|
->GetCacheEntryType(*it);
|
||||||
i.GetType() == cmCacheManager::UNINITIALIZED )
|
if (t == cmCacheManager::INTERNAL ||
|
||||||
|
t == cmCacheManager::STATIC ||
|
||||||
|
t == cmCacheManager::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->LookForCacheEntry(key))
|
if (this->LookForCacheEntry(key))
|
||||||
{
|
{
|
||||||
newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
|
newEntries->push_back(new cmCursesCacheEntryComposite(key,
|
||||||
false, 30,
|
this->CMakeInstance,
|
||||||
entrywidth));
|
false, 30,
|
||||||
|
entrywidth));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,10 +224,13 @@ void cmCursesMainForm::RePost()
|
||||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator mit =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
|
this->CMakeInstance->GetCacheManager()
|
||||||
if (mit.IsAtEnd() ||
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
|
bool advanced =
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -245,10 +256,13 @@ void cmCursesMainForm::RePost()
|
||||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator mit =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
|
this->CMakeInstance->GetCacheManager()
|
||||||
if (mit.IsAtEnd() ||
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
|
bool advanced =
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -314,10 +328,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator mit =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
|
this->CMakeInstance->GetCacheManager()
|
||||||
if (mit.IsAtEnd() ||
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
|
bool advanced =
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -334,10 +351,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator mit =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
|
this->CMakeInstance->GetCacheManager()
|
||||||
if (mit.IsAtEnd() ||
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
|
bool advanced =
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -495,11 +515,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
|
||||||
|
|
||||||
// Get the help string of the current entry
|
// Get the help string of the current entry
|
||||||
// and add it to the help string
|
// and add it to the help string
|
||||||
cmCacheManager::CacheIterator it =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
|
this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField);
|
||||||
if (!it.IsAtEnd())
|
if (existingValue)
|
||||||
{
|
{
|
||||||
const char* hs = it.GetProperty("HELPSTRING");
|
const char* hs = this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryProperty(curField, "HELPSTRING");
|
||||||
if ( hs )
|
if ( hs )
|
||||||
{
|
{
|
||||||
strncpy(help, hs, 127);
|
strncpy(help, hs, 127);
|
||||||
|
@ -639,7 +660,7 @@ int cmCursesMainForm::Configure(int noconfigure)
|
||||||
|
|
||||||
// always save the current gui values to disk
|
// always save the current gui values to disk
|
||||||
this->FillCacheManagerFromUI();
|
this->FillCacheManagerFromUI();
|
||||||
this->CMakeInstance->GetCacheManager()->SaveCache(
|
this->CMakeInstance->SaveCache(
|
||||||
this->CMakeInstance->GetHomeOutputDirectory());
|
this->CMakeInstance->GetHomeOutputDirectory());
|
||||||
this->LoadCache(0);
|
this->LoadCache(0);
|
||||||
|
|
||||||
|
@ -792,23 +813,28 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||||
size_t size = this->Entries->size();
|
size_t size = this->Entries->size();
|
||||||
for(size_t i=0; i < size; i++)
|
for(size_t i=0; i < size; i++)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator it =
|
std::string cacheKey = (*this->Entries)[i]->Key;
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator(
|
const char* existingValue = this->CMakeInstance->GetCacheManager()
|
||||||
(*this->Entries)[i]->Key.c_str());
|
->GetCacheEntryValue(cacheKey);
|
||||||
if (!it.IsAtEnd())
|
if (existingValue)
|
||||||
{
|
{
|
||||||
std::string oldValue = it.GetValue();
|
std::string oldValue = existingValue;
|
||||||
std::string newValue = (*this->Entries)[i]->Entry->GetValue();
|
std::string newValue = (*this->Entries)[i]->Entry->GetValue();
|
||||||
std::string fixedOldValue;
|
std::string fixedOldValue;
|
||||||
std::string fixedNewValue;
|
std::string fixedNewValue;
|
||||||
this->FixValue(it.GetType(), oldValue, fixedOldValue);
|
cmCacheManager::CacheEntryType t =
|
||||||
this->FixValue(it.GetType(), newValue, fixedNewValue);
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryType(cacheKey);
|
||||||
|
this->FixValue(t, oldValue, fixedOldValue);
|
||||||
|
this->FixValue(t, newValue, fixedNewValue);
|
||||||
|
|
||||||
if(!(fixedOldValue == fixedNewValue))
|
if(!(fixedOldValue == fixedNewValue))
|
||||||
{
|
{
|
||||||
// The user has changed the value. Mark it as modified.
|
// The user has changed the value. Mark it as modified.
|
||||||
it.SetProperty("MODIFIED", true);
|
this->CMakeInstance->GetCacheManager()
|
||||||
it.SetValue(fixedNewValue.c_str());
|
->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->SetCacheEntryValue(cacheKey, fixedNewValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1017,12 +1043,15 @@ void cmCursesMainForm::HandleInput()
|
||||||
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
|
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
|
||||||
this->Fields[findex-2]));
|
this->Fields[findex-2]));
|
||||||
const char* curField = lbl->GetValue();
|
const char* curField = lbl->GetValue();
|
||||||
const char* helpString=0;
|
const char* helpString = 0;
|
||||||
cmCacheManager::CacheIterator it =
|
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
|
const char* existingValue =
|
||||||
if (!it.IsAtEnd())
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryValue(curField);
|
||||||
|
if (existingValue)
|
||||||
{
|
{
|
||||||
helpString = it.GetProperty("HELPSTRING");
|
helpString = this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntryProperty(curField, "HELPSTRING");
|
||||||
}
|
}
|
||||||
if (helpString)
|
if (helpString)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
||||||
emit this->binaryDirChanged(this->BinaryDirectory);
|
emit this->binaryDirChanged(this->BinaryDirectory);
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
||||||
this->setGenerator(QString());
|
this->setGenerator(QString());
|
||||||
if(!this->CMakeInstance->GetCacheManager()->LoadCache(
|
if(!this->CMakeInstance->LoadCache(
|
||||||
this->BinaryDirectory.toLocal8Bit().data()))
|
this->BinaryDirectory.toLocal8Bit().data()))
|
||||||
{
|
{
|
||||||
QDir testDir(this->BinaryDirectory);
|
QDir testDir(this->BinaryDirectory);
|
||||||
|
@ -110,16 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
||||||
|
|
||||||
QCMakePropertyList props = this->properties();
|
QCMakePropertyList props = this->properties();
|
||||||
emit this->propertiesChanged(props);
|
emit this->propertiesChanged(props);
|
||||||
cmCacheManager::CacheIterator itm = cachem->NewIterator();
|
const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||||
if ( itm.Find("CMAKE_HOME_DIRECTORY"))
|
if (homeDir)
|
||||||
{
|
{
|
||||||
setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
|
setSourceDirectory(QString::fromLocal8Bit(homeDir));
|
||||||
}
|
}
|
||||||
if ( itm.Find("CMAKE_GENERATOR"))
|
const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR");
|
||||||
|
if (gen)
|
||||||
{
|
{
|
||||||
const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR");
|
const char* extraGen = cachem
|
||||||
|
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||||
std::string curGen = cmExternalMakefileProjectGenerator::
|
std::string curGen = cmExternalMakefileProjectGenerator::
|
||||||
CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
|
CreateFullGeneratorName(gen, extraGen? extraGen : "");
|
||||||
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
|
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,33 +196,35 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
|
|
||||||
// set the value of properties
|
// set the value of properties
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
||||||
for(cmCacheManager::CacheIterator i = cachem->NewIterator();
|
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
|
||||||
!i.IsAtEnd(); i.Next())
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
|
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it);
|
||||||
if(i.GetType() == cmCacheManager::INTERNAL ||
|
if(t == cmCacheManager::INTERNAL ||
|
||||||
i.GetType() == cmCacheManager::STATIC)
|
t == cmCacheManager::STATIC)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCMakeProperty prop;
|
QCMakeProperty prop;
|
||||||
prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
|
prop.Key = QString::fromLocal8Bit(it->c_str());
|
||||||
int idx = props.indexOf(prop);
|
int idx = props.indexOf(prop);
|
||||||
if(idx == -1)
|
if(idx == -1)
|
||||||
{
|
{
|
||||||
toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
|
toremove.append(QString::fromLocal8Bit(it->c_str()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prop = props[idx];
|
prop = props[idx];
|
||||||
if(prop.Value.type() == QVariant::Bool)
|
if(prop.Value.type() == QVariant::Bool)
|
||||||
{
|
{
|
||||||
i.SetValue(prop.Value.toBool() ? "ON" : "OFF");
|
cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i.SetValue(prop.Value.toString().toLocal8Bit().data());
|
cachem->SetCacheEntryValue(*it,
|
||||||
|
prop.Value.toString().toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
props.removeAt(idx);
|
props.removeAt(idx);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +274,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
|
this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
QCMakePropertyList QCMake::properties() const
|
QCMakePropertyList QCMake::properties() const
|
||||||
|
@ -278,42 +282,47 @@ QCMakePropertyList QCMake::properties() const
|
||||||
QCMakePropertyList ret;
|
QCMakePropertyList ret;
|
||||||
|
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
||||||
for(cmCacheManager::CacheIterator i = cachem->NewIterator();
|
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
|
||||||
!i.IsAtEnd(); i.Next())
|
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
|
||||||
|
i != cacheKeys.end(); ++i)
|
||||||
{
|
{
|
||||||
|
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i);
|
||||||
if(i.GetType() == cmCacheManager::INTERNAL ||
|
if(t == cmCacheManager::INTERNAL ||
|
||||||
i.GetType() == cmCacheManager::STATIC ||
|
t == cmCacheManager::STATIC ||
|
||||||
i.GetType() == cmCacheManager::UNINITIALIZED)
|
t == cmCacheManager::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCMakeProperty prop;
|
const char* cachedValue = cachem->GetCacheEntryValue(*i);
|
||||||
prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
|
|
||||||
prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
|
|
||||||
prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
|
|
||||||
prop.Advanced = i.GetPropertyAsBool("ADVANCED");
|
|
||||||
|
|
||||||
if(i.GetType() == cmCacheManager::BOOL)
|
QCMakeProperty prop;
|
||||||
|
prop.Key = QString::fromLocal8Bit(i->c_str());
|
||||||
|
prop.Help = QString::fromLocal8Bit(
|
||||||
|
cachem->GetCacheEntryProperty(*i, "HELPSTRING"));
|
||||||
|
prop.Value = QString::fromLocal8Bit(cachedValue);
|
||||||
|
prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
|
||||||
|
if(t == cmCacheManager::BOOL)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::BOOL;
|
prop.Type = QCMakeProperty::BOOL;
|
||||||
prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
|
prop.Value = cmSystemTools::IsOn(cachedValue);
|
||||||
}
|
}
|
||||||
else if(i.GetType() == cmCacheManager::PATH)
|
else if(t == cmCacheManager::PATH)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::PATH;
|
prop.Type = QCMakeProperty::PATH;
|
||||||
}
|
}
|
||||||
else if(i.GetType() == cmCacheManager::FILEPATH)
|
else if(t == cmCacheManager::FILEPATH)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::FILEPATH;
|
prop.Type = QCMakeProperty::FILEPATH;
|
||||||
}
|
}
|
||||||
else if(i.GetType() == cmCacheManager::STRING)
|
else if(t == cmCacheManager::STRING)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::STRING;
|
prop.Type = QCMakeProperty::STRING;
|
||||||
if (i.PropertyExists("STRINGS"))
|
const char* stringsProperty =
|
||||||
|
cachem->GetCacheEntryProperty(*i, "STRINGS");
|
||||||
|
if (stringsProperty)
|
||||||
{
|
{
|
||||||
prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";");
|
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,9 +406,9 @@ QStringList QCMake::availableGenerators() const
|
||||||
void QCMake::deleteCache()
|
void QCMake::deleteCache()
|
||||||
{
|
{
|
||||||
// delete cache
|
// delete cache
|
||||||
this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
|
this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
|
||||||
// reload to make our cache empty
|
// reload to make our cache empty
|
||||||
this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
||||||
// emit no generator and no properties
|
// emit no generator and no properties
|
||||||
this->setGenerator(QString());
|
this->setGenerator(QString());
|
||||||
QCMakePropertyList props = this->properties();
|
QCMakePropertyList props = this->properties();
|
||||||
|
@ -412,7 +421,7 @@ void QCMake::reloadCache()
|
||||||
QCMakePropertyList props;
|
QCMakePropertyList props;
|
||||||
emit this->propertiesChanged(props);
|
emit this->propertiesChanged(props);
|
||||||
// reload
|
// reload
|
||||||
this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
||||||
// emit new cache properties
|
// emit new cache properties
|
||||||
props = this->properties();
|
props = this->properties();
|
||||||
emit this->propertiesChanged(props);
|
emit this->propertiesChanged(props);
|
||||||
|
|
|
@ -51,12 +51,14 @@ void CCONV cmSetError(void *info, const char *err)
|
||||||
unsigned int CCONV cmGetCacheMajorVersion(void *arg)
|
unsigned int CCONV cmGetCacheMajorVersion(void *arg)
|
||||||
{
|
{
|
||||||
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
||||||
return mf->GetCacheMajorVersion();
|
cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
|
||||||
|
return manager->GetCacheMajorVersion();
|
||||||
}
|
}
|
||||||
unsigned int CCONV cmGetCacheMinorVersion(void *arg)
|
unsigned int CCONV cmGetCacheMinorVersion(void *arg)
|
||||||
{
|
{
|
||||||
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
||||||
return mf->GetCacheMinorVersion();
|
cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
|
||||||
|
return manager->GetCacheMinorVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CCONV cmGetMajorVersion(void *)
|
unsigned int CCONV cmGetMajorVersion(void *)
|
||||||
|
|
|
@ -2281,7 +2281,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg)
|
||||||
std::string value;
|
std::string value;
|
||||||
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
||||||
|
|
||||||
if (cmCacheManager::ParseEntry(arg, name, value, type))
|
if (cmake::ParseCacheEntry(arg, name, value, type))
|
||||||
{
|
{
|
||||||
this->Definitions[name] = value;
|
this->Definitions[name] = value;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -283,14 +283,16 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
}
|
}
|
||||||
this->CacheMajorVersion = 0;
|
this->CacheMajorVersion = 0;
|
||||||
this->CacheMinorVersion = 0;
|
this->CacheMinorVersion = 0;
|
||||||
if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
|
if(const char* cmajor =
|
||||||
|
this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
|
||||||
{
|
{
|
||||||
unsigned int v=0;
|
unsigned int v=0;
|
||||||
if(sscanf(cmajor, "%u", &v) == 1)
|
if(sscanf(cmajor, "%u", &v) == 1)
|
||||||
{
|
{
|
||||||
this->CacheMajorVersion = v;
|
this->CacheMajorVersion = v;
|
||||||
}
|
}
|
||||||
if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
|
if(const char* cminor =
|
||||||
|
this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION"))
|
||||||
{
|
{
|
||||||
if(sscanf(cminor, "%u", &v) == 1)
|
if(sscanf(cminor, "%u", &v) == 1)
|
||||||
{
|
{
|
||||||
|
@ -312,10 +314,11 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
}
|
}
|
||||||
// check to make sure the cache directory has not
|
// check to make sure the cache directory has not
|
||||||
// been moved
|
// been moved
|
||||||
if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
|
const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
|
||||||
|
if (internal && oldDir)
|
||||||
{
|
{
|
||||||
std::string currentcwd = path;
|
std::string currentcwd = path;
|
||||||
std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
|
std::string oldcwd = oldDir;
|
||||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||||
currentcwd += "/CMakeCache.txt";
|
currentcwd += "/CMakeCache.txt";
|
||||||
oldcwd += "/CMakeCache.txt";
|
oldcwd += "/CMakeCache.txt";
|
||||||
|
@ -324,7 +327,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
std::string message =
|
std::string message =
|
||||||
std::string("The current CMakeCache.txt directory ") +
|
std::string("The current CMakeCache.txt directory ") +
|
||||||
currentcwd + std::string(" is different than the directory ") +
|
currentcwd + std::string(" is different than the directory ") +
|
||||||
std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
|
std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
|
||||||
std::string(" where CMakeCache.txt was created. This may result "
|
std::string(" where CMakeCache.txt was created. This may result "
|
||||||
"in binaries being created in the wrong place. If you "
|
"in binaries being created in the wrong place. If you "
|
||||||
"are not sure, reedit the CMakeCache.txt");
|
"are not sure, reedit the CMakeCache.txt");
|
||||||
|
@ -654,7 +657,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
|
||||||
return CacheIterator(*this, key);
|
return CacheIterator(*this, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmCacheManager::GetCacheValue(const std::string& key) const
|
const char*
|
||||||
|
cmCacheManager::GetInitializedCacheValue(const std::string& key) const
|
||||||
{
|
{
|
||||||
CacheEntryMap::const_iterator i = this->Cache.find(key);
|
CacheEntryMap::const_iterator i = this->Cache.find(key);
|
||||||
if(i != this->Cache.end() &&
|
if(i != this->Cache.end() &&
|
||||||
|
|
|
@ -137,7 +137,82 @@ public:
|
||||||
CacheEntryType& type);
|
CacheEntryType& type);
|
||||||
|
|
||||||
///! Get a value from the cache given a key
|
///! Get a value from the cache given a key
|
||||||
const char* GetCacheValue(const std::string& key) const;
|
const char* GetInitializedCacheValue(const std::string& key) const;
|
||||||
|
|
||||||
|
const char* GetCacheEntryValue(const std::string& key)
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
|
||||||
|
if (it.IsAtEnd())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return it.GetValue().c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* GetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propName)
|
||||||
|
{
|
||||||
|
return this->GetCacheIterator(key.c_str()).GetProperty(propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheEntryType GetCacheEntryType(std::string const& key)
|
||||||
|
{
|
||||||
|
return this->GetCacheIterator(key.c_str()).GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetCacheEntryPropertyAsBool(std::string const& key,
|
||||||
|
std::string const& propName)
|
||||||
|
{
|
||||||
|
return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propName,
|
||||||
|
std::string const& value)
|
||||||
|
{
|
||||||
|
this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCacheEntryBoolProperty(std::string const& key,
|
||||||
|
std::string const& propName,
|
||||||
|
bool value)
|
||||||
|
{
|
||||||
|
this->GetCacheIterator(key.c_str()).SetProperty(propName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCacheEntryValue(std::string const& key,
|
||||||
|
std::string const& value)
|
||||||
|
{
|
||||||
|
this->GetCacheIterator(key.c_str()).SetValue(value.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoveCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propName)
|
||||||
|
{
|
||||||
|
this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppendCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propName,
|
||||||
|
std::string const& value,
|
||||||
|
bool asString = false)
|
||||||
|
{
|
||||||
|
this->GetCacheIterator(key.c_str()).AppendProperty(propName,
|
||||||
|
value.c_str(),
|
||||||
|
asString);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> GetCacheEntryKeys()
|
||||||
|
{
|
||||||
|
std::vector<std::string> definitions;
|
||||||
|
definitions.reserve(this->GetSize());
|
||||||
|
cmCacheManager::CacheIterator cit = this->GetCacheIterator();
|
||||||
|
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
|
||||||
|
{
|
||||||
|
definitions.push_back(cit.GetName());
|
||||||
|
}
|
||||||
|
return definitions;
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the version of CMake that wrote the cache. */
|
/** Get the version of CMake that wrote the cache. */
|
||||||
unsigned int GetCacheMajorVersion() const
|
unsigned int GetCacheMajorVersion() const
|
||||||
|
|
|
@ -90,7 +90,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
|
||||||
}
|
}
|
||||||
if ( strcmp(key, "CACHE") == 0 )
|
if ( strcmp(key, "CACHE") == 0 )
|
||||||
{
|
{
|
||||||
if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var))
|
if(const char* c = this->Makefile->GetCacheManager()
|
||||||
|
->GetInitializedCacheValue(var))
|
||||||
{
|
{
|
||||||
if(this->EscapeQuotes)
|
if(this->EscapeQuotes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
|
||||||
|
|
||||||
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
|
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
|
||||||
cacheEntryName += envVar;
|
cacheEntryName += envVar;
|
||||||
const char* cacheValue = mf->GetCacheManager()->GetCacheValue(
|
const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue(
|
||||||
cacheEntryName);
|
cacheEntryName);
|
||||||
|
|
||||||
// now we have both, decide which one to use
|
// now we have both, decide which one to use
|
||||||
|
@ -223,7 +223,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
|
||||||
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
||||||
cacheEntryName.c_str(), cmCacheManager::STRING,
|
cacheEntryName.c_str(), cmCacheManager::STRING,
|
||||||
true);
|
true);
|
||||||
mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
|
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
||||||
}
|
}
|
||||||
else if (envVarValue==0 && cacheValue!=0)
|
else if (envVarValue==0 && cacheValue!=0)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
|
||||||
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
||||||
cacheEntryName.c_str(), cmCacheManager::STRING,
|
cacheEntryName.c_str(), cmCacheManager::STRING,
|
||||||
true);
|
true);
|
||||||
mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
|
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,18 +366,18 @@ bool cmFindBase::CheckForVariableInCache()
|
||||||
if(const char* cacheValue =
|
if(const char* cacheValue =
|
||||||
this->Makefile->GetDefinition(this->VariableName))
|
this->Makefile->GetDefinition(this->VariableName))
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator it =
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
this->Makefile->GetCacheManager()->
|
const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName);
|
||||||
GetCacheIterator(this->VariableName.c_str());
|
|
||||||
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
||||||
bool cached = !it.IsAtEnd();
|
bool cached = cacheEntry ? true : false;
|
||||||
if(found)
|
if(found)
|
||||||
{
|
{
|
||||||
// If the user specifies the entry on the command line without a
|
// If the user specifies the entry on the command line without a
|
||||||
// type we should add the type and docstring but keep the
|
// type we should add the type and docstring but keep the
|
||||||
// original value. Tell the subclass implementations to do
|
// original value. Tell the subclass implementations to do
|
||||||
// this.
|
// this.
|
||||||
if(cached && it.GetType() == cmCacheManager::UNINITIALIZED)
|
if(cached && manager->GetCacheEntryType(this->VariableName)
|
||||||
|
== cmCacheManager::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
this->AlreadyInCacheWithoutMetaInfo = true;
|
this->AlreadyInCacheWithoutMetaInfo = true;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,8 @@ bool cmFindBase::CheckForVariableInCache()
|
||||||
}
|
}
|
||||||
else if(cached)
|
else if(cached)
|
||||||
{
|
{
|
||||||
const char* hs = it.GetProperty("HELPSTRING");
|
const char* hs = manager->GetCacheEntryProperty(this->VariableName,
|
||||||
|
"HELPSTRING");
|
||||||
this->VariableDocumentation = hs?hs:"(none)";
|
this->VariableDocumentation = hs?hs:"(none)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,11 +391,10 @@ bool cmGetPropertyCommand::HandleCacheMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* value = 0;
|
const char* value = 0;
|
||||||
cmCacheManager::CacheIterator it =
|
if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name))
|
||||||
this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str());
|
|
||||||
if(!it.IsAtEnd())
|
|
||||||
{
|
{
|
||||||
value = it.GetProperty(this->PropertyName);
|
value = this->Makefile->GetCacheManager()
|
||||||
|
->GetCacheEntryProperty(this->Name, this->PropertyName);
|
||||||
}
|
}
|
||||||
this->StoreResult(value);
|
this->StoreResult(value);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char* cname = this->GetCMakeInstance()->
|
const char* cname = this->GetCMakeInstance()->
|
||||||
GetCacheManager()->GetCacheValue(langComp);
|
GetCacheManager()->GetInitializedCacheValue(langComp);
|
||||||
std::string changeVars;
|
std::string changeVars;
|
||||||
if(cname && !optional)
|
if(cname && !optional)
|
||||||
{
|
{
|
||||||
|
@ -1559,9 +1559,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
cmSystemTools::IsNOTFOUND(lib->first.c_str()))
|
cmSystemTools::IsNOTFOUND(lib->first.c_str()))
|
||||||
{
|
{
|
||||||
std::string varName = lib->first.substr(0, lib->first.size()-9);
|
std::string varName = lib->first.substr(0, lib->first.size()-9);
|
||||||
cmCacheManager::CacheIterator it =
|
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
||||||
manager->GetCacheIterator(varName.c_str());
|
|
||||||
if(it.GetPropertyAsBool("ADVANCED"))
|
|
||||||
{
|
{
|
||||||
varName += " (ADVANCED)";
|
varName += " (ADVANCED)";
|
||||||
}
|
}
|
||||||
|
@ -1592,9 +1590,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
cmSystemTools::IsNOTFOUND(incDir->c_str()))
|
cmSystemTools::IsNOTFOUND(incDir->c_str()))
|
||||||
{
|
{
|
||||||
std::string varName = incDir->substr(0, incDir->size()-9);
|
std::string varName = incDir->substr(0, incDir->size()-9);
|
||||||
cmCacheManager::CacheIterator it =
|
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
||||||
manager->GetCacheIterator(varName.c_str());
|
|
||||||
if(it.GetPropertyAsBool("ADVANCED"))
|
|
||||||
{
|
{
|
||||||
varName += " (ADVANCED)";
|
varName += " (ADVANCED)";
|
||||||
}
|
}
|
||||||
|
@ -1641,7 +1637,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
|
||||||
// and there is a good chance that the try compile stuff will
|
// and there is a good chance that the try compile stuff will
|
||||||
// take the bulk of the time, so try and guess some progress
|
// take the bulk of the time, so try and guess some progress
|
||||||
// by getting closer and closer to 100 without actually getting there.
|
// by getting closer and closer to 100 without actually getting there.
|
||||||
if (!this->CMakeInstance->GetCacheManager()->GetCacheValue
|
if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
|
||||||
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
|
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
|
||||||
{
|
{
|
||||||
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
|
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
|
||||||
|
@ -1839,7 +1835,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
|
||||||
// update progress
|
// update progress
|
||||||
// estimate how many lg there will be
|
// estimate how many lg there will be
|
||||||
const char *numGenC =
|
const char *numGenC =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheValue
|
this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
|
||||||
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
|
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
|
||||||
|
|
||||||
if (!numGenC)
|
if (!numGenC)
|
||||||
|
|
|
@ -3703,7 +3703,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
|
||||||
|
|
||||||
// Since this call may have created new cache entries, save the cache:
|
// Since this call may have created new cache entries, save the cache:
|
||||||
//
|
//
|
||||||
root->GetMakefile()->GetCacheManager()->SaveCache(
|
root->GetMakefile()->GetCMakeInstance()->SaveCache(
|
||||||
root->GetMakefile()->GetHomeOutputDirectory());
|
root->GetMakefile()->GetHomeOutputDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ bool cmLoadCacheCommand
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->Makefile->GetCacheManager()->LoadCache(args[i], false,
|
this->Makefile->GetCMakeInstance()->LoadCache(args[i], false,
|
||||||
excludes, includes);
|
excludes, includes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
|
||||||
std::string var;
|
std::string var;
|
||||||
std::string value;
|
std::string value;
|
||||||
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
||||||
if(cmCacheManager::ParseEntry(line, var, value, type))
|
if(cmake::ParseCacheEntry(line, var, value, type))
|
||||||
{
|
{
|
||||||
// Found a real entry. See if this one was requested.
|
// Found a real entry. See if this one was requested.
|
||||||
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
|
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
|
||||||
|
|
|
@ -174,16 +174,6 @@ void cmMakefile::Initialize()
|
||||||
this->CheckCMP0000 = false;
|
this->CheckCMP0000 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int cmMakefile::GetCacheMajorVersion() const
|
|
||||||
{
|
|
||||||
return this->GetCacheManager()->GetCacheMajorVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int cmMakefile::GetCacheMinorVersion() const
|
|
||||||
{
|
|
||||||
return this->GetCacheManager()->GetCacheMinorVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
cmMakefile::~cmMakefile()
|
cmMakefile::~cmMakefile()
|
||||||
{
|
{
|
||||||
cmDeleteAll(this->InstallGenerators);
|
cmDeleteAll(this->InstallGenerators);
|
||||||
|
@ -1820,16 +1810,17 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||||
{
|
{
|
||||||
bool haveVal = value ? true : false;
|
bool haveVal = value ? true : false;
|
||||||
std::string val = haveVal ? value : "";
|
std::string val = haveVal ? value : "";
|
||||||
cmCacheManager::CacheIterator it =
|
const char* existingValue =
|
||||||
this->GetCacheManager()->GetCacheIterator(name.c_str());
|
this->GetCacheManager()->GetInitializedCacheValue(name);
|
||||||
if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
|
if(existingValue
|
||||||
it.Initialized())
|
&& (this->GetCacheManager()->GetCacheEntryType(name)
|
||||||
|
== cmCacheManager::UNINITIALIZED))
|
||||||
{
|
{
|
||||||
// if this is not a force, then use the value from the cache
|
// if this is not a force, then use the value from the cache
|
||||||
// if it is a force, then use the value being passed in
|
// if it is a force, then use the value being passed in
|
||||||
if(!force)
|
if(!force)
|
||||||
{
|
{
|
||||||
val = it.GetValue();
|
val = existingValue;
|
||||||
haveVal = true;
|
haveVal = true;
|
||||||
}
|
}
|
||||||
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
|
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
|
||||||
|
@ -1852,13 +1843,13 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||||
}
|
}
|
||||||
|
|
||||||
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
|
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
|
||||||
val = it.GetValue();
|
val = this->GetCacheManager()->GetInitializedCacheValue(name);
|
||||||
haveVal = true;
|
haveVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc,
|
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
|
||||||
type);
|
doc, type);
|
||||||
// if there was a definition then remove it
|
// if there was a definition then remove it
|
||||||
this->Internal->VarStack.top().Set(name, 0);
|
this->Internal->VarStack.top().Set(name, 0);
|
||||||
}
|
}
|
||||||
|
@ -2442,7 +2433,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
|
||||||
this->Internal->VarUsageStack.top().insert(name);
|
this->Internal->VarUsageStack.top().insert(name);
|
||||||
if(!def)
|
if(!def)
|
||||||
{
|
{
|
||||||
def = this->GetCacheManager()->GetCacheValue(name);
|
def = this->GetCacheManager()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
if(cmVariableWatch* vv = this->GetVariableWatch())
|
if(cmVariableWatch* vv = this->GetVariableWatch())
|
||||||
|
@ -2467,7 +2458,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
|
||||||
const char* def = this->Internal->VarStack.top().Get(name);
|
const char* def = this->Internal->VarStack.top().Get(name);
|
||||||
if(!def)
|
if(!def)
|
||||||
{
|
{
|
||||||
def = this->GetCacheManager()->GetCacheValue(name);
|
def = this->GetCacheManager()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
cmVariableWatch* vv = this->GetVariableWatch();
|
cmVariableWatch* vv = this->GetVariableWatch();
|
||||||
|
@ -2501,20 +2492,18 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
|
||||||
std::vector<std::string> cmMakefile
|
std::vector<std::string> cmMakefile
|
||||||
::GetDefinitions(int cacheonly /* = 0 */) const
|
::GetDefinitions(int cacheonly /* = 0 */) const
|
||||||
{
|
{
|
||||||
std::set<std::string> definitions;
|
std::vector<std::string> res;
|
||||||
if ( !cacheonly )
|
if ( !cacheonly )
|
||||||
{
|
{
|
||||||
definitions = this->Internal->VarStack.top().ClosureKeys();
|
std::set<std::string> definitions =
|
||||||
}
|
this->Internal->VarStack.top().ClosureKeys();
|
||||||
cmCacheManager::CacheIterator cit =
|
res.insert(res.end(), definitions.begin(), definitions.end());
|
||||||
this->GetCacheManager()->GetCacheIterator();
|
|
||||||
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
|
|
||||||
{
|
|
||||||
definitions.insert(cit.GetName());
|
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> cacheKeys =
|
||||||
|
this->GetCacheManager()->GetCacheEntryKeys();
|
||||||
|
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
|
||||||
|
|
||||||
std::vector<std::string> res;
|
std::sort(res.begin(), res.end());
|
||||||
res.insert(res.end(), definitions.begin(), definitions.end());
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2845,7 +2834,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
|
||||||
value = cmSystemTools::GetEnv(lookup.c_str());
|
value = cmSystemTools::GetEnv(lookup.c_str());
|
||||||
break;
|
break;
|
||||||
case CACHE:
|
case CACHE:
|
||||||
value = this->GetCacheManager()->GetCacheValue(lookup);
|
value = this->GetCacheManager()
|
||||||
|
->GetInitializedCacheValue(lookup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Get the string we're meant to append to.
|
// Get the string we're meant to append to.
|
||||||
|
@ -4913,7 +4903,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
|
||||||
(status == cmPolicies::WARN || status == cmPolicies::OLD))
|
(status == cmPolicies::WARN || status == cmPolicies::OLD))
|
||||||
{
|
{
|
||||||
if(!(this->GetCacheManager()
|
if(!(this->GetCacheManager()
|
||||||
->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
|
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
|
||||||
{
|
{
|
||||||
// Set it to 2.4 because that is the last version where the
|
// Set it to 2.4 because that is the last version where the
|
||||||
// variable had meaning.
|
// variable had meaning.
|
||||||
|
|
|
@ -62,14 +62,6 @@ class cmMakefile
|
||||||
class Internals;
|
class Internals;
|
||||||
cmsys::auto_ptr<Internals> Internal;
|
cmsys::auto_ptr<Internals> Internal;
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Return the major and minor version of the cmake that
|
|
||||||
* was used to write the currently loaded cache, note
|
|
||||||
* this method will not work before the cache is loaded.
|
|
||||||
*/
|
|
||||||
unsigned int GetCacheMajorVersion() const;
|
|
||||||
unsigned int GetCacheMinorVersion() const;
|
|
||||||
|
|
||||||
/* Check for unused variables in this scope */
|
/* Check for unused variables in this scope */
|
||||||
void CheckForUnusedVariables() const;
|
void CheckForUnusedVariables() const;
|
||||||
/* Mark a variable as used */
|
/* Mark a variable as used */
|
||||||
|
|
|
@ -37,24 +37,19 @@ bool cmMarkAsAdvancedCommand
|
||||||
{
|
{
|
||||||
std::string variable = args[i];
|
std::string variable = args[i];
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
cmCacheManager::CacheIterator it =
|
if (!manager->GetCacheEntryValue(variable))
|
||||||
manager->GetCacheIterator(variable.c_str());
|
|
||||||
if ( it.IsAtEnd() )
|
|
||||||
{
|
{
|
||||||
this->Makefile->GetCacheManager()
|
manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
|
||||||
->AddCacheEntry(variable, 0, 0,
|
|
||||||
cmCacheManager::UNINITIALIZED);
|
|
||||||
overwrite = true;
|
overwrite = true;
|
||||||
}
|
}
|
||||||
it.Find(variable);
|
if (!manager->GetCacheEntryValue(variable))
|
||||||
if ( it.IsAtEnd() )
|
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("This should never happen...");
|
cmSystemTools::Error("This should never happen...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( !it.PropertyExists("ADVANCED") || overwrite )
|
if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
|
||||||
{
|
{
|
||||||
it.SetProperty("ADVANCED", value);
|
manager->SetCacheEntryProperty(variable, "ADVANCED", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,16 +42,16 @@ bool cmOptionCommand
|
||||||
std::string initialValue = "Off";
|
std::string initialValue = "Off";
|
||||||
// Now check and see if the value has been stored in the cache
|
// Now check and see if the value has been stored in the cache
|
||||||
// already, if so use that value and don't look for the program
|
// already, if so use that value and don't look for the program
|
||||||
cmCacheManager::CacheIterator it =
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str());
|
const char* existingValue = manager->GetCacheEntryValue(args[0]);
|
||||||
if(!it.IsAtEnd())
|
if(existingValue)
|
||||||
{
|
{
|
||||||
if ( it.GetType() != cmCacheManager::UNINITIALIZED )
|
if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
it.SetProperty("HELPSTRING", args[1].c_str());
|
manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
initialValue = it.GetValue();
|
initialValue = existingValue;
|
||||||
}
|
}
|
||||||
if(args.size() == 3)
|
if(args.size() == 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,9 +136,10 @@ bool cmSetCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if this is already in the cache
|
// see if this is already in the cache
|
||||||
cmCacheManager::CacheIterator it =
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
this->Makefile->GetCacheManager()->GetCacheIterator(variable);
|
const char* existingValue = manager->GetCacheEntryValue(variable);
|
||||||
if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED))
|
if(existingValue &&
|
||||||
|
(manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
|
||||||
{
|
{
|
||||||
// if the set is trying to CACHE the value but the value
|
// if the set is trying to CACHE the value but the value
|
||||||
// is already in the cache and the type is not internal
|
// is already in the cache and the type is not internal
|
||||||
|
|
|
@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode()
|
||||||
// Get the source file.
|
// Get the source file.
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
cmake* cm = mf->GetCMakeInstance();
|
cmake* cm = mf->GetCMakeInstance();
|
||||||
cmCacheManager::CacheIterator it =
|
const char* existingValue
|
||||||
cm->GetCacheManager()->GetCacheIterator(ni->c_str());
|
= cm->GetCacheManager()->GetCacheEntryValue(*ni);
|
||||||
if(!it.IsAtEnd())
|
if(existingValue)
|
||||||
{
|
{
|
||||||
if(!this->HandleCacheEntry(it))
|
if(!this->HandleCacheEntry(*ni))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -474,22 +474,25 @@ bool cmSetPropertyCommand::HandleCacheMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
|
bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
|
||||||
{
|
{
|
||||||
// Set or append the property.
|
// Set or append the property.
|
||||||
const char* name = this->PropertyName.c_str();
|
const char* name = this->PropertyName.c_str();
|
||||||
const char* value = this->PropertyValue.c_str();
|
const char* value = this->PropertyValue.c_str();
|
||||||
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
if (this->Remove)
|
if (this->Remove)
|
||||||
{
|
{
|
||||||
value = 0;
|
manager->RemoveCacheEntryProperty(cacheKey, name);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if(this->AppendMode)
|
if(this->AppendMode)
|
||||||
{
|
{
|
||||||
it.AppendProperty(name, value, this->AppendAsString);
|
manager->AppendCacheEntryProperty(cacheKey, name, value,
|
||||||
|
this->AppendAsString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it.SetProperty(name, value);
|
manager->SetCacheEntryProperty(cacheKey, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -61,7 +61,7 @@ private:
|
||||||
bool HandleTestMode();
|
bool HandleTestMode();
|
||||||
bool HandleTest(cmTest* test);
|
bool HandleTest(cmTest* test);
|
||||||
bool HandleCacheMode();
|
bool HandleCacheMode();
|
||||||
bool HandleCacheEntry(cmCacheManager::CacheIterator&);
|
bool HandleCacheEntry(std::string const&);
|
||||||
bool HandleInstallMode();
|
bool HandleInstallMode();
|
||||||
bool HandleInstall(cmInstalledFile* file);
|
bool HandleInstall(cmInstalledFile* file);
|
||||||
};
|
};
|
||||||
|
|
|
@ -264,11 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
comment.c_str(),
|
comment.c_str(),
|
||||||
cmCacheManager::STRING);
|
cmCacheManager::STRING);
|
||||||
|
|
||||||
cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
GetCacheIterator(this->RunResultVariable.c_str());
|
const char* existingValue
|
||||||
if ( !it.IsAtEnd() )
|
= manager->GetCacheEntryValue(this->RunResultVariable);
|
||||||
|
if (existingValue)
|
||||||
{
|
{
|
||||||
it.SetProperty("ADVANCED", "1");
|
manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -290,11 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
"PLEASE_FILL_OUT-NOTFOUND",
|
"PLEASE_FILL_OUT-NOTFOUND",
|
||||||
comment.c_str(),
|
comment.c_str(),
|
||||||
cmCacheManager::STRING);
|
cmCacheManager::STRING);
|
||||||
cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
GetCacheIterator(internalRunOutputName.c_str());
|
const char* existing =
|
||||||
if ( !it.IsAtEnd() )
|
manager->GetCacheEntryValue(internalRunOutputName);
|
||||||
|
if (existing)
|
||||||
{
|
{
|
||||||
it.SetProperty("ADVANCED", "1");
|
manager->SetCacheEntryProperty(internalRunOutputName,
|
||||||
|
"ADVANCED", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
error = true;
|
error = true;
|
||||||
|
|
|
@ -52,11 +52,13 @@ bool cmUtilitySourceCommand
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
cmCacheManager *manager =
|
||||||
|
this->Makefile->GetCMakeInstance()->GetCacheManager();
|
||||||
haveCacheValue = (cacheValue &&
|
haveCacheValue = (cacheValue &&
|
||||||
(strstr(cacheValue, "(IntDir)") == 0 ||
|
(strstr(cacheValue, "(IntDir)") == 0 ||
|
||||||
(intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
|
(intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
|
||||||
(this->Makefile->GetCacheMajorVersion() != 0 &&
|
(manager->GetCacheMajorVersion() != 0 &&
|
||||||
this->Makefile->GetCacheMinorVersion() != 0 ));
|
manager->GetCacheMinorVersion() != 0 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(haveCacheValue)
|
if(haveCacheValue)
|
||||||
|
|
|
@ -41,9 +41,9 @@ bool cmVariableRequiresCommand
|
||||||
requirementsMet = false;
|
requirementsMet = false;
|
||||||
notSet += args[i];
|
notSet += args[i];
|
||||||
notSet += "\n";
|
notSet += "\n";
|
||||||
cmCacheManager::CacheIterator it =
|
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
||||||
this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str());
|
if(manager->GetCacheEntryValue(args[i]) &&
|
||||||
if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED"))
|
manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
|
||||||
{
|
{
|
||||||
hasAdvanced = true;
|
hasAdvanced = true;
|
||||||
}
|
}
|
||||||
|
|
166
Source/cmake.cxx
166
Source/cmake.cxx
|
@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
std::string cachedValue;
|
std::string cachedValue;
|
||||||
if(this->WarnUnusedCli)
|
if(this->WarnUnusedCli)
|
||||||
{
|
{
|
||||||
if(const char *v = this->CacheManager->GetCacheValue(var))
|
if(const char *v = this->CacheManager
|
||||||
|
->GetInitializedCacheValue(var))
|
||||||
{
|
{
|
||||||
haveValue = true;
|
haveValue = true;
|
||||||
cachedValue = v;
|
cachedValue = v;
|
||||||
|
@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
if(this->WarnUnusedCli)
|
if(this->WarnUnusedCli)
|
||||||
{
|
{
|
||||||
if (!haveValue ||
|
if (!haveValue ||
|
||||||
cachedValue != this->CacheManager->GetCacheValue(var))
|
cachedValue != this->CacheManager
|
||||||
|
->GetInitializedCacheValue(var))
|
||||||
{
|
{
|
||||||
this->WatchUnusedCli(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());
|
cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
|
||||||
//go through all cache entries and collect the vars which will be removed
|
//go through all cache entries and collect the vars which will be removed
|
||||||
std::vector<std::string> entriesToDelete;
|
std::vector<std::string> entriesToDelete;
|
||||||
cmCacheManager::CacheIterator it =
|
std::vector<std::string> cacheKeys =
|
||||||
this->CacheManager->GetCacheIterator();
|
this->CacheManager->GetCacheEntryKeys();
|
||||||
for ( it.Begin(); !it.IsAtEnd(); it.Next() )
|
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)
|
if(t != cmCacheManager::STATIC)
|
||||||
{
|
{
|
||||||
std::string entryName = it.GetName();
|
if (regex.find(it->c_str()))
|
||||||
if (regex.find(entryName.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 there is a CMakeCache.txt file, use its settings.
|
||||||
if(!cachePath.empty())
|
if(!cachePath.empty())
|
||||||
{
|
{
|
||||||
cmCacheManager* cachem = this->GetCacheManager();
|
if(this->LoadCache(cachePath))
|
||||||
cmCacheManager::CacheIterator it = cachem->NewIterator();
|
|
||||||
if(cachem->LoadCache(cachePath) &&
|
|
||||||
it.Find("CMAKE_HOME_DIRECTORY"))
|
|
||||||
{
|
{
|
||||||
this->SetHomeOutputDirectory(cachePath);
|
const char* existingValue =
|
||||||
this->SetStartOutputDirectory(cachePath);
|
this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||||
this->SetHomeDirectory(it.GetValue());
|
if (existingValue)
|
||||||
this->SetStartDirectory(it.GetValue());
|
{
|
||||||
return;
|
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
|
// do a sanity check on some values
|
||||||
if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
|
if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"))
|
||||||
{
|
{
|
||||||
std::string cacheStart =
|
std::string cacheStart =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
|
this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
|
||||||
cacheStart += "/CMakeLists.txt";
|
cacheStart += "/CMakeLists.txt";
|
||||||
std::string currentStart = this->GetHomeDirectory();
|
std::string currentStart = this->GetHomeDirectory();
|
||||||
currentStart += "/CMakeLists.txt";
|
currentStart += "/CMakeLists.txt";
|
||||||
|
@ -1355,9 +1360,9 @@ int cmake::ActualConfigure()
|
||||||
if(!this->GlobalGenerator)
|
if(!this->GlobalGenerator)
|
||||||
{
|
{
|
||||||
const char* genName =
|
const char* genName =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
|
this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR");
|
||||||
const char* extraGenName =
|
const char* extraGenName =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
|
this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||||
if(genName)
|
if(genName)
|
||||||
{
|
{
|
||||||
std::string fullName = cmExternalMakefileProjectGenerator::
|
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(genName)
|
||||||
{
|
{
|
||||||
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
|
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
|
||||||
|
@ -1451,7 +1457,7 @@ int cmake::ActualConfigure()
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
|
if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
|
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
|
||||||
this->GlobalGenerator->GetName().c_str(),
|
this->GlobalGenerator->GetName().c_str(),
|
||||||
|
@ -1464,7 +1470,7 @@ int cmake::ActualConfigure()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* platformName =
|
if(const char* platformName =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM"))
|
this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM"))
|
||||||
{
|
{
|
||||||
if(this->GeneratorPlatform.empty())
|
if(this->GeneratorPlatform.empty())
|
||||||
{
|
{
|
||||||
|
@ -1492,7 +1498,7 @@ int cmake::ActualConfigure()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* tsName =
|
if(const char* tsName =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
|
this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET"))
|
||||||
{
|
{
|
||||||
if(this->GeneratorToolset.empty())
|
if(this->GeneratorToolset.empty())
|
||||||
{
|
{
|
||||||
|
@ -1546,16 +1552,18 @@ int cmake::ActualConfigure()
|
||||||
// project requires compatibility with CMake 2.4. We detect this
|
// project requires compatibility with CMake 2.4. We detect this
|
||||||
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
|
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
|
||||||
// variable created when CMP0001 is not set to NEW.
|
// 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
|
this->CacheManager->AddCacheEntry
|
||||||
("LIBRARY_OUTPUT_PATH", "",
|
("LIBRARY_OUTPUT_PATH", "",
|
||||||
"Single output directory for building all libraries.",
|
"Single output directory for building all libraries.",
|
||||||
cmCacheManager::PATH);
|
cmCacheManager::PATH);
|
||||||
}
|
}
|
||||||
if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
if(!this->CacheManager
|
||||||
|
->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("EXECUTABLE_OUTPUT_PATH", "",
|
("EXECUTABLE_OUTPUT_PATH", "",
|
||||||
|
@ -1563,24 +1571,25 @@ int cmake::ActualConfigure()
|
||||||
cmCacheManager::PATH);
|
cmCacheManager::PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
if(!this->CacheManager
|
||||||
|
->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("CMAKE_USE_RELATIVE_PATHS", "OFF",
|
("CMAKE_USE_RELATIVE_PATHS", "OFF",
|
||||||
"If true, cmake will use relative paths in makefiles and projects.",
|
"If true, cmake will use relative paths in makefiles and projects.",
|
||||||
cmCacheManager::BOOL);
|
cmCacheManager::BOOL);
|
||||||
cmCacheManager::CacheIterator it =
|
if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
||||||
this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS");
|
"ADVANCED"))
|
||||||
if ( !it.PropertyExists("ADVANCED") )
|
|
||||||
{
|
{
|
||||||
it.SetProperty("ADVANCED", "1");
|
this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
||||||
|
"ADVANCED", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmSystemTools::GetFatalErrorOccured() &&
|
if(cmSystemTools::GetFatalErrorOccured() &&
|
||||||
(!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
|
(!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") ||
|
||||||
cmSystemTools::IsOff(this->CacheManager->
|
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
|
// We must have a bad generator selection. Wipe the cache entry so the
|
||||||
// user can select another.
|
// 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
|
const char* cmake::GetCacheDefinition(const std::string& name) const
|
||||||
{
|
{
|
||||||
return this->CacheManager->GetCacheValue(name);
|
return this->CacheManager->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::AddDefaultCommands()
|
void cmake::AddDefaultCommands()
|
||||||
|
@ -1860,10 +1869,18 @@ void cmake::AddDefaultGenerators()
|
||||||
#endif
|
#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()
|
int cmake::LoadCache()
|
||||||
{
|
{
|
||||||
// could we not read the cache
|
// 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
|
// if it does exist, but isn't readable then warn the user
|
||||||
std::string cacheFile = this->GetHomeOutputDirectory();
|
std::string cacheFile = this->GetHomeOutputDirectory();
|
||||||
|
@ -1886,6 +1903,28 @@ int cmake::LoadCache()
|
||||||
return 0;
|
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)
|
void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
|
||||||
{
|
{
|
||||||
this->ProgressCallback = f;
|
this->ProgressCallback = f;
|
||||||
|
@ -1926,7 +1965,8 @@ void cmake::UpdateConversionPathTable()
|
||||||
{
|
{
|
||||||
// Update the path conversion table with any specified file:
|
// Update the path conversion table with any specified file:
|
||||||
const char* tablepath =
|
const char* tablepath =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
this->CacheManager
|
||||||
|
->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
||||||
|
|
||||||
if(tablepath)
|
if(tablepath)
|
||||||
{
|
{
|
||||||
|
@ -2160,7 +2200,7 @@ void cmake::TruncateOutputLog(const char* fname)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
|
if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") )
|
||||||
{
|
{
|
||||||
cmSystemTools::RemoveFile(fullPath);
|
cmSystemTools::RemoveFile(fullPath);
|
||||||
return;
|
return;
|
||||||
|
@ -2277,17 +2317,9 @@ const char *cmake::GetProperty(const std::string& prop,
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
if ( prop == "CACHE_VARIABLES" )
|
if ( prop == "CACHE_VARIABLES" )
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator cit =
|
std::vector<std::string> cacheKeys =
|
||||||
this->GetCacheManager()->GetCacheIterator();
|
this->CacheManager->GetCacheEntryKeys();
|
||||||
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
|
this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
|
||||||
{
|
|
||||||
if (!output.empty())
|
|
||||||
{
|
|
||||||
output += ";";
|
|
||||||
}
|
|
||||||
output += cit.GetName();
|
|
||||||
}
|
|
||||||
this->SetProperty("CACHE_VARIABLES", output.c_str());
|
|
||||||
}
|
}
|
||||||
else if ( prop == "COMMANDS" )
|
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
|
// we have to find the module directory, so we can copy the files
|
||||||
this->AddCMakePaths();
|
this->AddCMakePaths();
|
||||||
std::string modulesPath =
|
std::string modulesPath =
|
||||||
this->CacheManager->GetCacheValue("CMAKE_ROOT");
|
this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT");
|
||||||
modulesPath += "/Modules";
|
modulesPath += "/Modules";
|
||||||
std::string inFile = modulesPath;
|
std::string inFile = modulesPath;
|
||||||
inFile += "/SystemInformation.cmake";
|
inFile += "/SystemInformation.cmake";
|
||||||
|
@ -2649,9 +2681,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
|
||||||
if(t == cmake::AUTHOR_WARNING)
|
if(t == cmake::AUTHOR_WARNING)
|
||||||
{
|
{
|
||||||
// Allow suppression of these warnings.
|
// Allow suppression of these warnings.
|
||||||
cmCacheManager::CacheIterator it = this->CacheManager
|
const char* suppress = this->CacheManager->GetCacheEntryValue(
|
||||||
->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
||||||
if(!it.IsAtEnd() && it.GetValueAsBool())
|
if(suppress && cmSystemTools::IsOn(suppress))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2764,38 +2796,42 @@ int cmake::Build(const std::string& dir,
|
||||||
}
|
}
|
||||||
std::string cachePath = dir;
|
std::string cachePath = dir;
|
||||||
cmSystemTools::ConvertToUnixSlashes(cachePath);
|
cmSystemTools::ConvertToUnixSlashes(cachePath);
|
||||||
cmCacheManager* cachem = this->GetCacheManager();
|
if(!this->LoadCache(cachePath))
|
||||||
cmCacheManager::CacheIterator it = cachem->NewIterator();
|
|
||||||
if(!cachem->LoadCache(cachePath))
|
|
||||||
{
|
{
|
||||||
std::cerr << "Error: could not load cache\n";
|
std::cerr << "Error: could not load cache\n";
|
||||||
return 1;
|
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";
|
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
cmsys::auto_ptr<cmGlobalGenerator> gen(
|
cmsys::auto_ptr<cmGlobalGenerator> gen(
|
||||||
this->CreateGlobalGenerator(it.GetValue()));
|
this->CreateGlobalGenerator(cachedGenerator));
|
||||||
if(!gen.get())
|
if(!gen.get())
|
||||||
{
|
{
|
||||||
std::cerr << "Error: could create CMAKE_GENERATOR \""
|
std::cerr << "Error: could create CMAKE_GENERATOR \""
|
||||||
<< it.GetValue() << "\"\n";
|
<< cachedGenerator << "\"\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string output;
|
std::string output;
|
||||||
std::string projName;
|
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";
|
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
projName = it.GetValue();
|
projName = cachedProjectName;
|
||||||
bool verbose = false;
|
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,
|
return gen->Build("", dir,
|
||||||
projName, target,
|
projName, target,
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
#include "cmPropertyDefinitionMap.h"
|
#include "cmPropertyDefinitionMap.h"
|
||||||
#include "cmPropertyMap.h"
|
#include "cmPropertyMap.h"
|
||||||
#include "cmInstalledFile.h"
|
#include "cmInstalledFile.h"
|
||||||
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
class cmGlobalGeneratorFactory;
|
class cmGlobalGeneratorFactory;
|
||||||
class cmGlobalGenerator;
|
class cmGlobalGenerator;
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmCacheManager;
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmCommand;
|
class cmCommand;
|
||||||
class cmVariableWatch;
|
class cmVariableWatch;
|
||||||
|
@ -173,7 +173,19 @@ class cmake
|
||||||
int Configure();
|
int Configure();
|
||||||
int ActualConfigure();
|
int ActualConfigure();
|
||||||
|
|
||||||
|
///! Break up a line like VAR:type="value" into var, type and value
|
||||||
|
static bool ParseCacheEntry(const std::string& entry,
|
||||||
|
std::string& var,
|
||||||
|
std::string& value,
|
||||||
|
cmCacheManager::CacheEntryType& type);
|
||||||
|
|
||||||
int LoadCache();
|
int LoadCache();
|
||||||
|
bool LoadCache(const std::string& path);
|
||||||
|
bool LoadCache(const std::string& path, bool internal,
|
||||||
|
std::set<std::string>& excludes,
|
||||||
|
std::set<std::string>& includes);
|
||||||
|
bool SaveCache(const std::string& path);
|
||||||
|
bool DeleteCache(const std::string& path);
|
||||||
void PreLoadCMakeFiles();
|
void PreLoadCMakeFiles();
|
||||||
|
|
||||||
///! Create a GlobalGenerator
|
///! Create a GlobalGenerator
|
||||||
|
|
|
@ -328,25 +328,31 @@ int do_cmake(int ac, char const* const* av)
|
||||||
int res = cm.Run(args, view_only);
|
int res = cm.Run(args, view_only);
|
||||||
if ( list_cached || list_all_cached )
|
if ( list_cached || list_all_cached )
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheIterator it =
|
|
||||||
cm.GetCacheManager()->GetCacheIterator();
|
|
||||||
std::cout << "-- Cache values" << std::endl;
|
std::cout << "-- Cache values" << std::endl;
|
||||||
for ( it.Begin(); !it.IsAtEnd(); it.Next() )
|
std::vector<std::string> keys =
|
||||||
|
cm.GetCacheManager()->GetCacheEntryKeys();
|
||||||
|
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||||
|
it != keys.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t = it.GetType();
|
cmCacheManager::CacheEntryType t =
|
||||||
|
cm.GetCacheManager()->GetCacheEntryType(*it);
|
||||||
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
|
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
|
||||||
t != cmCacheManager::UNINITIALIZED )
|
t != cmCacheManager::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
bool advanced = it.PropertyExists("ADVANCED");
|
const char* advancedProp =
|
||||||
if ( list_all_cached || !advanced)
|
cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED");
|
||||||
|
if ( list_all_cached || !advancedProp)
|
||||||
{
|
{
|
||||||
if ( list_help )
|
if ( list_help )
|
||||||
{
|
{
|
||||||
std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl;
|
std::cout << "// "
|
||||||
|
<< cm.GetCacheManager()->GetCacheEntryProperty(*it,
|
||||||
|
"HELPSTRING") << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << it.GetName() << ":" <<
|
std::cout << *it << ":" <<
|
||||||
cmCacheManager::TypeToString(it.GetType())
|
cmCacheManager::TypeToString(t)
|
||||||
<< "=" << it.GetValue() << std::endl;
|
<< "=" << cm.GetCacheManager()->GetCacheEntryValue(*it)
|
||||||
|
<< std::endl;
|
||||||
if ( list_help )
|
if ( list_help )
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue