Merge topic 'introduce-cmState'
f081c5bd
cmState: Move CacheEntryType enum from cmCacheManager.f71fdf0e
cmMakefile: Remove unused CacheManager accessor.ff7169a0
Port to cmState.a6b1ad13
Introduce cmState class.
This commit is contained in:
commit
62c5e6f1a1
|
@ -329,6 +329,8 @@ set(SRCS
|
||||||
cmSourceFileLocation.h
|
cmSourceFileLocation.h
|
||||||
cmSourceGroup.cxx
|
cmSourceGroup.cxx
|
||||||
cmSourceGroup.h
|
cmSourceGroup.h
|
||||||
|
cmState.cxx
|
||||||
|
cmState.h
|
||||||
cmSystemTools.cxx
|
cmSystemTools.cxx
|
||||||
cmSystemTools.h
|
cmSystemTools.h
|
||||||
cmTarget.cxx
|
cmTarget.cxx
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "../cmCacheManager.h"
|
|
||||||
#include "../cmSystemTools.h"
|
#include "../cmSystemTools.h"
|
||||||
#include "../cmake.h"
|
#include "../cmake.h"
|
||||||
#include "../cmDocumentation.h"
|
#include "../cmDocumentation.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height,
|
||||||
int left, int top) :
|
int left, int top) :
|
||||||
cmCursesWidget(width, height, left, top)
|
cmCursesWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::BOOL;
|
this->Type = cmState::BOOL;
|
||||||
set_field_fore(this->Field, A_NORMAL);
|
set_field_fore(this->Field, A_NORMAL);
|
||||||
set_field_back(this->Field, A_STANDOUT);
|
set_field_back(this->Field, A_STANDOUT);
|
||||||
field_opts_off(this->Field, O_STATIC);
|
field_opts_off(this->Field, O_STATIC);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "cmCursesDummyWidget.h"
|
#include "cmCursesDummyWidget.h"
|
||||||
#include "../cmSystemTools.h"
|
#include "../cmSystemTools.h"
|
||||||
#include "../cmake.h"
|
#include "../cmake.h"
|
||||||
|
#include "../cmState.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -50,11 +51,11 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Entry = 0;
|
this->Entry = 0;
|
||||||
const char* value = cm->GetCacheManager()->GetCacheEntryValue(key);
|
const char* value = cm->GetState()->GetCacheEntryValue(key);
|
||||||
assert(value);
|
assert(value);
|
||||||
switch (cm->GetCacheManager()->GetCacheEntryType(key))
|
switch (cm->GetState()->GetCacheEntryType(key))
|
||||||
{
|
{
|
||||||
case cmCacheManager::BOOL:
|
case cmState::BOOL:
|
||||||
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
|
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
|
||||||
if (cmSystemTools::IsOn(value))
|
if (cmSystemTools::IsOn(value))
|
||||||
{
|
{
|
||||||
|
@ -65,17 +66,17 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
|
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::PATH:
|
case cmState::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(value);
|
static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::FILEPATH:
|
case cmState::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(value);
|
static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::STRING:
|
case cmState::STRING:
|
||||||
{
|
{
|
||||||
const char* stringsProp = cm->GetCacheManager()
|
const char* stringsProp = cm->GetState()
|
||||||
->GetCacheEntryProperty(key, "STRINGS");
|
->GetCacheEntryProperty(key, "STRINGS");
|
||||||
if(stringsProp)
|
if(stringsProp)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +99,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmCacheManager::UNINITIALIZED:
|
case cmState::UNINITIALIZED:
|
||||||
cmSystemTools::Error("Found an undefined variable: ",
|
cmSystemTools::Error("Found an undefined variable: ",
|
||||||
key.c_str());
|
key.c_str());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#ifndef cmCursesCacheEntryComposite_h
|
#ifndef cmCursesCacheEntryComposite_h
|
||||||
#define cmCursesCacheEntryComposite_h
|
#define cmCursesCacheEntryComposite_h
|
||||||
|
|
||||||
#include "../cmCacheManager.h"
|
|
||||||
#include "cmCursesLabelWidget.h"
|
#include "cmCursesLabelWidget.h"
|
||||||
|
|
||||||
class cmCursesCacheEntryComposite
|
class cmCursesCacheEntryComposite
|
||||||
|
|
|
@ -15,7 +15,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height,
|
||||||
int left, int top) :
|
int left, int top) :
|
||||||
cmCursesWidget(width, height, left, top)
|
cmCursesWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::INTERNAL;
|
this->Type = cmState::INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height,
|
||||||
int left, int top) :
|
int left, int top) :
|
||||||
cmCursesPathWidget(width, height, left, top)
|
cmCursesPathWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::FILEPATH;
|
this->Type = cmState::FILEPATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "../cmCacheManager.h"
|
|
||||||
#include "../cmSystemTools.h"
|
#include "../cmSystemTools.h"
|
||||||
#include "../cmake.h"
|
#include "../cmake.h"
|
||||||
#include "../cmVersion.h"
|
#include "../cmVersion.h"
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "../cmCacheManager.h"
|
|
||||||
#include "../cmSystemTools.h"
|
#include "../cmSystemTools.h"
|
||||||
#include "../cmVersion.h"
|
#include "../cmVersion.h"
|
||||||
#include "../cmake.h"
|
#include "../cmake.h"
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
#include "cmCursesCacheEntryComposite.h"
|
#include "cmCursesCacheEntryComposite.h"
|
||||||
#include "cmCursesLongMessageForm.h"
|
#include "cmCursesLongMessageForm.h"
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
|
|
||||||
inline int ctrl(int z)
|
inline int ctrl(int z)
|
||||||
|
@ -107,21 +107,21 @@ void cmCursesMainForm::InitializeUI()
|
||||||
// which contain labels, entries and new entry markers
|
// which contain labels, entries and new entry markers
|
||||||
std::vector<cmCursesCacheEntryComposite*>* newEntries =
|
std::vector<cmCursesCacheEntryComposite*>* newEntries =
|
||||||
new std::vector<cmCursesCacheEntryComposite*>;
|
new std::vector<cmCursesCacheEntryComposite*>;
|
||||||
newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize());
|
std::vector<std::string> cacheKeys =
|
||||||
|
this->CMakeInstance->GetState()->GetCacheEntryKeys();
|
||||||
|
newEntries->reserve(cacheKeys.size());
|
||||||
|
|
||||||
// Count non-internal and non-static entries
|
// Count non-internal and non-static entries
|
||||||
int count=0;
|
int count=0;
|
||||||
std::vector<std::string> cacheKeys =
|
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys();
|
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
it != cacheKeys.end(); ++it)
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
cmState::CacheEntryType t = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryType(*it);
|
->GetCacheEntryType(*it);
|
||||||
if (t != cmCacheManager::INTERNAL &&
|
if (t != cmState::INTERNAL &&
|
||||||
t != cmCacheManager::STATIC &&
|
t != cmState::STATIC &&
|
||||||
t != cmCacheManager::UNINITIALIZED)
|
t != cmState::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ void cmCursesMainForm::InitializeUI()
|
||||||
it != cacheKeys.end(); ++it)
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string key = *it;
|
std::string key = *it;
|
||||||
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
cmState::CacheEntryType t = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryType(*it);
|
->GetCacheEntryType(*it);
|
||||||
if (t == cmCacheManager::INTERNAL ||
|
if (t == cmState::INTERNAL ||
|
||||||
t == cmCacheManager::STATIC ||
|
t == cmState::STATIC ||
|
||||||
t == cmCacheManager::UNINITIALIZED )
|
t == cmState::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -171,11 +171,11 @@ void cmCursesMainForm::InitializeUI()
|
||||||
it != cacheKeys.end(); ++it)
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string key = *it;
|
std::string key = *it;
|
||||||
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
|
cmState::CacheEntryType t = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryType(*it);
|
->GetCacheEntryType(*it);
|
||||||
if (t == cmCacheManager::INTERNAL ||
|
if (t == cmState::INTERNAL ||
|
||||||
t == cmCacheManager::STATIC ||
|
t == cmState::STATIC ||
|
||||||
t == cmCacheManager::UNINITIALIZED )
|
t == cmState::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -225,10 +225,10 @@ void cmCursesMainForm::RePost()
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue((*it)->GetValue());
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
bool advanced =
|
bool advanced =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
if (!existingValue || (!this->AdvancedMode && advanced))
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
|
@ -257,10 +257,10 @@ void cmCursesMainForm::RePost()
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue((*it)->GetValue());
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
bool advanced =
|
bool advanced =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
if (!existingValue || (!this->AdvancedMode && advanced))
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
|
@ -293,9 +293,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||||
cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*>
|
cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*>
|
||||||
(field_userptr(currentField));
|
(field_userptr(currentField));
|
||||||
// If in edit mode, get out of it
|
// If in edit mode, get out of it
|
||||||
if ( cw->GetType() == cmCacheManager::STRING ||
|
if ( cw->GetType() == cmState::STRING ||
|
||||||
cw->GetType() == cmCacheManager::PATH ||
|
cw->GetType() == cmState::PATH ||
|
||||||
cw->GetType() == cmCacheManager::FILEPATH )
|
cw->GetType() == cmState::FILEPATH )
|
||||||
{
|
{
|
||||||
cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
|
cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
|
||||||
sw->SetInEdit(false);
|
sw->SetInEdit(false);
|
||||||
|
@ -329,10 +329,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue((*it)->GetValue());
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
bool advanced =
|
bool advanced =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
if (!existingValue || (!this->AdvancedMode && advanced))
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
|
@ -352,10 +352,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||||
{
|
{
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue((*it)->GetValue());
|
->GetCacheEntryValue((*it)->GetValue());
|
||||||
bool advanced =
|
bool advanced =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
|
||||||
if (!existingValue || (!this->AdvancedMode && advanced))
|
if (!existingValue || (!this->AdvancedMode && advanced))
|
||||||
{
|
{
|
||||||
|
@ -516,10 +516,10 @@ 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
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField);
|
this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
|
||||||
if (existingValue)
|
if (existingValue)
|
||||||
{
|
{
|
||||||
const char* hs = this->CMakeInstance->GetCacheManager()
|
const char* hs = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryProperty(curField, "HELPSTRING");
|
->GetCacheEntryProperty(curField, "HELPSTRING");
|
||||||
if ( hs )
|
if ( hs )
|
||||||
{
|
{
|
||||||
|
@ -814,7 +814,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||||
for(size_t i=0; i < size; i++)
|
for(size_t i=0; i < size; i++)
|
||||||
{
|
{
|
||||||
std::string cacheKey = (*this->Entries)[i]->Key;
|
std::string cacheKey = (*this->Entries)[i]->Key;
|
||||||
const char* existingValue = this->CMakeInstance->GetCacheManager()
|
const char* existingValue = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue(cacheKey);
|
->GetCacheEntryValue(cacheKey);
|
||||||
if (existingValue)
|
if (existingValue)
|
||||||
{
|
{
|
||||||
|
@ -822,8 +822,8 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||||
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;
|
||||||
cmCacheManager::CacheEntryType t =
|
cmState::CacheEntryType t =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryType(cacheKey);
|
->GetCacheEntryType(cacheKey);
|
||||||
this->FixValue(t, oldValue, fixedOldValue);
|
this->FixValue(t, oldValue, fixedOldValue);
|
||||||
this->FixValue(t, newValue, fixedNewValue);
|
this->FixValue(t, newValue, fixedNewValue);
|
||||||
|
@ -831,24 +831,24 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||||
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.
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
|
->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->SetCacheEntryValue(cacheKey, fixedNewValue);
|
->SetCacheEntryValue(cacheKey, fixedNewValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCursesMainForm::FixValue(cmCacheManager::CacheEntryType type,
|
void cmCursesMainForm::FixValue(cmState::CacheEntryType type,
|
||||||
const std::string& in, std::string& out) const
|
const std::string& in, std::string& out) const
|
||||||
{
|
{
|
||||||
out = in.substr(0,in.find_last_not_of(" ")+1);
|
out = in.substr(0,in.find_last_not_of(" ")+1);
|
||||||
if(type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH)
|
if(type == cmState::PATH || type == cmState::FILEPATH)
|
||||||
{
|
{
|
||||||
cmSystemTools::ConvertToUnixSlashes(out);
|
cmSystemTools::ConvertToUnixSlashes(out);
|
||||||
}
|
}
|
||||||
if(type == cmCacheManager::BOOL)
|
if(type == cmState::BOOL)
|
||||||
{
|
{
|
||||||
if(cmSystemTools::IsOff(out.c_str()))
|
if(cmSystemTools::IsOff(out.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -1046,11 +1046,11 @@ void cmCursesMainForm::HandleInput()
|
||||||
const char* helpString = 0;
|
const char* helpString = 0;
|
||||||
|
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CMakeInstance->GetCacheManager()
|
this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryValue(curField);
|
->GetCacheEntryValue(curField);
|
||||||
if (existingValue)
|
if (existingValue)
|
||||||
{
|
{
|
||||||
helpString = this->CMakeInstance->GetCacheManager()
|
helpString = this->CMakeInstance->GetState()
|
||||||
->GetCacheEntryProperty(curField, "HELPSTRING");
|
->GetCacheEntryProperty(curField, "HELPSTRING");
|
||||||
}
|
}
|
||||||
if (helpString)
|
if (helpString)
|
||||||
|
@ -1161,7 +1161,7 @@ void cmCursesMainForm::HandleInput()
|
||||||
field_userptr(this->Fields[findex-2]));
|
field_userptr(this->Fields[findex-2]));
|
||||||
if ( lbl )
|
if ( lbl )
|
||||||
{
|
{
|
||||||
this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
|
this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue());
|
||||||
|
|
||||||
std::string nextVal;
|
std::string nextVal;
|
||||||
if (nextCur)
|
if (nextCur)
|
||||||
|
|
|
@ -113,7 +113,7 @@ protected:
|
||||||
// cache.
|
// cache.
|
||||||
void FillCacheManagerFromUI();
|
void FillCacheManagerFromUI();
|
||||||
// Fix formatting of values to a consistent form.
|
// Fix formatting of values to a consistent form.
|
||||||
void FixValue(cmCacheManager::CacheEntryType type,
|
void FixValue(cmState::CacheEntryType type,
|
||||||
const std::string& in, std::string& out) const;
|
const std::string& in, std::string& out) const;
|
||||||
// Re-post the existing fields. Used to toggle between
|
// Re-post the existing fields. Used to toggle between
|
||||||
// normal and advanced modes. Render() should be called
|
// normal and advanced modes. Render() should be called
|
||||||
|
|
|
@ -21,7 +21,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height,
|
||||||
int left, int top) :
|
int left, int top) :
|
||||||
cmCursesWidget(width, height, left, top)
|
cmCursesWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::BOOL; // this is a bit of a hack
|
this->Type = cmState::BOOL; // this is a bit of a hack
|
||||||
// there is no option type, and string type causes ccmake to cast
|
// there is no option type, and string type causes ccmake to cast
|
||||||
// the widget into a string widget at some point. BOOL is safe for
|
// the widget into a string widget at some point. BOOL is safe for
|
||||||
// now.
|
// now.
|
||||||
|
|
|
@ -18,7 +18,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height,
|
||||||
int left, int top) :
|
int left, int top) :
|
||||||
cmCursesStringWidget(width, height, left, top)
|
cmCursesStringWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::PATH;
|
this->Type = cmState::PATH;
|
||||||
this->Cycle = false;
|
this->Cycle = false;
|
||||||
this->CurrentIndex = 0;
|
this->CurrentIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
|
||||||
}
|
}
|
||||||
std::vector<std::string> dirs;
|
std::vector<std::string> dirs;
|
||||||
|
|
||||||
cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0));
|
cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmState::PATH?-1:0));
|
||||||
if ( this->CurrentIndex < dirs.size() )
|
if ( this->CurrentIndex < dirs.size() )
|
||||||
{
|
{
|
||||||
cstr = dirs[this->CurrentIndex];
|
cstr = dirs[this->CurrentIndex];
|
||||||
|
|
|
@ -22,7 +22,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height,
|
||||||
cmCursesWidget(width, height, left, top)
|
cmCursesWidget(width, height, left, top)
|
||||||
{
|
{
|
||||||
this->InEdit = false;
|
this->InEdit = false;
|
||||||
this->Type = cmCacheManager::STRING;
|
this->Type = cmState::STRING;
|
||||||
set_field_fore(this->Field, A_NORMAL);
|
set_field_fore(this->Field, A_NORMAL);
|
||||||
set_field_back(this->Field, A_STANDOUT);
|
set_field_back(this->Field, A_STANDOUT);
|
||||||
field_opts_off(this->Field, O_STATIC);
|
field_opts_off(this->Field, O_STATIC);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef cmCursesWidget_h
|
#ifndef cmCursesWidget_h
|
||||||
#define cmCursesWidget_h
|
#define cmCursesWidget_h
|
||||||
|
|
||||||
#include "../cmCacheManager.h"
|
#include "../cmState.h"
|
||||||
#include "cmCursesStandardIncludes.h"
|
#include "cmCursesStandardIncludes.h"
|
||||||
|
|
||||||
class cmCursesMainForm;
|
class cmCursesMainForm;
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the type of the widget (STRING, PATH etc...)
|
* Get the type of the widget (STRING, PATH etc...)
|
||||||
*/
|
*/
|
||||||
cmCacheManager::CacheEntryType GetType()
|
cmState::CacheEntryType GetType()
|
||||||
{ return this->Type; }
|
{ return this->Type; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
cmCursesWidget(const cmCursesWidget& from);
|
cmCursesWidget(const cmCursesWidget& from);
|
||||||
void operator=(const cmCursesWidget&);
|
void operator=(const cmCursesWidget&);
|
||||||
|
|
||||||
cmCacheManager::CacheEntryType Type;
|
cmState::CacheEntryType Type;
|
||||||
std::string Value;
|
std::string Value;
|
||||||
FIELD* Field;
|
FIELD* Field;
|
||||||
// The page in the main form this widget is in
|
// The page in the main form this widget is in
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmState.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmExternalMakefileProjectGenerator.h"
|
#include "cmExternalMakefileProjectGenerator.h"
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
||||||
{
|
{
|
||||||
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
|
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
|
||||||
emit this->binaryDirChanged(this->BinaryDirectory);
|
emit this->binaryDirChanged(this->BinaryDirectory);
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmState* state = this->CMakeInstance->GetState();
|
||||||
this->setGenerator(QString());
|
this->setGenerator(QString());
|
||||||
if(!this->CMakeInstance->LoadCache(
|
if(!this->CMakeInstance->LoadCache(
|
||||||
this->BinaryDirectory.toLocal8Bit().data()))
|
this->BinaryDirectory.toLocal8Bit().data()))
|
||||||
|
@ -110,15 +110,15 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
||||||
|
|
||||||
QCMakePropertyList props = this->properties();
|
QCMakePropertyList props = this->properties();
|
||||||
emit this->propertiesChanged(props);
|
emit this->propertiesChanged(props);
|
||||||
const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||||
if (homeDir)
|
if (homeDir)
|
||||||
{
|
{
|
||||||
setSourceDirectory(QString::fromLocal8Bit(homeDir));
|
setSourceDirectory(QString::fromLocal8Bit(homeDir));
|
||||||
}
|
}
|
||||||
const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR");
|
const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
|
||||||
if (gen)
|
if (gen)
|
||||||
{
|
{
|
||||||
const char* extraGen = cachem
|
const char* extraGen = state
|
||||||
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||||
std::string curGen = cmExternalMakefileProjectGenerator::
|
std::string curGen = cmExternalMakefileProjectGenerator::
|
||||||
CreateFullGeneratorName(gen, extraGen? extraGen : "");
|
CreateFullGeneratorName(gen, extraGen? extraGen : "");
|
||||||
|
@ -195,14 +195,14 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
QStringList toremove;
|
QStringList toremove;
|
||||||
|
|
||||||
// set the value of properties
|
// set the value of properties
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmState* state = this->CMakeInstance->GetState();
|
||||||
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
|
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
|
||||||
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
it != cacheKeys.end(); ++it)
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it);
|
cmState::CacheEntryType t = state->GetCacheEntryType(*it);
|
||||||
if(t == cmCacheManager::INTERNAL ||
|
if(t == cmState::INTERNAL ||
|
||||||
t == cmCacheManager::STATIC)
|
t == cmState::STATIC)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
prop = props[idx];
|
prop = props[idx];
|
||||||
if(prop.Value.type() == QVariant::Bool)
|
if(prop.Value.type() == QVariant::Bool)
|
||||||
{
|
{
|
||||||
cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
|
state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cachem->SetCacheEntryValue(*it,
|
state->SetCacheEntryValue(*it,
|
||||||
prop.Value.toString().toLocal8Bit().data());
|
prop.Value.toString().toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
props.removeAt(idx);
|
props.removeAt(idx);
|
||||||
|
@ -236,7 +236,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
{
|
{
|
||||||
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
|
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
|
||||||
|
|
||||||
cachem->RemoveCacheEntry(s.toLocal8Bit().data());
|
state->RemoveCacheEntry(s.toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// add some new properites
|
// add some new properites
|
||||||
|
@ -249,28 +249,28 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
||||||
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
||||||
s.Value.toBool() ? "ON" : "OFF",
|
s.Value.toBool() ? "ON" : "OFF",
|
||||||
s.Help.toLocal8Bit().data(),
|
s.Help.toLocal8Bit().data(),
|
||||||
cmCacheManager::BOOL);
|
cmState::BOOL);
|
||||||
}
|
}
|
||||||
else if(s.Type == QCMakeProperty::STRING)
|
else if(s.Type == QCMakeProperty::STRING)
|
||||||
{
|
{
|
||||||
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
||||||
s.Value.toString().toLocal8Bit().data(),
|
s.Value.toString().toLocal8Bit().data(),
|
||||||
s.Help.toLocal8Bit().data(),
|
s.Help.toLocal8Bit().data(),
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
else if(s.Type == QCMakeProperty::PATH)
|
else if(s.Type == QCMakeProperty::PATH)
|
||||||
{
|
{
|
||||||
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
||||||
s.Value.toString().toLocal8Bit().data(),
|
s.Value.toString().toLocal8Bit().data(),
|
||||||
s.Help.toLocal8Bit().data(),
|
s.Help.toLocal8Bit().data(),
|
||||||
cmCacheManager::PATH);
|
cmState::PATH);
|
||||||
}
|
}
|
||||||
else if(s.Type == QCMakeProperty::FILEPATH)
|
else if(s.Type == QCMakeProperty::FILEPATH)
|
||||||
{
|
{
|
||||||
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
|
||||||
s.Value.toString().toLocal8Bit().data(),
|
s.Value.toString().toLocal8Bit().data(),
|
||||||
s.Help.toLocal8Bit().data(),
|
s.Help.toLocal8Bit().data(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,45 +281,45 @@ QCMakePropertyList QCMake::properties() const
|
||||||
{
|
{
|
||||||
QCMakePropertyList ret;
|
QCMakePropertyList ret;
|
||||||
|
|
||||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
cmState* state = this->CMakeInstance->GetState();
|
||||||
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
|
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
|
||||||
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
|
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
|
||||||
i != cacheKeys.end(); ++i)
|
i != cacheKeys.end(); ++i)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i);
|
cmState::CacheEntryType t = state->GetCacheEntryType(*i);
|
||||||
if(t == cmCacheManager::INTERNAL ||
|
if(t == cmState::INTERNAL ||
|
||||||
t == cmCacheManager::STATIC ||
|
t == cmState::STATIC ||
|
||||||
t == cmCacheManager::UNINITIALIZED)
|
t == cmState::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cachedValue = cachem->GetCacheEntryValue(*i);
|
const char* cachedValue = state->GetCacheEntryValue(*i);
|
||||||
|
|
||||||
QCMakeProperty prop;
|
QCMakeProperty prop;
|
||||||
prop.Key = QString::fromLocal8Bit(i->c_str());
|
prop.Key = QString::fromLocal8Bit(i->c_str());
|
||||||
prop.Help = QString::fromLocal8Bit(
|
prop.Help = QString::fromLocal8Bit(
|
||||||
cachem->GetCacheEntryProperty(*i, "HELPSTRING"));
|
state->GetCacheEntryProperty(*i, "HELPSTRING"));
|
||||||
prop.Value = QString::fromLocal8Bit(cachedValue);
|
prop.Value = QString::fromLocal8Bit(cachedValue);
|
||||||
prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
|
prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
|
||||||
if(t == cmCacheManager::BOOL)
|
if(t == cmState::BOOL)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::BOOL;
|
prop.Type = QCMakeProperty::BOOL;
|
||||||
prop.Value = cmSystemTools::IsOn(cachedValue);
|
prop.Value = cmSystemTools::IsOn(cachedValue);
|
||||||
}
|
}
|
||||||
else if(t == cmCacheManager::PATH)
|
else if(t == cmState::PATH)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::PATH;
|
prop.Type = QCMakeProperty::PATH;
|
||||||
}
|
}
|
||||||
else if(t == cmCacheManager::FILEPATH)
|
else if(t == cmState::FILEPATH)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::FILEPATH;
|
prop.Type = QCMakeProperty::FILEPATH;
|
||||||
}
|
}
|
||||||
else if(t == cmCacheManager::STRING)
|
else if(t == cmState::STRING)
|
||||||
{
|
{
|
||||||
prop.Type = QCMakeProperty::STRING;
|
prop.Type = QCMakeProperty::STRING;
|
||||||
const char* stringsProperty =
|
const char* stringsProperty =
|
||||||
cachem->GetCacheEntryProperty(*i, "STRINGS");
|
state->GetCacheEntryProperty(*i, "STRINGS");
|
||||||
if (stringsProperty)
|
if (stringsProperty)
|
||||||
{
|
{
|
||||||
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
|
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
|
||||||
|
|
|
@ -147,6 +147,6 @@ bool cmBuildCommand
|
||||||
makecommand.c_str(),
|
makecommand.c_str(),
|
||||||
"Command used to build entire project "
|
"Command used to build entire project "
|
||||||
"from the command line.",
|
"from the command line.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ bool cmBuildNameCommand
|
||||||
this->Makefile->AddCacheDefinition(args[0],
|
this->Makefile->AddCacheDefinition(args[0],
|
||||||
cv.c_str(),
|
cv.c_str(),
|
||||||
"Name of build.",
|
"Name of build.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ bool cmBuildNameCommand
|
||||||
this->Makefile->AddCacheDefinition(args[0],
|
this->Makefile->AddCacheDefinition(args[0],
|
||||||
buildname.c_str(),
|
buildname.c_str(),
|
||||||
"Name of build.",
|
"Name of build.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,27 +87,27 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name,
|
||||||
{
|
{
|
||||||
case CM_CACHE_BOOL:
|
case CM_CACHE_BOOL:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::BOOL);
|
cmState::BOOL);
|
||||||
break;
|
break;
|
||||||
case CM_CACHE_PATH:
|
case CM_CACHE_PATH:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::PATH);
|
cmState::PATH);
|
||||||
break;
|
break;
|
||||||
case CM_CACHE_FILEPATH:
|
case CM_CACHE_FILEPATH:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
break;
|
break;
|
||||||
case CM_CACHE_STRING:
|
case CM_CACHE_STRING:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
break;
|
break;
|
||||||
case CM_CACHE_INTERNAL:
|
case CM_CACHE_INTERNAL:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
break;
|
break;
|
||||||
case CM_CACHE_STATIC:
|
case CM_CACHE_STATIC:
|
||||||
mf->AddCacheDefinition(name,value,doc,
|
mf->AddCacheDefinition(name,value,doc,
|
||||||
cmCacheManager::STATIC);
|
cmState::STATIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2279,7 +2279,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg)
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string value;
|
std::string value;
|
||||||
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
cmState::CacheEntryType type = cmState::UNINITIALIZED;
|
||||||
|
|
||||||
if (cmake::ParseCacheEntry(arg, name, value, type))
|
if (cmake::ParseCacheEntry(arg, name, value, type))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
#include <cmsys/FStream.hxx>
|
#include <cmsys/FStream.hxx>
|
||||||
#include <cmsys/RegularExpression.hxx>
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
const char* cmCacheManagerTypes[] =
|
|
||||||
{ "BOOL",
|
|
||||||
"PATH",
|
|
||||||
"FILEPATH",
|
|
||||||
"STRING",
|
|
||||||
"INTERNAL",
|
|
||||||
"STATIC",
|
|
||||||
"UNINITIALIZED",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
cmCacheManager::cmCacheManager(cmake* cm)
|
cmCacheManager::cmCacheManager(cmake* cm)
|
||||||
{
|
{
|
||||||
this->CacheMajorVersion = 0;
|
this->CacheMajorVersion = 0;
|
||||||
|
@ -40,41 +29,6 @@ cmCacheManager::cmCacheManager(cmake* cm)
|
||||||
this->CMakeInstance = cm;
|
this->CMakeInstance = cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type)
|
|
||||||
{
|
|
||||||
if ( type > 6 )
|
|
||||||
{
|
|
||||||
return cmCacheManagerTypes[6];
|
|
||||||
}
|
|
||||||
return cmCacheManagerTypes[type];
|
|
||||||
}
|
|
||||||
|
|
||||||
cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while(cmCacheManagerTypes[i])
|
|
||||||
{
|
|
||||||
if(strcmp(s, cmCacheManagerTypes[i]) == 0)
|
|
||||||
{
|
|
||||||
return static_cast<CacheEntryType>(i);
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmCacheManager::IsType(const char* s)
|
|
||||||
{
|
|
||||||
for(int i=0; cmCacheManagerTypes[i]; ++i)
|
|
||||||
{
|
|
||||||
if(strcmp(s, cmCacheManagerTypes[i]) == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmCacheManager::LoadCache(const std::string& path)
|
bool cmCacheManager::LoadCache(const std::string& path)
|
||||||
{
|
{
|
||||||
std::set<std::string> emptySet;
|
std::set<std::string> emptySet;
|
||||||
|
@ -122,7 +76,7 @@ static bool ParseEntryWithoutType(const std::string& entry,
|
||||||
bool cmCacheManager::ParseEntry(const std::string& entry,
|
bool cmCacheManager::ParseEntry(const std::string& entry,
|
||||||
std::string& var,
|
std::string& var,
|
||||||
std::string& value,
|
std::string& value,
|
||||||
CacheEntryType& type)
|
cmState::CacheEntryType& type)
|
||||||
{
|
{
|
||||||
// input line is: key:type=value
|
// input line is: key:type=value
|
||||||
static cmsys::RegularExpression reg(
|
static cmsys::RegularExpression reg(
|
||||||
|
@ -134,14 +88,14 @@ bool cmCacheManager::ParseEntry(const std::string& entry,
|
||||||
if(regQuoted.find(entry))
|
if(regQuoted.find(entry))
|
||||||
{
|
{
|
||||||
var = regQuoted.match(1);
|
var = regQuoted.match(1);
|
||||||
type = cmCacheManager::StringToType(regQuoted.match(2).c_str());
|
type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str());
|
||||||
value = regQuoted.match(3);
|
value = regQuoted.match(3);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
else if (reg.find(entry))
|
else if (reg.find(entry))
|
||||||
{
|
{
|
||||||
var = reg.match(1);
|
var = reg.match(1);
|
||||||
type = cmCacheManager::StringToType(reg.match(2).c_str());
|
type = cmState::StringToCacheEntryType(reg.match(2).c_str());
|
||||||
value = reg.match(3);
|
value = reg.match(3);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +204,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
// If the entry is not internal to the cache being loaded
|
// If the entry is not internal to the cache being loaded
|
||||||
// or if it is in the list of internal entries to be
|
// or if it is in the list of internal entries to be
|
||||||
// imported, load it.
|
// imported, load it.
|
||||||
if ( internal || (e.Type != INTERNAL) ||
|
if ( internal || (e.Type != cmState::INTERNAL) ||
|
||||||
(includes.find(entryKey) != includes.end()) )
|
(includes.find(entryKey) != includes.end()) )
|
||||||
{
|
{
|
||||||
// If we are loading the cache from another project,
|
// If we are loading the cache from another project,
|
||||||
|
@ -258,7 +212,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
// not visible in the gui
|
// not visible in the gui
|
||||||
if (!internal)
|
if (!internal)
|
||||||
{
|
{
|
||||||
e.Type = INTERNAL;
|
e.Type = cmState::INTERNAL;
|
||||||
helpString = "DO NOT EDIT, ";
|
helpString = "DO NOT EDIT, ";
|
||||||
helpString += entryKey;
|
helpString += entryKey;
|
||||||
helpString += " loaded from external file. "
|
helpString += " loaded from external file. "
|
||||||
|
@ -306,10 +260,10 @@ bool cmCacheManager::LoadCache(const std::string& path,
|
||||||
// Set as version 0.0
|
// Set as version 0.0
|
||||||
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
|
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
|
||||||
"Minor version of cmake used to create the "
|
"Minor version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmState::INTERNAL);
|
||||||
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
|
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
|
||||||
"Major version of cmake used to create the "
|
"Major version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmState::INTERNAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
// check to make sure the cache directory has not
|
// check to make sure the cache directory has not
|
||||||
|
@ -351,7 +305,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
|
||||||
CacheEntry& e)
|
CacheEntry& e)
|
||||||
{
|
{
|
||||||
// All property entries are internal.
|
// All property entries are internal.
|
||||||
if(e.Type != cmCacheManager::INTERNAL)
|
if(e.Type != cmState::INTERNAL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +324,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
|
||||||
// Create an entry and store the property.
|
// Create an entry and store the property.
|
||||||
CacheEntry& ne = this->Cache[key];
|
CacheEntry& ne = this->Cache[key];
|
||||||
ne.Properties.SetCMakeInstance(this->CMakeInstance);
|
ne.Properties.SetCMakeInstance(this->CMakeInstance);
|
||||||
ne.Type = cmCacheManager::UNINITIALIZED;
|
ne.Type = cmState::UNINITIALIZED;
|
||||||
ne.SetProperty(*p, e.Value.c_str());
|
ne.SetProperty(*p, e.Value.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -427,15 +381,15 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
sprintf(temp, "%d", cmVersion::GetMinorVersion());
|
sprintf(temp, "%d", cmVersion::GetMinorVersion());
|
||||||
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
|
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
|
||||||
"Minor version of cmake used to create the "
|
"Minor version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmState::INTERNAL);
|
||||||
sprintf(temp, "%d", cmVersion::GetMajorVersion());
|
sprintf(temp, "%d", cmVersion::GetMajorVersion());
|
||||||
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
|
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
|
||||||
"Major version of cmake used to create the "
|
"Major version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmState::INTERNAL);
|
||||||
sprintf(temp, "%d", cmVersion::GetPatchVersion());
|
sprintf(temp, "%d", cmVersion::GetPatchVersion());
|
||||||
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
|
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
|
||||||
"Patch version of cmake used to create the "
|
"Patch version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmState::INTERNAL);
|
||||||
|
|
||||||
// Let us store the current working directory so that if somebody
|
// Let us store the current working directory so that if somebody
|
||||||
// Copies it, he will not be surprised
|
// Copies it, he will not be surprised
|
||||||
|
@ -450,7 +404,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||||
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
|
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
|
||||||
"This is the directory where this CMakeCache.txt"
|
"This is the directory where this CMakeCache.txt"
|
||||||
" was created", cmCacheManager::INTERNAL);
|
" was created", cmState::INTERNAL);
|
||||||
|
|
||||||
fout << "# This is the CMakeCache file.\n"
|
fout << "# This is the CMakeCache file.\n"
|
||||||
<< "# For build in directory: " << currentcwd << "\n";
|
<< "# For build in directory: " << currentcwd << "\n";
|
||||||
|
@ -484,7 +438,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
this->Cache.begin(); i != this->Cache.end(); ++i)
|
this->Cache.begin(); i != this->Cache.end(); ++i)
|
||||||
{
|
{
|
||||||
const CacheEntry& ce = (*i).second;
|
const CacheEntry& ce = (*i).second;
|
||||||
CacheEntryType t = ce.Type;
|
cmState::CacheEntryType t = ce.Type;
|
||||||
if(!ce.Initialized)
|
if(!ce.Initialized)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -493,7 +447,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
"\" is uninitialized");
|
"\" is uninitialized");
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else if(t != INTERNAL)
|
else if(t != cmState::INTERNAL)
|
||||||
{
|
{
|
||||||
// Format is key:type=value
|
// Format is key:type=value
|
||||||
if(const char* help = ce.GetProperty("HELPSTRING"))
|
if(const char* help = ce.GetProperty("HELPSTRING"))
|
||||||
|
@ -505,7 +459,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
cmCacheManager::OutputHelpString(fout, "Missing description");
|
cmCacheManager::OutputHelpString(fout, "Missing description");
|
||||||
}
|
}
|
||||||
this->OutputKey(fout, i->first);
|
this->OutputKey(fout, i->first);
|
||||||
fout << ":" << cmCacheManagerTypes[t] << "=";
|
fout << ":" << cmState::CacheEntryTypeToString(t) << "=";
|
||||||
this->OutputValue(fout, ce.Value);
|
this->OutputValue(fout, ce.Value);
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
}
|
}
|
||||||
|
@ -525,9 +479,9 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheEntryType t = i.GetType();
|
cmState::CacheEntryType t = i.GetType();
|
||||||
this->WritePropertyEntries(fout, i);
|
this->WritePropertyEntries(fout, i);
|
||||||
if(t == cmCacheManager::INTERNAL)
|
if(t == cmState::INTERNAL)
|
||||||
{
|
{
|
||||||
// Format is key:type=value
|
// Format is key:type=value
|
||||||
if(const char* help = i.GetProperty("HELPSTRING"))
|
if(const char* help = i.GetProperty("HELPSTRING"))
|
||||||
|
@ -535,7 +489,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
|
||||||
this->OutputHelpString(fout, help);
|
this->OutputHelpString(fout, help);
|
||||||
}
|
}
|
||||||
this->OutputKey(fout, i.GetName());
|
this->OutputKey(fout, i.GetName());
|
||||||
fout << ":" << cmCacheManagerTypes[t] << "=";
|
fout << ":" << cmState::CacheEntryTypeToString(t) << "=";
|
||||||
this->OutputValue(fout, i.GetValue());
|
this->OutputValue(fout, i.GetValue());
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
}
|
}
|
||||||
|
@ -677,7 +631,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
|
||||||
for(std::map<std::string, CacheEntry>::const_iterator i =
|
for(std::map<std::string, CacheEntry>::const_iterator i =
|
||||||
this->Cache.begin(); i != this->Cache.end(); ++i)
|
this->Cache.begin(); i != this->Cache.end(); ++i)
|
||||||
{
|
{
|
||||||
if((*i).second.Type != INTERNAL)
|
if((*i).second.Type != cmState::INTERNAL)
|
||||||
{
|
{
|
||||||
out << (*i).first << " = " << (*i).second.Value
|
out << (*i).first << " = " << (*i).second.Value
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -693,7 +647,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
|
||||||
void cmCacheManager::AddCacheEntry(const std::string& key,
|
void cmCacheManager::AddCacheEntry(const std::string& key,
|
||||||
const char* value,
|
const char* value,
|
||||||
const char* helpString,
|
const char* helpString,
|
||||||
CacheEntryType type)
|
cmState::CacheEntryType type)
|
||||||
{
|
{
|
||||||
CacheEntry& e = this->Cache[key];
|
CacheEntry& e = this->Cache[key];
|
||||||
e.Properties.SetCMakeInstance(this->CMakeInstance);
|
e.Properties.SetCMakeInstance(this->CMakeInstance);
|
||||||
|
@ -708,7 +662,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key,
|
||||||
}
|
}
|
||||||
e.Type = type;
|
e.Type = type;
|
||||||
// make sure we only use unix style paths
|
// make sure we only use unix style paths
|
||||||
if(type == FILEPATH || type == PATH)
|
if(type == cmState::FILEPATH || type == cmState::PATH)
|
||||||
{
|
{
|
||||||
if(e.Value.find(';') != e.Value.npos)
|
if(e.Value.find(';') != e.Value.npos)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +743,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
|
||||||
{
|
{
|
||||||
if(prop == "TYPE")
|
if(prop == "TYPE")
|
||||||
{
|
{
|
||||||
return cmCacheManagerTypes[this->Type];
|
return cmState::CacheEntryTypeToString(this->Type);
|
||||||
}
|
}
|
||||||
else if(prop == "VALUE")
|
else if(prop == "VALUE")
|
||||||
{
|
{
|
||||||
|
@ -806,7 +760,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
|
||||||
{
|
{
|
||||||
if(prop == "TYPE")
|
if(prop == "TYPE")
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::StringToType(value? value : "STRING");
|
this->Type = cmState::StringToCacheEntryType(value? value : "STRING");
|
||||||
}
|
}
|
||||||
else if(prop == "VALUE")
|
else if(prop == "VALUE")
|
||||||
{
|
{
|
||||||
|
@ -825,7 +779,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
|
||||||
{
|
{
|
||||||
if(prop == "TYPE")
|
if(prop == "TYPE")
|
||||||
{
|
{
|
||||||
this->Type = cmCacheManager::StringToType(value? value : "STRING");
|
this->Type = cmState::StringToCacheEntryType(value? value : "STRING");
|
||||||
}
|
}
|
||||||
else if(prop == "VALUE")
|
else if(prop == "VALUE")
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmPropertyMap.h"
|
#include "cmPropertyMap.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmMarkAsAdvancedCommand;
|
class cmMarkAsAdvancedCommand;
|
||||||
class cmake;
|
class cmake;
|
||||||
|
@ -30,21 +32,22 @@ public:
|
||||||
cmCacheManager(cmake* cm);
|
cmCacheManager(cmake* cm);
|
||||||
class CacheIterator;
|
class CacheIterator;
|
||||||
friend class cmCacheManager::CacheIterator;
|
friend class cmCacheManager::CacheIterator;
|
||||||
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
|
|
||||||
UNINITIALIZED };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CacheEntry
|
struct CacheEntry
|
||||||
{
|
{
|
||||||
std::string Value;
|
std::string Value;
|
||||||
CacheEntryType Type;
|
cmState::CacheEntryType Type;
|
||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
const char* GetProperty(const std::string&) const;
|
const char* GetProperty(const std::string&) const;
|
||||||
void SetProperty(const std::string& property, const char* value);
|
void SetProperty(const std::string& property, const char* value);
|
||||||
void AppendProperty(const std::string& property, const char* value,
|
void AppendProperty(const std::string& property, const char* value,
|
||||||
bool asString=false);
|
bool asString=false);
|
||||||
bool Initialized;
|
bool Initialized;
|
||||||
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
|
CacheEntry()
|
||||||
|
: Value(""),
|
||||||
|
Type(cmState::UNINITIALIZED),
|
||||||
|
Initialized(false)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,8 +71,10 @@ public:
|
||||||
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
|
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
|
||||||
bool GetValueAsBool() const;
|
bool GetValueAsBool() const;
|
||||||
void SetValue(const char*);
|
void SetValue(const char*);
|
||||||
CacheEntryType GetType() const { return this->GetEntry().Type; }
|
cmState::CacheEntryType GetType() const
|
||||||
void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; }
|
{ return this->GetEntry().Type; }
|
||||||
|
void SetType(cmState::CacheEntryType ty)
|
||||||
|
{ this->GetEntry().Type = ty; }
|
||||||
bool Initialized() { return this->GetEntry().Initialized; }
|
bool Initialized() { return this->GetEntry().Initialized; }
|
||||||
cmCacheManager &Container;
|
cmCacheManager &Container;
|
||||||
std::map<std::string, CacheEntry>::iterator Position;
|
std::map<std::string, CacheEntry>::iterator Position;
|
||||||
|
@ -94,17 +99,6 @@ public:
|
||||||
return CacheIterator(*this);
|
return CacheIterator(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Types for the cache entries. These are useful as
|
|
||||||
* hints for a cache editor program. Path should bring
|
|
||||||
* up a file chooser, BOOL a check box, and STRING a
|
|
||||||
* text entry box, FILEPATH is a full path to a file which
|
|
||||||
* can be different than just a path input
|
|
||||||
*/
|
|
||||||
static CacheEntryType StringToType(const char*);
|
|
||||||
static const char* TypeToString(CacheEntryType);
|
|
||||||
static bool IsType(const char*);
|
|
||||||
|
|
||||||
///! Load a cache for given makefile. Loads from path/CMakeCache.txt.
|
///! Load a cache for given makefile. Loads from path/CMakeCache.txt.
|
||||||
bool LoadCache(const std::string& path);
|
bool LoadCache(const std::string& path);
|
||||||
bool LoadCache(const std::string& path, bool internal,
|
bool LoadCache(const std::string& path, bool internal,
|
||||||
|
@ -134,7 +128,7 @@ public:
|
||||||
static bool ParseEntry(const std::string& entry,
|
static bool ParseEntry(const std::string& entry,
|
||||||
std::string& var,
|
std::string& var,
|
||||||
std::string& value,
|
std::string& value,
|
||||||
CacheEntryType& type);
|
cmState::CacheEntryType& type);
|
||||||
|
|
||||||
///! Get a value from the cache given a key
|
///! Get a value from the cache given a key
|
||||||
const char* GetInitializedCacheValue(const std::string& key) const;
|
const char* GetInitializedCacheValue(const std::string& key) const;
|
||||||
|
@ -155,7 +149,7 @@ public:
|
||||||
return this->GetCacheIterator(key.c_str()).GetProperty(propName);
|
return this->GetCacheIterator(key.c_str()).GetProperty(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheEntryType GetCacheEntryType(std::string const& key)
|
cmState::CacheEntryType GetCacheEntryType(std::string const& key)
|
||||||
{
|
{
|
||||||
return this->GetCacheIterator(key.c_str()).GetType();
|
return this->GetCacheIterator(key.c_str()).GetType();
|
||||||
}
|
}
|
||||||
|
@ -223,7 +217,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
///! Add an entry into the cache
|
///! Add an entry into the cache
|
||||||
void AddCacheEntry(const std::string& key, const char* value,
|
void AddCacheEntry(const std::string& key, const char* value,
|
||||||
const char* helpString, CacheEntryType type);
|
const char* helpString,
|
||||||
|
cmState::CacheEntryType type);
|
||||||
|
|
||||||
///! Get a cache entry object for a key
|
///! Get a cache entry object for a key
|
||||||
CacheEntry *GetCacheEntry(const std::string& key);
|
CacheEntry *GetCacheEntry(const std::string& key);
|
||||||
|
@ -248,9 +243,8 @@ private:
|
||||||
CacheEntryMap Cache;
|
CacheEntryMap Cache;
|
||||||
// Only cmake and cmMakefile should be able to add cache values
|
// Only cmake and cmMakefile should be able to add cache values
|
||||||
// the commands should never use the cmCacheManager directly
|
// the commands should never use the cmCacheManager directly
|
||||||
friend class cmMakefile; // allow access to add cache values
|
friend class cmState; // allow access to add cache values
|
||||||
friend class cmake; // allow access to add cache values
|
friend class cmake; // allow access to add cache values
|
||||||
friend class cmMarkAsAdvancedCommand; // allow access to add cache values
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
#include "cmCommandArgumentLexer.h"
|
#include "cmCommandArgumentLexer.h"
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
|
||||||
}
|
}
|
||||||
if ( strcmp(key, "CACHE") == 0 )
|
if ( strcmp(key, "CACHE") == 0 )
|
||||||
{
|
{
|
||||||
if(const char* c = this->Makefile->GetCacheManager()
|
if(const char* c = this->Makefile->GetState()
|
||||||
->GetInitializedCacheValue(var))
|
->GetInitializedCacheValue(var))
|
||||||
{
|
{
|
||||||
if(this->EscapeQuotes)
|
if(this->EscapeQuotes)
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmCoreTryCompile.h"
|
#include "cmCoreTryCompile.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
@ -527,7 +526,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
|
||||||
this->Makefile->AddCacheDefinition(argv[0],
|
this->Makefile->AddCacheDefinition(argv[0],
|
||||||
(res == 0 ? "TRUE" : "FALSE"),
|
(res == 0 ? "TRUE" : "FALSE"),
|
||||||
"Result of TRY_COMPILE",
|
"Result of TRY_COMPILE",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
|
|
||||||
if (!outputVariable.empty())
|
if (!outputVariable.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "cmLocalUnixMakefileGenerator3.h"
|
#include "cmLocalUnixMakefileGenerator3.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmState.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
|
|
||||||
|
@ -205,7 +206,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()->GetInitializedCacheValue(
|
const char* cacheValue = mf->GetState()->GetInitializedCacheValue(
|
||||||
cacheEntryName);
|
cacheEntryName);
|
||||||
|
|
||||||
// now we have both, decide which one to use
|
// now we have both, decide which one to use
|
||||||
|
@ -221,7 +222,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
|
||||||
// in the cache
|
// in the cache
|
||||||
valueToUse = envVarValue;
|
valueToUse = envVarValue;
|
||||||
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
||||||
cacheEntryName.c_str(), cmCacheManager::STRING,
|
cacheEntryName.c_str(), cmState::STRING,
|
||||||
true);
|
true);
|
||||||
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
||||||
}
|
}
|
||||||
|
@ -242,7 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
|
||||||
{
|
{
|
||||||
valueToUse = envVarValue;
|
valueToUse = envVarValue;
|
||||||
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
|
||||||
cacheEntryName.c_str(), cmCacheManager::STRING,
|
cacheEntryName.c_str(), cmState::STRING,
|
||||||
true);
|
true);
|
||||||
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "cmFindBase.h"
|
#include "cmFindBase.h"
|
||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
cmFindBase::cmFindBase()
|
cmFindBase::cmFindBase()
|
||||||
{
|
{
|
||||||
|
@ -366,8 +367,8 @@ bool cmFindBase::CheckForVariableInCache()
|
||||||
if(const char* cacheValue =
|
if(const char* cacheValue =
|
||||||
this->Makefile->GetDefinition(this->VariableName))
|
this->Makefile->GetDefinition(this->VariableName))
|
||||||
{
|
{
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName);
|
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
||||||
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
||||||
bool cached = cacheEntry ? true : false;
|
bool cached = cacheEntry ? true : false;
|
||||||
if(found)
|
if(found)
|
||||||
|
@ -376,8 +377,8 @@ bool cmFindBase::CheckForVariableInCache()
|
||||||
// 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 && manager->GetCacheEntryType(this->VariableName)
|
if(cached && state->GetCacheEntryType(this->VariableName)
|
||||||
== cmCacheManager::UNINITIALIZED)
|
== cmState::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
this->AlreadyInCacheWithoutMetaInfo = true;
|
this->AlreadyInCacheWithoutMetaInfo = true;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +386,7 @@ bool cmFindBase::CheckForVariableInCache()
|
||||||
}
|
}
|
||||||
else if(cached)
|
else if(cached)
|
||||||
{
|
{
|
||||||
const char* hs = manager->GetCacheEntryProperty(this->VariableName,
|
const char* hs = state->GetCacheEntryProperty(this->VariableName,
|
||||||
"HELPSTRING");
|
"HELPSTRING");
|
||||||
this->VariableDocumentation = hs?hs:"(none)";
|
this->VariableDocumentation = hs?hs:"(none)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmFindLibraryCommand.h"
|
#include "cmFindLibraryCommand.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include <cmsys/Directory.hxx>
|
#include <cmsys/Directory.hxx>
|
||||||
#include <cmsys/stl/algorithm>
|
#include <cmsys/stl/algorithm>
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ bool cmFindLibraryCommand
|
||||||
{
|
{
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName, "",
|
this->Makefile->AddCacheDefinition(this->VariableName, "",
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,14 +71,14 @@ bool cmFindLibraryCommand
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName,
|
this->Makefile->AddCacheDefinition(this->VariableName,
|
||||||
library.c_str(),
|
library.c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::string notfound = this->VariableName + "-NOTFOUND";
|
std::string notfound = this->VariableName + "-NOTFOUND";
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName,
|
this->Makefile->AddCacheDefinition(this->VariableName,
|
||||||
notfound.c_str(),
|
notfound.c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -947,7 +947,7 @@ bool cmFindPackageCommand::FindConfig()
|
||||||
// We force the value since we do not get here if it was already set.
|
// We force the value since we do not get here if it was already set.
|
||||||
this->Makefile->AddCacheDefinition(this->Variable,
|
this->Makefile->AddCacheDefinition(this->Variable,
|
||||||
init.c_str(), help.c_str(),
|
init.c_str(), help.c_str(),
|
||||||
cmCacheManager::PATH, true);
|
cmState::PATH, true);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmFindPathCommand.h"
|
#include "cmFindPathCommand.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
|
|
||||||
#include <cmsys/Glob.hxx>
|
#include <cmsys/Glob.hxx>
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ bool cmFindPathCommand
|
||||||
this->VariableName, "",
|
this->VariableName, "",
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
(this->IncludeFileInPath ?
|
(this->IncludeFileInPath ?
|
||||||
cmCacheManager::FILEPATH :cmCacheManager::PATH)
|
cmState::FILEPATH :cmState::PATH)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -54,7 +53,7 @@ bool cmFindPathCommand
|
||||||
(this->VariableName, result.c_str(),
|
(this->VariableName, result.c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
(this->IncludeFileInPath) ?
|
(this->IncludeFileInPath) ?
|
||||||
cmCacheManager::FILEPATH :cmCacheManager::PATH);
|
cmState::FILEPATH :cmState::PATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
|
@ -62,7 +61,7 @@ bool cmFindPathCommand
|
||||||
(this->VariableName + "-NOTFOUND").c_str(),
|
(this->VariableName + "-NOTFOUND").c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
(this->IncludeFileInPath) ?
|
(this->IncludeFileInPath) ?
|
||||||
cmCacheManager::FILEPATH :cmCacheManager::PATH);
|
cmState::FILEPATH :cmState::PATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmFindProgramCommand.h"
|
#include "cmFindProgramCommand.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
@ -37,7 +36,7 @@ bool cmFindProgramCommand
|
||||||
{
|
{
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName, "",
|
this->Makefile->AddCacheDefinition(this->VariableName, "",
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -49,14 +48,14 @@ bool cmFindProgramCommand
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName,
|
this->Makefile->AddCacheDefinition(this->VariableName,
|
||||||
result.c_str(),
|
result.c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this->Makefile->AddCacheDefinition(this->VariableName,
|
this->Makefile->AddCacheDefinition(this->VariableName,
|
||||||
(this->VariableName + "-NOTFOUND").c_str(),
|
(this->VariableName + "-NOTFOUND").c_str(),
|
||||||
this->VariableDocumentation.c_str(),
|
this->VariableDocumentation.c_str(),
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,13 +117,13 @@ bool cmGetFilenameComponentCommand
|
||||||
{
|
{
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
(storeArgs, programArgs.c_str(),
|
(storeArgs, programArgs.c_str(),
|
||||||
"", args[2] == "PATH" ? cmCacheManager::FILEPATH
|
"", args[2] == "PATH" ? cmState::FILEPATH
|
||||||
: cmCacheManager::STRING);
|
: cmState::STRING);
|
||||||
}
|
}
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
(args[0], result.c_str(), "",
|
(args[0], result.c_str(), "",
|
||||||
args[2] == "PATH" ? cmCacheManager::FILEPATH
|
args[2] == "PATH" ? cmState::FILEPATH
|
||||||
: cmCacheManager::STRING);
|
: cmState::STRING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "cmGetPropertyCommand.h"
|
#include "cmGetPropertyCommand.h"
|
||||||
|
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
#include "cmState.h"
|
||||||
#include "cmTest.h"
|
#include "cmTest.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
|
@ -391,9 +392,9 @@ bool cmGetPropertyCommand::HandleCacheMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* value = 0;
|
const char* value = 0;
|
||||||
if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name))
|
if(this->Makefile->GetState()->GetCacheEntryValue(this->Name))
|
||||||
{
|
{
|
||||||
value = this->Makefile->GetCacheManager()
|
value = this->Makefile->GetState()
|
||||||
->GetCacheEntryProperty(this->Name, this->PropertyName);
|
->GetCacheEntryProperty(this->Name, this->PropertyName);
|
||||||
}
|
}
|
||||||
this->StoreResult(value);
|
this->StoreResult(value);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmExternalMakefileProjectGenerator.h"
|
#include "cmExternalMakefileProjectGenerator.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
#include "cmState.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmQtAutoGenerators.h"
|
#include "cmQtAutoGenerators.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
|
@ -179,7 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char* cname = this->GetCMakeInstance()->
|
const char* cname = this->GetCMakeInstance()->
|
||||||
GetCacheManager()->GetInitializedCacheValue(langComp);
|
GetState()->GetInitializedCacheValue(langComp);
|
||||||
std::string changeVars;
|
std::string changeVars;
|
||||||
if(cname && !optional)
|
if(cname && !optional)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +311,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
|
||||||
makeProgram += saveFile;
|
makeProgram += saveFile;
|
||||||
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
|
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
|
||||||
"make program",
|
"make program",
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,7 +1123,7 @@ void cmGlobalGenerator::Configure()
|
||||||
sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size()));
|
sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size()));
|
||||||
this->GetCMakeInstance()->AddCacheEntry
|
this->GetCMakeInstance()->AddCacheEntry
|
||||||
("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
|
("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
|
||||||
"number of local generators", cmCacheManager::INTERNAL);
|
"number of local generators", cmState::INTERNAL);
|
||||||
|
|
||||||
// check for link libraries and include directories containing "NOTFOUND"
|
// check for link libraries and include directories containing "NOTFOUND"
|
||||||
// and for infinite loops
|
// and for infinite loops
|
||||||
|
@ -1544,7 +1545,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
std::map<std::string, std::string> notFoundMap;
|
std::map<std::string, std::string> notFoundMap;
|
||||||
// std::set<std::string> notFoundMap;
|
// std::set<std::string> notFoundMap;
|
||||||
// after it is all done do a ConfigureFinalPass
|
// after it is all done do a ConfigureFinalPass
|
||||||
cmCacheManager* manager = this->GetCMakeInstance()->GetCacheManager();
|
cmState* state = this->GetCMakeInstance()->GetState();
|
||||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
{
|
{
|
||||||
this->LocalGenerators[i]->ConfigureFinalPass();
|
this->LocalGenerators[i]->ConfigureFinalPass();
|
||||||
|
@ -1566,7 +1567,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);
|
||||||
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
||||||
{
|
{
|
||||||
varName += " (ADVANCED)";
|
varName += " (ADVANCED)";
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1598,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);
|
||||||
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
|
||||||
{
|
{
|
||||||
varName += " (ADVANCED)";
|
varName += " (ADVANCED)";
|
||||||
}
|
}
|
||||||
|
@ -1644,7 +1645,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()->GetInitializedCacheValue
|
if (!this->CMakeInstance->GetState()->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
|
||||||
|
@ -1842,7 +1843,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()->GetInitializedCacheValue
|
this->CMakeInstance->GetState()->GetInitializedCacheValue
|
||||||
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
|
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
|
||||||
|
|
||||||
if (!numGenC)
|
if (!numGenC)
|
||||||
|
@ -1900,7 +1901,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
|
||||||
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
|
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
|
||||||
"make program",
|
"make program",
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
// copy the enabled languages
|
// copy the enabled languages
|
||||||
this->LanguageEnabled = gen->LanguageEnabled;
|
this->LanguageEnabled = gen->LanguageEnabled;
|
||||||
this->LanguagesReady = gen->LanguagesReady;
|
this->LanguagesReady = gen->LanguagesReady;
|
||||||
|
|
|
@ -97,7 +97,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
|
||||||
{
|
{
|
||||||
cm->AddCacheEntry
|
cm->AddCacheEntry
|
||||||
("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
|
("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
|
||||||
"Path to cache edit program executable.", cmCacheManager::INTERNAL);
|
"Path to cache edit program executable.", cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
|
const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
|
||||||
|
|
|
@ -89,7 +89,7 @@ void cmGlobalVisualStudio7Generator
|
||||||
"Semicolon separated list of supported configuration types, "
|
"Semicolon separated list of supported configuration types, "
|
||||||
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
||||||
"anything else will be ignored.",
|
"anything else will be ignored.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create list of configurations requested by user's cache, if any.
|
// Create list of configurations requested by user's cache, if any.
|
||||||
|
@ -109,7 +109,7 @@ void cmGlobalVisualStudio7Generator
|
||||||
mf->AddCacheDefinition
|
mf->AddCacheDefinition
|
||||||
("CMAKE_MSVCIDE_RUN_PATH", extraPath,
|
("CMAKE_MSVCIDE_RUN_PATH", extraPath,
|
||||||
"Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
|
"Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
|
||||||
cmCacheManager::STATIC);
|
cmState::STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
|
||||||
"Semicolon separated list of supported configuration types, "
|
"Semicolon separated list of supported configuration types, "
|
||||||
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
||||||
"anything else will be ignored.",
|
"anything else will be ignored.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalVisualStudio7Generator::Generate()
|
void cmGlobalVisualStudio7Generator::Generate()
|
||||||
|
@ -970,7 +970,7 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
|
||||||
ret = cmSystemTools::UpperCase(ret);
|
ret = cmSystemTools::UpperCase(ret);
|
||||||
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
|
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
|
||||||
ret.c_str(), "Stored GUID",
|
ret.c_str(), "Stored GUID",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
|
std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
|
||||||
|
|
|
@ -285,7 +285,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
|
||||||
"Semicolon separated list of supported configuration types, "
|
"Semicolon separated list of supported configuration types, "
|
||||||
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
|
||||||
"anything else will be ignored.",
|
"anything else will be ignored.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
|
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
|
||||||
|
@ -2754,7 +2754,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
|
||||||
}
|
}
|
||||||
|
|
||||||
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
|
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
|
||||||
id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL);
|
id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool cmIncludeExternalMSProjectCommand
|
||||||
std::string guidVariable = utility_name + "_GUID_CMAKE";
|
std::string guidVariable = utility_name + "_GUID_CMAKE";
|
||||||
this->Makefile->GetCMakeInstance()->AddCacheEntry(
|
this->Makefile->GetCMakeInstance()->AddCacheEntry(
|
||||||
guidVariable.c_str(), customGuid.c_str(),
|
guidVariable.c_str(), customGuid.c_str(),
|
||||||
"Stored GUID", cmCacheManager::INTERNAL);
|
"Stored GUID", cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a target instance for this utility.
|
// Create a target instance for this utility.
|
||||||
|
|
|
@ -172,7 +172,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
|
||||||
// Check one line of the cache file.
|
// Check one line of the cache file.
|
||||||
std::string var;
|
std::string var;
|
||||||
std::string value;
|
std::string value;
|
||||||
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
cmState::CacheEntryType type = cmState::UNINITIALIZED;
|
||||||
if(cmake::ParseCacheEntry(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.
|
||||||
|
|
|
@ -118,7 +118,7 @@ void cmLocalVisualStudio10Generator
|
||||||
AddCacheEntry(guidStoreName.c_str(),
|
AddCacheEntry(guidStoreName.c_str(),
|
||||||
parser.GUID.c_str(),
|
parser.GUID.c_str(),
|
||||||
"Stored GUID",
|
"Stored GUID",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmCustomCommandGenerator.h"
|
#include "cmCustomCommandGenerator.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
@ -2331,7 +2330,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
|
||||||
AddCacheEntry(guidStoreName.c_str(),
|
AddCacheEntry(guidStoreName.c_str(),
|
||||||
parser.GUID.c_str(),
|
parser.GUID.c_str(),
|
||||||
"Stored GUID",
|
"Stored GUID",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmCommands.h"
|
#include "cmCommands.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmState.h"
|
||||||
#include "cmFunctionBlocker.h"
|
#include "cmFunctionBlocker.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmCommandArgumentParserHelper.h"
|
#include "cmCommandArgumentParserHelper.h"
|
||||||
|
@ -1778,16 +1778,16 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
|
||||||
|
|
||||||
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||||
const char* doc,
|
const char* doc,
|
||||||
cmCacheManager::CacheEntryType type,
|
cmState::CacheEntryType type,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
bool haveVal = value ? true : false;
|
bool haveVal = value ? true : false;
|
||||||
std::string val = haveVal ? value : "";
|
std::string val = haveVal ? value : "";
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->GetCacheManager()->GetInitializedCacheValue(name);
|
this->GetState()->GetInitializedCacheValue(name);
|
||||||
if(existingValue
|
if(existingValue
|
||||||
&& (this->GetCacheManager()->GetCacheEntryType(name)
|
&& (this->GetState()->GetCacheEntryType(name)
|
||||||
== cmCacheManager::UNINITIALIZED))
|
== cmState::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
|
||||||
|
@ -1796,7 +1796,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||||
val = existingValue;
|
val = existingValue;
|
||||||
haveVal = true;
|
haveVal = true;
|
||||||
}
|
}
|
||||||
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
|
if ( type == cmState::PATH || type == cmState::FILEPATH )
|
||||||
{
|
{
|
||||||
std::vector<std::string>::size_type cc;
|
std::vector<std::string>::size_type cc;
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
|
@ -1815,13 +1815,13 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||||
nvalue += files[cc];
|
nvalue += files[cc];
|
||||||
}
|
}
|
||||||
|
|
||||||
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
|
this->GetState()->AddCacheEntry(name, nvalue.c_str(), doc, type);
|
||||||
val = this->GetCacheManager()->GetInitializedCacheValue(name);
|
val = this->GetState()->GetInitializedCacheValue(name);
|
||||||
haveVal = true;
|
haveVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
|
this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
|
||||||
doc, 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);
|
||||||
|
@ -1949,7 +1949,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
|
||||||
|
|
||||||
void cmMakefile::RemoveCacheDefinition(const std::string& name)
|
void cmMakefile::RemoveCacheDefinition(const std::string& name)
|
||||||
{
|
{
|
||||||
this->GetCacheManager()->RemoveCacheEntry(name);
|
this->GetState()->RemoveCacheEntry(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::SetProjectName(const char* p)
|
void cmMakefile::SetProjectName(const char* p)
|
||||||
|
@ -2406,7 +2406,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()->GetInitializedCacheValue(name);
|
def = this->GetState()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
if(cmVariableWatch* vv = this->GetVariableWatch())
|
if(cmVariableWatch* vv = this->GetVariableWatch())
|
||||||
|
@ -2431,7 +2431,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()->GetInitializedCacheValue(name);
|
def = this->GetState()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
cmVariableWatch* vv = this->GetVariableWatch();
|
cmVariableWatch* vv = this->GetVariableWatch();
|
||||||
|
@ -2473,7 +2473,7 @@ std::vector<std::string> cmMakefile
|
||||||
res.insert(res.end(), definitions.begin(), definitions.end());
|
res.insert(res.end(), definitions.begin(), definitions.end());
|
||||||
}
|
}
|
||||||
std::vector<std::string> cacheKeys =
|
std::vector<std::string> cacheKeys =
|
||||||
this->GetCacheManager()->GetCacheEntryKeys();
|
this->GetState()->GetCacheEntryKeys();
|
||||||
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
|
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
|
||||||
|
|
||||||
std::sort(res.begin(), res.end());
|
std::sort(res.begin(), res.end());
|
||||||
|
@ -2774,6 +2774,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
|
||||||
openstack.push(t_lookup());
|
openstack.push(t_lookup());
|
||||||
cmake::MessageType mtype = cmake::LOG;
|
cmake::MessageType mtype = cmake::LOG;
|
||||||
|
|
||||||
|
cmState* state = this->GetCMakeInstance()->GetState();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char inc = *in;
|
char inc = *in;
|
||||||
|
@ -2807,8 +2809,7 @@ 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()
|
value = state->GetCacheEntryValue(lookup);
|
||||||
->GetInitializedCacheValue(lookup);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Get the string we're meant to append to.
|
// Get the string we're meant to append to.
|
||||||
|
@ -3598,7 +3599,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
|
||||||
// Add this before the user-provided CMake arguments in case
|
// Add this before the user-provided CMake arguments in case
|
||||||
// one of the arguments is -DCMAKE_BUILD_TYPE=...
|
// one of the arguments is -DCMAKE_BUILD_TYPE=...
|
||||||
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config,
|
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config,
|
||||||
"Build configuration", cmCacheManager::STRING);
|
"Build configuration", cmState::STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if cmake args were provided then pass them in
|
// if cmake args were provided then pass them in
|
||||||
|
@ -3637,12 +3638,12 @@ int cmMakefile::TryCompile(const std::string& srcdir,
|
||||||
if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
|
if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
|
||||||
{
|
{
|
||||||
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
|
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
|
||||||
"TRUE", "", cmCacheManager::INTERNAL);
|
"TRUE", "", cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
|
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
|
||||||
"FALSE", "", cmCacheManager::INTERNAL);
|
"FALSE", "", cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
if (cm.Configure() != 0)
|
if (cm.Configure() != 0)
|
||||||
{
|
{
|
||||||
|
@ -3716,9 +3717,9 @@ void cmMakefile::GetListOfMacros(std::string& macros) const
|
||||||
macros = cmJoin(this->MacrosList, ";");
|
macros = cmJoin(this->MacrosList, ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCacheManager *cmMakefile::GetCacheManager() const
|
cmState *cmMakefile::GetState() const
|
||||||
{
|
{
|
||||||
return this->GetCMakeInstance()->GetCacheManager();
|
return this->GetCMakeInstance()->GetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::DisplayStatus(const char* message, float s) const
|
void cmMakefile::DisplayStatus(const char* message, float s) const
|
||||||
|
@ -4885,7 +4886,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
|
||||||
if(id == cmPolicies::CMP0001 &&
|
if(id == cmPolicies::CMP0001 &&
|
||||||
(status == cmPolicies::WARN || status == cmPolicies::OLD))
|
(status == cmPolicies::WARN || status == cmPolicies::OLD))
|
||||||
{
|
{
|
||||||
if(!(this->GetCacheManager()
|
if(!(this->GetState()
|
||||||
->GetInitializedCacheValue("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
|
||||||
|
@ -4895,7 +4896,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
|
||||||
"For backwards compatibility, what version of CMake "
|
"For backwards compatibility, what version of CMake "
|
||||||
"commands and "
|
"commands and "
|
||||||
"syntax should this version of CMake try to support.",
|
"syntax should this version of CMake try to support.",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#ifndef cmMakefile_h
|
#ifndef cmMakefile_h
|
||||||
#define cmMakefile_h
|
#define cmMakefile_h
|
||||||
|
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmPolicies.h"
|
#include "cmPolicies.h"
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmExpandedCommandArgument.h"
|
#include "cmExpandedCommandArgument.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
#include "cmSourceGroup.h"
|
#include "cmSourceGroup.h"
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
///! Add a definition to this makefile and the global cmake cache.
|
///! Add a definition to this makefile and the global cmake cache.
|
||||||
void AddCacheDefinition(const std::string& name, const char* value,
|
void AddCacheDefinition(const std::string& name, const char* value,
|
||||||
const char* doc,
|
const char* doc,
|
||||||
cmCacheManager::CacheEntryType type,
|
cmState::CacheEntryType type,
|
||||||
bool force = false);
|
bool force = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -758,7 +758,7 @@ public:
|
||||||
///enabled.
|
///enabled.
|
||||||
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
|
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
|
||||||
|
|
||||||
cmCacheManager *GetCacheManager() const;
|
cmState *GetState() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the variable watch. This is used to determine when certain variables
|
* Get the variable watch. This is used to determine when certain variables
|
||||||
|
|
|
@ -36,20 +36,20 @@ bool cmMarkAsAdvancedCommand
|
||||||
for(; i < args.size(); ++i)
|
for(; i < args.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string variable = args[i];
|
std::string variable = args[i];
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
if (!manager->GetCacheEntryValue(variable))
|
if (!state->GetCacheEntryValue(variable))
|
||||||
{
|
{
|
||||||
manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
|
state->AddCacheEntry(variable, 0, 0, cmState::UNINITIALIZED);
|
||||||
overwrite = true;
|
overwrite = true;
|
||||||
}
|
}
|
||||||
if (!manager->GetCacheEntryValue(variable))
|
if (!state->GetCacheEntryValue(variable))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("This should never happen...");
|
cmSystemTools::Error("This should never happen...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
|
if (!state->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
|
||||||
{
|
{
|
||||||
manager->SetCacheEntryProperty(variable, "ADVANCED", value);
|
state->SetCacheEntryProperty(variable, "ADVANCED", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,13 +42,13 @@ 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* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* existingValue = manager->GetCacheEntryValue(args[0]);
|
const char* existingValue = state->GetCacheEntryValue(args[0]);
|
||||||
if(existingValue)
|
if(existingValue)
|
||||||
{
|
{
|
||||||
if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED)
|
if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED)
|
||||||
{
|
{
|
||||||
manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
|
state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
initialValue = existingValue;
|
initialValue = existingValue;
|
||||||
|
@ -59,6 +59,6 @@ bool cmOptionCommand
|
||||||
}
|
}
|
||||||
bool init = cmSystemTools::IsOn(initialValue.c_str());
|
bool init = cmSystemTools::IsOn(initialValue.c_str());
|
||||||
this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF",
|
this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF",
|
||||||
args[1].c_str(), cmCacheManager::BOOL);
|
args[1].c_str(), cmState::BOOL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@ bool cmProjectCommand
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
(bindir,
|
(bindir,
|
||||||
this->Makefile->GetCurrentOutputDirectory(),
|
this->Makefile->GetCurrentOutputDirectory(),
|
||||||
"Value Computed by CMake", cmCacheManager::STATIC);
|
"Value Computed by CMake", cmState::STATIC);
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
(srcdir,
|
(srcdir,
|
||||||
this->Makefile->GetCurrentDirectory(),
|
this->Makefile->GetCurrentDirectory(),
|
||||||
"Value Computed by CMake", cmCacheManager::STATIC);
|
"Value Computed by CMake", cmState::STATIC);
|
||||||
|
|
||||||
bindir = "PROJECT_BINARY_DIR";
|
bindir = "PROJECT_BINARY_DIR";
|
||||||
srcdir = "PROJECT_SOURCE_DIR";
|
srcdir = "PROJECT_SOURCE_DIR";
|
||||||
|
@ -59,7 +59,7 @@ bool cmProjectCommand
|
||||||
this->Makefile->AddCacheDefinition
|
this->Makefile->AddCacheDefinition
|
||||||
("CMAKE_PROJECT_NAME",
|
("CMAKE_PROJECT_NAME",
|
||||||
args[0].c_str(),
|
args[0].c_str(),
|
||||||
"Value Computed by CMake", cmCacheManager::STATIC);
|
"Value Computed by CMake", cmState::STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool haveVersion = false;
|
bool haveVersion = false;
|
||||||
|
|
|
@ -79,8 +79,8 @@ bool cmSetCommand
|
||||||
bool cache = false; // optional
|
bool cache = false; // optional
|
||||||
bool force = false; // optional
|
bool force = false; // optional
|
||||||
bool parentScope = false;
|
bool parentScope = false;
|
||||||
cmCacheManager::CacheEntryType type
|
cmState::CacheEntryType type
|
||||||
= cmCacheManager::STRING; // required if cache
|
= cmState::STRING; // required if cache
|
||||||
const char* docstring = 0; // required if cache
|
const char* docstring = 0; // required if cache
|
||||||
|
|
||||||
unsigned int ignoreLastArgs = 0;
|
unsigned int ignoreLastArgs = 0;
|
||||||
|
@ -131,21 +131,21 @@ bool cmSetCommand
|
||||||
if(cache)
|
if(cache)
|
||||||
{
|
{
|
||||||
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
|
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
|
||||||
type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
|
type = cmState::StringToCacheEntryType(args[cacheStart+1].c_str());
|
||||||
docstring = args[cacheStart+2].c_str();
|
docstring = args[cacheStart+2].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if this is already in the cache
|
// see if this is already in the cache
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* existingValue = manager->GetCacheEntryValue(variable);
|
const char* existingValue = state->GetCacheEntryValue(variable);
|
||||||
if(existingValue &&
|
if(existingValue &&
|
||||||
(manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
|
(state->GetCacheEntryType(variable) != cmState::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
|
||||||
// then leave now without setting any definitions in the cache
|
// then leave now without setting any definitions in the cache
|
||||||
// or the makefile
|
// or the makefile
|
||||||
if(cache && type != cmCacheManager::INTERNAL && !force)
|
if(cache && type != cmState::INTERNAL && !force)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "cmSetTestsPropertiesCommand.h"
|
#include "cmSetTestsPropertiesCommand.h"
|
||||||
#include "cmSetSourceFilesPropertiesCommand.h"
|
#include "cmSetSourceFilesPropertiesCommand.h"
|
||||||
|
|
||||||
#include "cmCacheManager.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmSetPropertyCommand::cmSetPropertyCommand()
|
cmSetPropertyCommand::cmSetPropertyCommand()
|
||||||
|
@ -426,7 +425,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
|
||||||
}
|
}
|
||||||
else if(this->PropertyName == "TYPE")
|
else if(this->PropertyName == "TYPE")
|
||||||
{
|
{
|
||||||
if(!cmCacheManager::IsType(this->PropertyValue.c_str()))
|
if(!cmState::IsCacheEntryType(this->PropertyValue.c_str()))
|
||||||
{
|
{
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\"";
|
e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\"";
|
||||||
|
@ -453,7 +452,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
cmake* cm = mf->GetCMakeInstance();
|
cmake* cm = mf->GetCMakeInstance();
|
||||||
const char* existingValue
|
const char* existingValue
|
||||||
= cm->GetCacheManager()->GetCacheEntryValue(*ni);
|
= cm->GetState()->GetCacheEntryValue(*ni);
|
||||||
if(existingValue)
|
if(existingValue)
|
||||||
{
|
{
|
||||||
if(!this->HandleCacheEntry(*ni))
|
if(!this->HandleCacheEntry(*ni))
|
||||||
|
@ -479,20 +478,19 @@ 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();
|
cmState* state = this->Makefile->GetState();
|
||||||
if (this->Remove)
|
if (this->Remove)
|
||||||
{
|
{
|
||||||
manager->RemoveCacheEntryProperty(cacheKey, name);
|
state->RemoveCacheEntryProperty(cacheKey, name);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if(this->AppendMode)
|
if(this->AppendMode)
|
||||||
{
|
{
|
||||||
manager->AppendCacheEntryProperty(cacheKey, name, value,
|
state->AppendCacheEntryProperty(cacheKey, name, value,
|
||||||
this->AppendAsString);
|
this->AppendAsString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manager->SetCacheEntryProperty(cacheKey, name, value);
|
state->SetCacheEntryProperty(cacheKey, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -88,7 +88,7 @@ bool cmSiteNameCommand
|
||||||
AddCacheDefinition(args[0],
|
AddCacheDefinition(args[0],
|
||||||
siteName.c_str(),
|
siteName.c_str(),
|
||||||
"Name of the computer/site where compile is being run",
|
"Name of the computer/site where compile is being run",
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
/*============================================================================
|
||||||
|
CMake - Cross Platform Makefile Generator
|
||||||
|
Copyright 2015 Stephen Kelly <steveire@gmail.com>
|
||||||
|
|
||||||
|
Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
see accompanying file Copyright.txt for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the License for more information.
|
||||||
|
============================================================================*/
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
|
#include "cmake.h"
|
||||||
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
|
cmState::cmState(cmake* cm)
|
||||||
|
: CMakeInstance(cm)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* cmCacheEntryTypes[] =
|
||||||
|
{ "BOOL",
|
||||||
|
"PATH",
|
||||||
|
"FILEPATH",
|
||||||
|
"STRING",
|
||||||
|
"INTERNAL",
|
||||||
|
"STATIC",
|
||||||
|
"UNINITIALIZED",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
const char*
|
||||||
|
cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
|
||||||
|
{
|
||||||
|
if ( type > 6 )
|
||||||
|
{
|
||||||
|
return cmCacheEntryTypes[6];
|
||||||
|
}
|
||||||
|
return cmCacheEntryTypes[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
cmState::CacheEntryType
|
||||||
|
cmState::StringToCacheEntryType(const char* s)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(cmCacheEntryTypes[i])
|
||||||
|
{
|
||||||
|
if(strcmp(s, cmCacheEntryTypes[i]) == 0)
|
||||||
|
{
|
||||||
|
return static_cast<cmState::CacheEntryType>(i);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cmState::IsCacheEntryType(std::string const& key)
|
||||||
|
{
|
||||||
|
for(int i=0; cmCacheEntryTypes[i]; ++i)
|
||||||
|
{
|
||||||
|
if(strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> cmState::GetCacheEntryKeys() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> definitions;
|
||||||
|
definitions.reserve(this->CMakeInstance->GetCacheManager()->GetSize());
|
||||||
|
cmCacheManager::CacheIterator cit =
|
||||||
|
this->CMakeInstance->GetCacheManager()->GetCacheIterator();
|
||||||
|
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
|
||||||
|
{
|
||||||
|
definitions.push_back(cit.GetName());
|
||||||
|
}
|
||||||
|
return definitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* cmState::GetCacheEntryValue(std::string const& key) const
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheEntry* e = this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheEntry(key);
|
||||||
|
if (!e)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return e->Value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
cmState::GetInitializedCacheValue(std::string const& key) const
|
||||||
|
{
|
||||||
|
return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmState::CacheEntryType
|
||||||
|
cmState::GetCacheEntryType(std::string const& key) const
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it =
|
||||||
|
this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
|
||||||
|
return it.GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::SetCacheEntryValue(std::string const& key,
|
||||||
|
std::string const& value)
|
||||||
|
{
|
||||||
|
this->CMakeInstance->GetCacheManager()->SetCacheEntryValue(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::SetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName,
|
||||||
|
std::string const& value)
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it =
|
||||||
|
this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
|
||||||
|
it.SetProperty(propertyName, value.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::SetCacheEntryBoolProperty(std::string const& key,
|
||||||
|
std::string const& propertyName,
|
||||||
|
bool value)
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it =
|
||||||
|
this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
|
||||||
|
it.SetProperty(propertyName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* cmState::GetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName)
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it = this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheIterator(key.c_str());
|
||||||
|
if (!it.PropertyExists(propertyName))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return it.GetProperty(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
|
||||||
|
std::string const& propertyName)
|
||||||
|
{
|
||||||
|
return this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheIterator(key.c_str()).GetPropertyAsBool(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::AddCacheEntry(const std::string& key, const char* value,
|
||||||
|
const char* helpString,
|
||||||
|
cmState::CacheEntryType type)
|
||||||
|
{
|
||||||
|
this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value,
|
||||||
|
helpString, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::RemoveCacheEntry(std::string const& key)
|
||||||
|
{
|
||||||
|
this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::AppendCacheEntryProperty(const std::string& key,
|
||||||
|
const std::string& property,
|
||||||
|
const std::string& value,
|
||||||
|
bool asString)
|
||||||
|
{
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheIterator(key.c_str()).AppendProperty(property,
|
||||||
|
value.c_str(),
|
||||||
|
asString);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::RemoveCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName)
|
||||||
|
{
|
||||||
|
this->CMakeInstance->GetCacheManager()
|
||||||
|
->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*============================================================================
|
||||||
|
CMake - Cross Platform Makefile Generator
|
||||||
|
Copyright 2015 Stephen Kelly <steveire@gmail.com>
|
||||||
|
|
||||||
|
Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
see accompanying file Copyright.txt for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the License for more information.
|
||||||
|
============================================================================*/
|
||||||
|
#ifndef cmState_h
|
||||||
|
#define cmState_h
|
||||||
|
|
||||||
|
#include "cmStandardIncludes.h"
|
||||||
|
|
||||||
|
class cmake;
|
||||||
|
|
||||||
|
class cmState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cmState(cmake* cm);
|
||||||
|
|
||||||
|
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
|
||||||
|
UNINITIALIZED };
|
||||||
|
static CacheEntryType StringToCacheEntryType(const char*);
|
||||||
|
static const char* CacheEntryTypeToString(CacheEntryType);
|
||||||
|
static bool IsCacheEntryType(std::string const& key);
|
||||||
|
|
||||||
|
std::vector<std::string> GetCacheEntryKeys() const;
|
||||||
|
const char* GetCacheEntryValue(std::string const& key) const;
|
||||||
|
const char* GetInitializedCacheValue(std::string const& key) const;
|
||||||
|
CacheEntryType GetCacheEntryType(std::string const& key) const;
|
||||||
|
void SetCacheEntryValue(std::string const& key, std::string const& value);
|
||||||
|
void SetCacheValue(std::string const& key, std::string const& value);
|
||||||
|
|
||||||
|
void AddCacheEntry(const std::string& key, const char* value,
|
||||||
|
const char* helpString, CacheEntryType type);
|
||||||
|
void RemoveCacheEntry(std::string const& key);
|
||||||
|
|
||||||
|
void SetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName,
|
||||||
|
std::string const& value);
|
||||||
|
void SetCacheEntryBoolProperty(std::string const& key,
|
||||||
|
std::string const& propertyName,
|
||||||
|
bool value);
|
||||||
|
const char* GetCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName);
|
||||||
|
bool GetCacheEntryPropertyAsBool(std::string const& key,
|
||||||
|
std::string const& propertyName);
|
||||||
|
void AppendCacheEntryProperty(std::string const& key,
|
||||||
|
const std::string& property,
|
||||||
|
const std::string& value,
|
||||||
|
bool asString = false);
|
||||||
|
void RemoveCacheEntryProperty(std::string const& key,
|
||||||
|
std::string const& propertyName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
cmake* CMakeInstance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -1182,7 +1182,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf,
|
||||||
if (this->RecordDependencies)
|
if (this->RecordDependencies)
|
||||||
{
|
{
|
||||||
mf.AddCacheDefinition(depname, "",
|
mf.AddCacheDefinition(depname, "",
|
||||||
"Dependencies for target", cmCacheManager::STATIC);
|
"Dependencies for target", cmState::STATIC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1370,7 +1370,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
|
||||||
dependencies += ";";
|
dependencies += ";";
|
||||||
mf.AddCacheDefinition( targetEntry, dependencies.c_str(),
|
mf.AddCacheDefinition( targetEntry, dependencies.c_str(),
|
||||||
"Dependencies for the target",
|
"Dependencies for the target",
|
||||||
cmCacheManager::STATIC );
|
cmState::STATIC );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmTryRunCommand.h"
|
#include "cmTryRunCommand.h"
|
||||||
#include "cmCacheManager.h"
|
|
||||||
#include "cmTryCompileCommand.h"
|
#include "cmTryCompileCommand.h"
|
||||||
#include <cmsys/FStream.hxx>
|
#include <cmsys/FStream.hxx>
|
||||||
|
|
||||||
|
@ -239,7 +238,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
|
||||||
}
|
}
|
||||||
this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar,
|
this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar,
|
||||||
"Result of TRY_RUN",
|
"Result of TRY_RUN",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is only used when cross compiling. Instead of running the
|
/* This is only used when cross compiling. Instead of running the
|
||||||
|
@ -284,14 +283,14 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
this->Makefile->AddCacheDefinition(this->RunResultVariable,
|
this->Makefile->AddCacheDefinition(this->RunResultVariable,
|
||||||
"PLEASE_FILL_OUT-FAILED_TO_RUN",
|
"PLEASE_FILL_OUT-FAILED_TO_RUN",
|
||||||
comment.c_str(),
|
comment.c_str(),
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
|
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* existingValue
|
const char* existingValue
|
||||||
= manager->GetCacheEntryValue(this->RunResultVariable);
|
= state->GetCacheEntryValue(this->RunResultVariable);
|
||||||
if (existingValue)
|
if (existingValue)
|
||||||
{
|
{
|
||||||
manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
|
state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -312,13 +311,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
this->Makefile->AddCacheDefinition(internalRunOutputName,
|
this->Makefile->AddCacheDefinition(internalRunOutputName,
|
||||||
"PLEASE_FILL_OUT-NOTFOUND",
|
"PLEASE_FILL_OUT-NOTFOUND",
|
||||||
comment.c_str(),
|
comment.c_str(),
|
||||||
cmCacheManager::STRING);
|
cmState::STRING);
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* existing =
|
const char* existing =
|
||||||
manager->GetCacheEntryValue(internalRunOutputName);
|
state->GetCacheEntryValue(internalRunOutputName);
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
manager->SetCacheEntryProperty(internalRunOutputName,
|
state->SetCacheEntryProperty(internalRunOutputName,
|
||||||
"ADVANCED", "1");
|
"ADVANCED", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmUtilitySourceCommand.h"
|
#include "cmUtilitySourceCommand.h"
|
||||||
|
|
||||||
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
// cmUtilitySourceCommand
|
// cmUtilitySourceCommand
|
||||||
bool cmUtilitySourceCommand
|
bool cmUtilitySourceCommand
|
||||||
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
||||||
|
@ -118,14 +120,14 @@ bool cmUtilitySourceCommand
|
||||||
this->Makefile->AddCacheDefinition(cacheEntry,
|
this->Makefile->AddCacheDefinition(cacheEntry,
|
||||||
utilityExecutable.c_str(),
|
utilityExecutable.c_str(),
|
||||||
"Path to an internal program.",
|
"Path to an internal program.",
|
||||||
cmCacheManager::FILEPATH);
|
cmState::FILEPATH);
|
||||||
// add a value into the cache that maps from the
|
// add a value into the cache that maps from the
|
||||||
// full path to the name of the project
|
// full path to the name of the project
|
||||||
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
|
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
|
||||||
this->Makefile->AddCacheDefinition(utilityExecutable,
|
this->Makefile->AddCacheDefinition(utilityExecutable,
|
||||||
utilityName.c_str(),
|
utilityName.c_str(),
|
||||||
"Executable to project name.",
|
"Executable to project name.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
See the License for more information.
|
See the License for more information.
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmVariableRequiresCommand.h"
|
#include "cmVariableRequiresCommand.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmState.h"
|
||||||
|
|
||||||
// cmLibraryCommand
|
// cmLibraryCommand
|
||||||
bool cmVariableRequiresCommand
|
bool cmVariableRequiresCommand
|
||||||
|
@ -34,6 +34,7 @@ bool cmVariableRequiresCommand
|
||||||
bool requirementsMet = true;
|
bool requirementsMet = true;
|
||||||
std::string notSet;
|
std::string notSet;
|
||||||
bool hasAdvanced = false;
|
bool hasAdvanced = false;
|
||||||
|
cmState* state = this->Makefile->GetState();
|
||||||
for(unsigned int i = 2; i < args.size(); ++i)
|
for(unsigned int i = 2; i < args.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!this->Makefile->IsOn(args[i]))
|
if(!this->Makefile->IsOn(args[i]))
|
||||||
|
@ -41,9 +42,8 @@ bool cmVariableRequiresCommand
|
||||||
requirementsMet = false;
|
requirementsMet = false;
|
||||||
notSet += args[i];
|
notSet += args[i];
|
||||||
notSet += "\n";
|
notSet += "\n";
|
||||||
cmCacheManager* manager = this->Makefile->GetCacheManager();
|
if(state->GetCacheEntryValue(args[i]) &&
|
||||||
if(manager->GetCacheEntryValue(args[i]) &&
|
state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
|
||||||
manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
|
|
||||||
{
|
{
|
||||||
hasAdvanced = true;
|
hasAdvanced = true;
|
||||||
}
|
}
|
||||||
|
|
117
Source/cmake.cxx
117
Source/cmake.cxx
|
@ -21,6 +21,7 @@
|
||||||
#include "cmTest.h"
|
#include "cmTest.h"
|
||||||
#include "cmDocumentationFormatter.h"
|
#include "cmDocumentationFormatter.h"
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
# include "cmGraphVizWriter.h"
|
# include "cmGraphVizWriter.h"
|
||||||
|
@ -133,6 +134,8 @@ cmake::cmake()
|
||||||
this->FileComparison = new cmFileTimeComparison;
|
this->FileComparison = new cmFileTimeComparison;
|
||||||
|
|
||||||
this->Policies = new cmPolicies();
|
this->Policies = new cmPolicies();
|
||||||
|
this->State = new cmState(this);
|
||||||
|
|
||||||
this->InitializeProperties();
|
this->InitializeProperties();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -171,6 +174,7 @@ cmake::~cmake()
|
||||||
{
|
{
|
||||||
delete this->CacheManager;
|
delete this->CacheManager;
|
||||||
delete this->Policies;
|
delete this->Policies;
|
||||||
|
delete this->State;
|
||||||
if (this->GlobalGenerator)
|
if (this->GlobalGenerator)
|
||||||
{
|
{
|
||||||
delete this->GlobalGenerator;
|
delete this->GlobalGenerator;
|
||||||
|
@ -332,7 +336,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string var, value;
|
std::string var, value;
|
||||||
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
|
cmState::CacheEntryType type = cmState::UNINITIALIZED;
|
||||||
if(cmCacheManager::ParseEntry(entry, var, value, type))
|
if(cmCacheManager::ParseEntry(entry, var, value, type))
|
||||||
{
|
{
|
||||||
// The value is transformed if it is a filepath for example, so
|
// The value is transformed if it is a filepath for example, so
|
||||||
|
@ -342,22 +346,20 @@ 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
|
if(const char *v = this->State->GetInitializedCacheValue(var))
|
||||||
->GetInitializedCacheValue(var))
|
|
||||||
{
|
{
|
||||||
haveValue = true;
|
haveValue = true;
|
||||||
cachedValue = v;
|
cachedValue = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->CacheManager->AddCacheEntry(var, value.c_str(),
|
this->State->AddCacheEntry(var, value.c_str(),
|
||||||
"No help, variable specified on the command line.", type);
|
"No help, variable specified on the command line.", type);
|
||||||
|
|
||||||
if(this->WarnUnusedCli)
|
if(this->WarnUnusedCli)
|
||||||
{
|
{
|
||||||
if (!haveValue ||
|
if (!haveValue ||
|
||||||
cachedValue != this->CacheManager
|
cachedValue != this->State->GetInitializedCacheValue(var))
|
||||||
->GetInitializedCacheValue(var))
|
|
||||||
{
|
{
|
||||||
this->WatchUnusedCli(var);
|
this->WatchUnusedCli(var);
|
||||||
}
|
}
|
||||||
|
@ -401,14 +403,12 @@ 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;
|
||||||
std::vector<std::string> cacheKeys =
|
std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
|
||||||
this->CacheManager->GetCacheEntryKeys();
|
|
||||||
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
||||||
it != cacheKeys.end(); ++it)
|
it != cacheKeys.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t =
|
cmState::CacheEntryType t = this->State->GetCacheEntryType(*it);
|
||||||
this->CacheManager->GetCacheEntryType(*it);
|
if(t != cmState::STATIC)
|
||||||
if(t != cmCacheManager::STATIC)
|
|
||||||
{
|
{
|
||||||
if (regex.find(it->c_str()))
|
if (regex.find(it->c_str()))
|
||||||
{
|
{
|
||||||
|
@ -423,7 +423,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
currentEntry != entriesToDelete.end();
|
currentEntry != entriesToDelete.end();
|
||||||
++currentEntry)
|
++currentEntry)
|
||||||
{
|
{
|
||||||
this->CacheManager->RemoveCacheEntry(*currentEntry);
|
this->State->RemoveCacheEntry(*currentEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(arg.find("-C",0) == 0)
|
else if(arg.find("-C",0) == 0)
|
||||||
|
@ -917,7 +917,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
|
||||||
if(this->LoadCache(cachePath))
|
if(this->LoadCache(cachePath))
|
||||||
{
|
{
|
||||||
const char* existingValue =
|
const char* existingValue =
|
||||||
this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||||
if (existingValue)
|
if (existingValue)
|
||||||
{
|
{
|
||||||
this->SetHomeOutputDirectory(cachePath);
|
this->SetHomeOutputDirectory(cachePath);
|
||||||
|
@ -971,14 +971,14 @@ int cmake::AddCMakePaths()
|
||||||
// Save the value in the cache
|
// Save the value in the cache
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(),
|
("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(),
|
||||||
"Path to CMake executable.", cmCacheManager::INTERNAL);
|
"Path to CMake executable.", cmState::INTERNAL);
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
|
("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
|
||||||
"Path to ctest program executable.", cmCacheManager::INTERNAL);
|
"Path to ctest program executable.", cmState::INTERNAL);
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
|
("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
|
||||||
"Path to cpack program executable.", cmCacheManager::INTERNAL);
|
"Path to cpack program executable.", cmState::INTERNAL);
|
||||||
#endif
|
#endif
|
||||||
if(!cmSystemTools::FileExists(
|
if(!cmSystemTools::FileExists(
|
||||||
(cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str()))
|
(cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str()))
|
||||||
|
@ -992,7 +992,7 @@ int cmake::AddCMakePaths()
|
||||||
}
|
}
|
||||||
this->CacheManager->AddCacheEntry
|
this->CacheManager->AddCacheEntry
|
||||||
("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
|
("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
|
||||||
"Path to CMake installation.", cmCacheManager::INTERNAL);
|
"Path to CMake installation.", cmState::INTERNAL);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1266,7 +1266,7 @@ struct SaveCacheEntry
|
||||||
std::string key;
|
std::string key;
|
||||||
std::string value;
|
std::string value;
|
||||||
std::string help;
|
std::string help;
|
||||||
cmCacheManager::CacheEntryType type;
|
cmState::CacheEntryType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
int cmake::HandleDeleteCacheVariables(const std::string& var)
|
int cmake::HandleDeleteCacheVariables(const std::string& var)
|
||||||
|
@ -1279,7 +1279,6 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
|
|
||||||
std::vector<SaveCacheEntry> saved;
|
std::vector<SaveCacheEntry> saved;
|
||||||
std::ostringstream warning;
|
std::ostringstream warning;
|
||||||
warning
|
warning
|
||||||
|
@ -1295,10 +1294,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
|
||||||
i++;
|
i++;
|
||||||
save.value = *i;
|
save.value = *i;
|
||||||
warning << *i << "\n";
|
warning << *i << "\n";
|
||||||
if(ci.Find(save.key))
|
const char* existingValue =
|
||||||
|
this->CacheManager->GetCacheEntryValue(save.key);
|
||||||
|
if(existingValue)
|
||||||
{
|
{
|
||||||
save.type = ci.GetType();
|
save.type = this->CacheManager->GetCacheEntryType(save.key);
|
||||||
if(const char* help = ci.GetProperty("HELPSTRING"))
|
if(const char* help =
|
||||||
|
this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING"))
|
||||||
{
|
{
|
||||||
save.help = help;
|
save.help = help;
|
||||||
}
|
}
|
||||||
|
@ -1337,7 +1339,7 @@ int cmake::Configure()
|
||||||
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE",
|
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE",
|
||||||
"Suppress Warnings that are meant for"
|
"Suppress Warnings that are meant for"
|
||||||
" the author of the CMakeLists.txt files.",
|
" the author of the CMakeLists.txt files.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1345,7 +1347,7 @@ int cmake::Configure()
|
||||||
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE",
|
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE",
|
||||||
"Suppress Warnings that are meant for"
|
"Suppress Warnings that are meant for"
|
||||||
" the author of the CMakeLists.txt files.",
|
" the author of the CMakeLists.txt files.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int ret = this->ActualConfigure();
|
int ret = this->ActualConfigure();
|
||||||
|
@ -1381,7 +1383,7 @@ int cmake::ActualConfigure()
|
||||||
this->GetHomeDirectory(),
|
this->GetHomeDirectory(),
|
||||||
"Start directory with the top level CMakeLists.txt file for this "
|
"Start directory with the top level CMakeLists.txt file for this "
|
||||||
"project",
|
"project",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no generator specified on the command line
|
// no generator specified on the command line
|
||||||
|
@ -1490,11 +1492,11 @@ int cmake::ActualConfigure()
|
||||||
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
|
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
|
||||||
this->GlobalGenerator->GetName().c_str(),
|
this->GlobalGenerator->GetName().c_str(),
|
||||||
"Name of generator.",
|
"Name of generator.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
|
this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
|
||||||
this->GlobalGenerator->GetExtraGeneratorName().c_str(),
|
this->GlobalGenerator->GetExtraGeneratorName().c_str(),
|
||||||
"Name of external makefile project generator.",
|
"Name of external makefile project generator.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* platformName =
|
if(const char* platformName =
|
||||||
|
@ -1522,7 +1524,7 @@ int cmake::ActualConfigure()
|
||||||
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
|
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
|
||||||
this->GeneratorPlatform.c_str(),
|
this->GeneratorPlatform.c_str(),
|
||||||
"Name of generator platform.",
|
"Name of generator platform.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* tsName =
|
if(const char* tsName =
|
||||||
|
@ -1550,7 +1552,7 @@ int cmake::ActualConfigure()
|
||||||
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
|
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
|
||||||
this->GeneratorToolset.c_str(),
|
this->GeneratorToolset.c_str(),
|
||||||
"Name of generator toolset.",
|
"Name of generator toolset.",
|
||||||
cmCacheManager::INTERNAL);
|
cmState::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset any system configuration information, except for when we are
|
// reset any system configuration information, except for when we are
|
||||||
|
@ -1576,49 +1578,51 @@ 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()
|
if(this->State
|
||||||
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
||||||
{
|
{
|
||||||
if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
|
if(!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry
|
this->State->AddCacheEntry
|
||||||
("LIBRARY_OUTPUT_PATH", "",
|
("LIBRARY_OUTPUT_PATH", "",
|
||||||
"Single output directory for building all libraries.",
|
"Single output directory for building all libraries.",
|
||||||
cmCacheManager::PATH);
|
cmState::PATH);
|
||||||
}
|
}
|
||||||
if(!this->CacheManager
|
if(!this->State
|
||||||
->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry
|
this->State->AddCacheEntry
|
||||||
("EXECUTABLE_OUTPUT_PATH", "",
|
("EXECUTABLE_OUTPUT_PATH", "",
|
||||||
"Single output directory for building all executables.",
|
"Single output directory for building all executables.",
|
||||||
cmCacheManager::PATH);
|
cmState::PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!this->CacheManager
|
if(!this->State
|
||||||
->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry
|
this->State->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);
|
cmState::BOOL);
|
||||||
if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
||||||
"ADVANCED"))
|
"ADVANCED"))
|
||||||
{
|
{
|
||||||
this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
|
||||||
"ADVANCED", "1");
|
"ADVANCED", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmSystemTools::GetFatalErrorOccured() &&
|
if(cmSystemTools::GetFatalErrorOccured())
|
||||||
(!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") ||
|
{
|
||||||
cmSystemTools::IsOff(this->CacheManager->
|
const char* makeProgram =
|
||||||
GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"))))
|
this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM");
|
||||||
|
if (!makeProgram || cmSystemTools::IsOff(makeProgram))
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR");
|
this->State->RemoveCacheEntry("CMAKE_GENERATOR");
|
||||||
this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
|
this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
|
cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
|
||||||
|
@ -1824,7 +1828,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
|
||||||
{
|
{
|
||||||
this->CacheManager->AddCacheEntry(key, value,
|
this->CacheManager->AddCacheEntry(key, value,
|
||||||
helpString,
|
helpString,
|
||||||
cmCacheManager::CacheEntryType(type));
|
cmState::CacheEntryType(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmake::GetCacheDefinition(const std::string& name) const
|
const char* cmake::GetCacheDefinition(const std::string& name) const
|
||||||
|
@ -1896,7 +1900,7 @@ void cmake::AddDefaultGenerators()
|
||||||
bool cmake::ParseCacheEntry(const std::string& entry,
|
bool cmake::ParseCacheEntry(const std::string& entry,
|
||||||
std::string& var,
|
std::string& var,
|
||||||
std::string& value,
|
std::string& value,
|
||||||
cmCacheManager::CacheEntryType& type)
|
cmState::CacheEntryType& type)
|
||||||
{
|
{
|
||||||
return cmCacheManager::ParseEntry(entry, var, value, type);
|
return cmCacheManager::ParseEntry(entry, var, value, type);
|
||||||
}
|
}
|
||||||
|
@ -2246,7 +2250,7 @@ void cmake::TruncateOutputLog(const char* fname)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") )
|
if (!this->State->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"))
|
||||||
{
|
{
|
||||||
cmSystemTools::RemoveFile(fullPath);
|
cmSystemTools::RemoveFile(fullPath);
|
||||||
return;
|
return;
|
||||||
|
@ -2351,8 +2355,7 @@ const char *cmake::GetProperty(const std::string& prop,
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
if ( prop == "CACHE_VARIABLES" )
|
if ( prop == "CACHE_VARIABLES" )
|
||||||
{
|
{
|
||||||
std::vector<std::string> cacheKeys =
|
std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
|
||||||
this->CacheManager->GetCacheEntryKeys();
|
|
||||||
this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
|
this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
|
||||||
}
|
}
|
||||||
else if ( prop == "COMMANDS" )
|
else if ( prop == "COMMANDS" )
|
||||||
|
@ -2507,7 +2510,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->GetInitializedCacheValue("CMAKE_ROOT");
|
this->State->GetInitializedCacheValue("CMAKE_ROOT");
|
||||||
modulesPath += "/Modules";
|
modulesPath += "/Modules";
|
||||||
std::string inFile = modulesPath;
|
std::string inFile = modulesPath;
|
||||||
inFile += "/SystemInformation.cmake";
|
inFile += "/SystemInformation.cmake";
|
||||||
|
@ -2717,7 +2720,7 @@ 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.
|
||||||
const char* suppress = this->CacheManager->GetCacheEntryValue(
|
const char* suppress = this->State->GetCacheEntryValue(
|
||||||
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
|
||||||
if(suppress && cmSystemTools::IsOn(suppress))
|
if(suppress && cmSystemTools::IsOn(suppress))
|
||||||
{
|
{
|
||||||
|
@ -2835,7 +2838,7 @@ int cmake::Build(const std::string& dir,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const char* cachedGenerator =
|
const char* cachedGenerator =
|
||||||
this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR");
|
this->State->GetCacheEntryValue("CMAKE_GENERATOR");
|
||||||
if(!cachedGenerator)
|
if(!cachedGenerator)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
||||||
|
@ -2852,7 +2855,7 @@ int cmake::Build(const std::string& dir,
|
||||||
std::string output;
|
std::string output;
|
||||||
std::string projName;
|
std::string projName;
|
||||||
const char* cachedProjectName =
|
const char* cachedProjectName =
|
||||||
this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME");
|
this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
|
||||||
if(!cachedProjectName)
|
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";
|
||||||
|
@ -2861,7 +2864,7 @@ int cmake::Build(const std::string& dir,
|
||||||
projName = cachedProjectName;
|
projName = cachedProjectName;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
const char* cachedVerbose =
|
const char* cachedVerbose =
|
||||||
this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
|
this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
|
||||||
if(cachedVerbose)
|
if(cachedVerbose)
|
||||||
{
|
{
|
||||||
verbose = cmSystemTools::IsOn(cachedVerbose);
|
verbose = cmSystemTools::IsOn(cachedVerbose);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "cmPropertyMap.h"
|
#include "cmPropertyMap.h"
|
||||||
#include "cmInstalledFile.h"
|
#include "cmInstalledFile.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
class cmGlobalGeneratorFactory;
|
class cmGlobalGeneratorFactory;
|
||||||
class cmGlobalGenerator;
|
class cmGlobalGenerator;
|
||||||
|
@ -32,6 +33,7 @@ class cmDocumentationSection;
|
||||||
class cmPolicies;
|
class cmPolicies;
|
||||||
class cmTarget;
|
class cmTarget;
|
||||||
class cmGeneratedFileStream;
|
class cmGeneratedFileStream;
|
||||||
|
class cmState;
|
||||||
|
|
||||||
/** \brief Represents a cmake invocation.
|
/** \brief Represents a cmake invocation.
|
||||||
*
|
*
|
||||||
|
@ -157,7 +159,7 @@ class cmake
|
||||||
static bool ParseCacheEntry(const std::string& entry,
|
static bool ParseCacheEntry(const std::string& entry,
|
||||||
std::string& var,
|
std::string& var,
|
||||||
std::string& value,
|
std::string& value,
|
||||||
cmCacheManager::CacheEntryType& type);
|
cmState::CacheEntryType& type);
|
||||||
|
|
||||||
int LoadCache();
|
int LoadCache();
|
||||||
bool LoadCache(const std::string& path);
|
bool LoadCache(const std::string& path);
|
||||||
|
@ -362,6 +364,9 @@ class cmake
|
||||||
|
|
||||||
void UnwatchUnusedCli(const std::string& var);
|
void UnwatchUnusedCli(const std::string& var);
|
||||||
void WatchUnusedCli(const std::string& var);
|
void WatchUnusedCli(const std::string& var);
|
||||||
|
|
||||||
|
cmState* GetState() const { return this->State; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void RunCheckForUnusedVariables();
|
void RunCheckForUnusedVariables();
|
||||||
void InitializeProperties();
|
void InitializeProperties();
|
||||||
|
@ -449,6 +454,8 @@ private:
|
||||||
std::string GraphVizFile;
|
std::string GraphVizFile;
|
||||||
InstalledFilesMap InstalledFiles;
|
InstalledFilesMap InstalledFiles;
|
||||||
|
|
||||||
|
cmState* State;
|
||||||
|
|
||||||
void UpdateConversionPathTable();
|
void UpdateConversionPathTable();
|
||||||
|
|
||||||
// Print a list of valid generators to stderr.
|
// Print a list of valid generators to stderr.
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmcmd.h"
|
#include "cmcmd.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmState.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
|
@ -329,29 +329,27 @@ int do_cmake(int ac, char const* const* av)
|
||||||
if ( list_cached || list_all_cached )
|
if ( list_cached || list_all_cached )
|
||||||
{
|
{
|
||||||
std::cout << "-- Cache values" << std::endl;
|
std::cout << "-- Cache values" << std::endl;
|
||||||
std::vector<std::string> keys =
|
std::vector<std::string> keys = cm.GetState()->GetCacheEntryKeys();
|
||||||
cm.GetCacheManager()->GetCacheEntryKeys();
|
|
||||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||||
it != keys.end(); ++it)
|
it != keys.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t =
|
cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it);
|
||||||
cm.GetCacheManager()->GetCacheEntryType(*it);
|
if (t != cmState::INTERNAL && t != cmState::STATIC &&
|
||||||
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
|
t != cmState::UNINITIALIZED)
|
||||||
t != cmCacheManager::UNINITIALIZED )
|
|
||||||
{
|
{
|
||||||
const char* advancedProp =
|
const char* advancedProp =
|
||||||
cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED");
|
cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED");
|
||||||
if ( list_all_cached || !advancedProp)
|
if ( list_all_cached || !advancedProp)
|
||||||
{
|
{
|
||||||
if ( list_help )
|
if ( list_help )
|
||||||
{
|
{
|
||||||
std::cout << "// "
|
std::cout << "// "
|
||||||
<< cm.GetCacheManager()->GetCacheEntryProperty(*it,
|
<< cm.GetState()->GetCacheEntryProperty(*it,
|
||||||
"HELPSTRING") << std::endl;
|
"HELPSTRING") << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << *it << ":" <<
|
std::cout << *it << ":" <<
|
||||||
cmCacheManager::TypeToString(t)
|
cmState::CacheEntryTypeToString(t)
|
||||||
<< "=" << cm.GetCacheManager()->GetCacheEntryValue(*it)
|
<< "=" << cm.GetState()->GetCacheEntryValue(*it)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
if ( list_help )
|
if ( list_help )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue