Commit 818b0e5b authored by Bill Hoffman's avatar Bill Hoffman
Browse files

BUG: fix build directory problem

parent 435a8a70
......@@ -365,11 +365,11 @@ void CMakeSetupDialog::LoadFromRegistry()
void CMakeSetupDialog::OnBuildProjects()
{
// get all the info from the screen
this->UpdateData();
::SetCursor(LoadCursor(NULL, IDC_WAIT));
// copy the GUI cache values into the cache manager
this->FillCacheManagerFromCacheEditor();
// get all the info from the screen
this->UpdateData();
CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt";
m_Makefile.ReadListFile(makefileIn);
......@@ -397,9 +397,18 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
switch(value.m_Type )
{
case cmCacheManager::BOOL:
m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(),
PIT_CHECKBOX,"");
if(cmCacheManager::GetInstance()->IsOn(value.m_Value.c_str()))
{
m_CacheEntriesList.AddProperty(key,
"ON",
PIT_CHECKBOX,"");
}
else
{
m_CacheEntriesList.AddProperty(key,
"OFF",
PIT_CHECKBOX,"");
}
break;
case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
......
......@@ -24,13 +24,14 @@ bool cmBuildSharedLibrariesCommand::Invoke(std::vector<std::string>& args)
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
if(!cacheValue)
{
cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS","0",
cmCacheManager::BOOL);
m_Makefile->AddDefinition("BUILD_SHARED_LIBS", "0");
cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS",false);
m_Makefile->AddDefinition("BUILD_SHARED_LIBS", false);
}
else
{
m_Makefile->AddDefinition("BUILD_SHARED_LIBS", cacheValue);
m_Makefile->AddDefinition("BUILD_SHARED_LIBS",
cmCacheManager::
GetInstance()->IsOn("BUILD_SHARED_LIBS"));
}
return true;
}
......@@ -151,7 +151,7 @@ void cmCacheManager::AddCacheEntry(const char* key,
m_Cache[key] = e;
}
const char* cmCacheManager::GetCacheValue(const char* key)
const char* cmCacheManager::GetCacheValue(const char* key)
{
if(m_Cache.count(key))
{
......@@ -161,6 +161,19 @@ const char* cmCacheManager::GetCacheValue(const char* key)
}
bool cmCacheManager::IsOn(const char* key)
{
if(!m_Cache.count(key))
{
return false;
}
std::string &v = m_Cache[key].m_Value;
return (v == "ON" || v == "on" || v == "1" || v == "true" || v == "yev"
|| v == "TRUE" || v == "True" || v == "y" || v == "Y");
}
void cmCacheManager::PrintCache(std::ostream& out)
{
out << "=================================================" << std::endl;
......@@ -176,3 +189,15 @@ void cmCacheManager::PrintCache(std::ostream& out)
}
void cmCacheManager::AddCacheEntry(const char* key, bool v)
{
if(v)
{
this->AddCacheEntry(key, "ON", cmCacheManager::BOOL);
}
else
{
this->AddCacheEntry(key, "OFF", cmCacheManager::BOOL);
}
}
......@@ -48,6 +48,7 @@ public:
//! Singleton pattern get instance of the cmCacheManager.
static cmCacheManager* GetInstance();
//! Load a cache for given makefile. Loads from ouput home.
bool LoadCache(cmMakefile*);
......@@ -56,12 +57,18 @@ public:
//! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, CacheEntryType type);
//! Add a BOOL entry into the cache
void AddCacheEntry(const char* key, bool);
//! Remove an entry from the cache
void RemoveCacheEntry(const char* key);
//! Get a value from the cache given a key
const char* GetCacheValue(const char* key);
//! Test a boolean cache entry to see if it is true or false, returns false
// if no entry.
bool IsOn(const char*);
//! Print the cache to a stream
void PrintCache(std::ostream&);
......
......@@ -361,6 +361,17 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
{
m_Definitions.insert(DefinitionMap::value_type(name, value));
}
void cmMakefile::AddDefinition(const char* name, bool value)
{
if(value)
{
m_Definitions.insert(DefinitionMap::value_type(name, "ON"));
}
else
{
m_Definitions.insert(DefinitionMap::value_type(name, "OFF"));
}
}
void cmMakefile::SetProjectName(const char* p)
{
......
......@@ -144,6 +144,11 @@ public:
*/
void AddDefinition(const char* name, const char* value);
/**
* Add bool variable definition to the build.
*/
void AddDefinition(const char* name, bool);
/**
* Specify the name of the project for this build.
*/
......
......@@ -30,8 +30,7 @@ bool cmOptionCommand::Invoke(std::vector<std::string>& args)
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
if(!cacheValue)
{
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),"0",
cmCacheManager::BOOL);
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),false);
m_Makefile->AddDefinition(args[0].c_str(), "0");
}
else
......
......@@ -26,13 +26,11 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
// 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
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("WRAP_TCL");
if(!cacheValue || !strcmp(cacheValue,"0"))
if(!cmCacheManager::GetInstance()->IsOn("WRAP_TCL"))
{
return true;
}
// add in a depend in the vtkWrapTcl executable
m_Makefile->AddUtility("vtkWrapTcl");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment