summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp19
-rw-r--r--Source/cmBuildSharedLibrariesCommand.cxx9
-rw-r--r--Source/cmCacheManager.cxx27
-rw-r--r--Source/cmCacheManager.h7
-rw-r--r--Source/cmMakefile.cxx11
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmOptionCommand.cxx3
-rw-r--r--Source/cmWrapTclCommand.cxx6
8 files changed, 71 insertions, 16 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index 64bbde9..9d55322 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -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(),
diff --git a/Source/cmBuildSharedLibrariesCommand.cxx b/Source/cmBuildSharedLibrariesCommand.cxx
index e0f04f6..2599c18 100644
--- a/Source/cmBuildSharedLibrariesCommand.cxx
+++ b/Source/cmBuildSharedLibrariesCommand.cxx
@@ -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;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 90cfd3d..fb84d74 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -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);
+ }
+}
+
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f5ded99..2da1817 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -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&);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4dd27b4..eca4f39 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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)
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 604a9ed..ffcbd01 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -145,6 +145,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.
*/
void SetProjectName(const char*);
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 662599f..1ce0d58 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -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
diff --git a/Source/cmWrapTclCommand.cxx b/Source/cmWrapTclCommand.cxx
index c88b486..063fd8e 100644
--- a/Source/cmWrapTclCommand.cxx
+++ b/Source/cmWrapTclCommand.cxx
@@ -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");