summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-11-21 16:32:39 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2008-11-21 16:32:39 -0500
commit0c24570ee429c9884fdbf9ba0dd5e55133114432 (patch)
tree5ab4825243b670e57a05d1bffa4de5f0ddc8387a
parent46b9a884ac01aeb7fc0e6b5eb92a1624536eb4ee (diff)
downloadcmake-0c24570ee429c9884fdbf9ba0dd5e55133114432.tar.gz
BUG: fix issue with -D and cache force
-rw-r--r--Source/cmMakefile.cxx10
-rw-r--r--Source/cmMakefile.h3
-rw-r--r--Source/cmSetCommand.cxx2
3 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 168afdec0f..424ca00143 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1561,7 +1561,8 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
void cmMakefile::AddCacheDefinition(const char* name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type)
+ cmCacheManager::CacheEntryType type,
+ bool force)
{
const char* val = value;
cmCacheManager::CacheIterator it =
@@ -1569,7 +1570,12 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
it.Initialized())
{
- val = it.GetValue();
+ // 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(!force)
+ {
+ val = it.GetValue();
+ }
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
{
std::vector<std::string>::size_type cc;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 971496d478..5a12d2edce 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -264,7 +264,8 @@ public:
///! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const char* name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type);
+ cmCacheManager::CacheEntryType type,
+ bool force = false);
/**
* Add bool variable definition to the build.
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5939990503..1be75cee49 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -171,7 +171,7 @@ bool cmSetCommand
this->Makefile->AddCacheDefinition(variable,
value.c_str(),
docstring,
- type);
+ type, force);
}
else
{