BUG: fix build directory problem

This commit is contained in:
Bill Hoffman 2001-04-24 12:40:37 -04:00
parent 435a8a7033
commit 818b0e5bc1
8 changed files with 71 additions and 16 deletions

View File

@ -365,11 +365,11 @@ void CMakeSetupDialog::LoadFromRegistry()
void CMakeSetupDialog::OnBuildProjects() void CMakeSetupDialog::OnBuildProjects()
{ {
// get all the info from the screen
this->UpdateData();
::SetCursor(LoadCursor(NULL, IDC_WAIT)); ::SetCursor(LoadCursor(NULL, IDC_WAIT));
// copy the GUI cache values into the cache manager // copy the GUI cache values into the cache manager
this->FillCacheManagerFromCacheEditor(); this->FillCacheManagerFromCacheEditor();
// get all the info from the screen
this->UpdateData();
CString makefileIn = m_WhereSource; CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt"; makefileIn += "/CMakeLists.txt";
m_Makefile.ReadListFile(makefileIn); m_Makefile.ReadListFile(makefileIn);
@ -397,9 +397,18 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
switch(value.m_Type ) switch(value.m_Type )
{ {
case cmCacheManager::BOOL: case cmCacheManager::BOOL:
m_CacheEntriesList.AddProperty(key, if(cmCacheManager::GetInstance()->IsOn(value.m_Value.c_str()))
value.m_Value.c_str(), {
PIT_CHECKBOX,""); m_CacheEntriesList.AddProperty(key,
"ON",
PIT_CHECKBOX,"");
}
else
{
m_CacheEntriesList.AddProperty(key,
"OFF",
PIT_CHECKBOX,"");
}
break; break;
case cmCacheManager::PATH: case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),

View File

@ -24,13 +24,14 @@ bool cmBuildSharedLibrariesCommand::Invoke(std::vector<std::string>& args)
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS"); = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
if(!cacheValue) if(!cacheValue)
{ {
cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS","0", cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS",false);
cmCacheManager::BOOL); m_Makefile->AddDefinition("BUILD_SHARED_LIBS", false);
m_Makefile->AddDefinition("BUILD_SHARED_LIBS", "0");
} }
else else
{ {
m_Makefile->AddDefinition("BUILD_SHARED_LIBS", cacheValue); m_Makefile->AddDefinition("BUILD_SHARED_LIBS",
cmCacheManager::
GetInstance()->IsOn("BUILD_SHARED_LIBS"));
} }
return true; return true;
} }

View File

@ -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) void cmCacheManager::PrintCache(std::ostream& out)
{ {
out << "=================================================" << std::endl; 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);
}
}

View File

@ -48,6 +48,7 @@ public:
//! Singleton pattern get instance of the cmCacheManager. //! Singleton pattern get instance of the cmCacheManager.
static cmCacheManager* GetInstance(); static cmCacheManager* GetInstance();
//! Load a cache for given makefile. Loads from ouput home. //! Load a cache for given makefile. Loads from ouput home.
bool LoadCache(cmMakefile*); bool LoadCache(cmMakefile*);
@ -57,11 +58,17 @@ public:
//! Add an entry into the cache //! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, CacheEntryType type); 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 //! Remove an entry from the cache
void RemoveCacheEntry(const char* key); void RemoveCacheEntry(const char* key);
//! Get a value from the cache given a key //! Get a value from the cache given a key
const char* GetCacheValue(const char* 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 //! Print the cache to a stream
void PrintCache(std::ostream&); void PrintCache(std::ostream&);

View File

@ -361,6 +361,17 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
{ {
m_Definitions.insert(DefinitionMap::value_type(name, 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) void cmMakefile::SetProjectName(const char* p)
{ {

View File

@ -144,6 +144,11 @@ public:
*/ */
void AddDefinition(const char* name, const char* value); 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. * Specify the name of the project for this build.
*/ */

View File

@ -30,8 +30,7 @@ bool cmOptionCommand::Invoke(std::vector<std::string>& args)
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str()); = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
if(!cacheValue) if(!cacheValue)
{ {
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),"0", cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),false);
cmCacheManager::BOOL);
m_Makefile->AddDefinition(args[0].c_str(), "0"); m_Makefile->AddDefinition(args[0].c_str(), "0");
} }
else else

View File

@ -26,9 +26,7 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
// 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
const char* cacheValue if(!cmCacheManager::GetInstance()->IsOn("WRAP_TCL"))
= cmCacheManager::GetInstance()->GetCacheValue("WRAP_TCL");
if(!cacheValue || !strcmp(cacheValue,"0"))
{ {
return true; return true;
} }