summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmCacheManager.cxx12
-rw-r--r--Source/cmCacheManager.h6
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmProperty.cxx4
-rw-r--r--Source/cmProperty.h2
-rw-r--r--Source/cmPropertyMap.cxx4
-rw-r--r--Source/cmPropertyMap.h2
-rw-r--r--Source/cmSetPropertyCommand.cxx20
-rw-r--r--Source/cmSetPropertyCommand.h6
-rw-r--r--Source/cmSourceFile.cxx6
-rw-r--r--Source/cmSourceFile.h2
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmTest.cxx4
-rw-r--r--Source/cmTest.h2
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Source/cmake.h2
-rw-r--r--Tests/Properties/CMakeLists.txt18
19 files changed, 73 insertions, 35 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index c8374db..ab0bb79 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -849,7 +849,8 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop,
//----------------------------------------------------------------------------
void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
- const char* value)
+ const char* value,
+ bool asString)
{
if(strcmp(prop, "TYPE") == 0)
{
@@ -859,7 +860,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
{
if(value)
{
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
@@ -868,7 +869,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
}
else
{
- this->Properties.AppendProperty(prop, value, cmProperty::CACHE);
+ this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString);
}
}
@@ -893,11 +894,12 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
//----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::AppendProperty(const char* p,
- const char* v)
+ const char* v,
+ bool asString)
{
if(!this->IsAtEnd())
{
- this->GetEntry().AppendProperty(p, v);
+ this->GetEntry().AppendProperty(p, v, asString);
}
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 314017b..9c94d21 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -41,7 +41,8 @@ private:
cmPropertyMap Properties;
const char* GetProperty(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
bool Initialized;
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
{}
@@ -61,7 +62,8 @@ public:
bool GetPropertyAsBool(const char*) const ;
bool PropertyExists(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
void SetProperty(const char* property, bool value);
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 63bf03b..e215115 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3332,7 +3332,8 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
}
-void cmMakefile::AppendProperty(const char* prop, const char* value)
+void cmMakefile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
@@ -3365,7 +3366,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value)
return;
}
- this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY);
+ this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
}
const char *cmMakefile::GetPropertyOrDefinition(const char* prop)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1c1aef3..c01bb5d 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -799,7 +799,7 @@ public:
///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetPropertyOrDefinition(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 166bd00..3b37cf3 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -19,10 +19,10 @@ void cmProperty::Set(const char *name, const char *value)
this->ValueHasBeenSet = true;
}
-void cmProperty::Append(const char *name, const char *value)
+void cmProperty::Append(const char *name, const char *value, bool asString)
{
this->Name = name;
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 71bd1e7..e0fcd63 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -24,7 +24,7 @@ public:
void Set(const char *name, const char *value);
// append to this property
- void Append(const char *name, const char *value);
+ void Append(const char *name, const char *value, bool asString = false);
// get the value
const char *GetValue() const;
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 052b811..a4d0bf3 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -59,7 +59,7 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
}
void cmPropertyMap::AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope, bool asString)
{
// Skip if nothing to append.
if(!name || !value || !*value)
@@ -81,7 +81,7 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
#endif
cmProperty *prop = this->GetOrCreateProperty(name);
- prop->Append(name,value);
+ prop->Append(name,value,asString);
}
const char *cmPropertyMap
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 02fb060..94275e2 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -25,7 +25,7 @@ public:
cmProperty::ScopeType scope);
void AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope);
+ cmProperty::ScopeType scope, bool asString=false);
const char *GetPropertyValue(const char *name,
cmProperty::ScopeType scope,
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 3a4773c..cc10840 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -20,6 +20,7 @@
cmSetPropertyCommand::cmSetPropertyCommand()
{
this->AppendMode = false;
+ this->AppendAsString = false;
this->Remove = true;
}
@@ -83,6 +84,13 @@ bool cmSetPropertyCommand
{
doing = DoingNone;
this->AppendMode = true;
+ this->AppendAsString = false;
+ }
+ else if(*arg == "APPEND_STRING")
+ {
+ doing = DoingNone;
+ this->AppendMode = true;
+ this->AppendAsString = true;
}
else if(doing == DoingNames)
{
@@ -152,7 +160,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
}
if(this->AppendMode)
{
- cm->AppendProperty(name, value);
+ cm->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -218,7 +226,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
}
if(this->AppendMode)
{
- mf->AppendProperty(name, value);
+ mf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -266,7 +274,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
}
if(this->AppendMode)
{
- target->AppendProperty(name, value);
+ target->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -317,7 +325,7 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
if(this->AppendMode)
{
- sf->AppendProperty(name, value);
+ sf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -377,7 +385,7 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
}
if(this->AppendMode)
{
- test->AppendProperty(name, value);
+ test->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -464,7 +472,7 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
}
if(this->AppendMode)
{
- it.AppendProperty(name, value);
+ it.AppendProperty(name, value, this->AppendAsString);
}
else
{
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index c477bb7..3a0169e 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -56,7 +56,7 @@ public:
" SOURCE [src1 [src2 ...]] |\n"
" TEST [test1 [test2 ...]] |\n"
" CACHE [entry1 [entry2 ...]]>\n"
- " [APPEND]\n"
+ " [APPEND] [APPEND_STRING]\n"
" PROPERTY <name> [value1 [value2 ...]])\n"
"Set one property on zero or more objects of a scope. "
"The first argument determines the scope in which the property "
@@ -77,6 +77,9 @@ public:
"list. "
"If the APPEND option is given the list is appended to any "
"existing property value."
+ "If the APPEND_STRING option is given the string is append to any "
+ "existing property value as string, i.e. it results in a longer "
+ "string and not a list of strings."
;
}
@@ -93,6 +96,7 @@ private:
std::string PropertyValue;
bool Remove;
bool AppendMode;
+ bool AppendAsString;
// Implementation of each property type.
bool HandleGlobalMode();
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 42d3f06..dfa2c0b 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -291,13 +291,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmSourceFile::AppendProperty(const char* prop, const char* value)
+void cmSourceFile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE);
+ this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
+ asString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 2dc8488..55147e1 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -44,7 +44,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 52b9072..191de38 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2191,13 +2191,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTarget::AppendProperty(const char* prop, const char* value)
+void cmTarget::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
+ this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3b1f016..6f5dac8 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -224,7 +224,7 @@ public:
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c25a8b6..502c174 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -84,13 +84,13 @@ void cmTest::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTest::AppendProperty(const char* prop, const char* value)
+void cmTest::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TEST);
+ this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTest.h b/Source/cmTest.h
index e27a24e..6223a01 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -47,7 +47,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
cmPropertyMap &GetProperties() { return this->Properties; };
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 45927cb..e5cc1a6 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3536,7 +3536,7 @@ void cmake::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
}
-void cmake::AppendProperty(const char* prop, const char* value)
+void cmake::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
@@ -3549,7 +3549,7 @@ void cmake::AppendProperty(const char* prop, const char* value)
this->DebugConfigs.clear();
}
- this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL);
+ this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
}
const char *cmake::GetProperty(const char* prop)
diff --git a/Source/cmake.h b/Source/cmake.h
index fac86c1..b791b7c 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -263,7 +263,7 @@ class cmake
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index e0c7522..c1bc3b9 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -71,6 +71,24 @@ if (NOT TARGETRESULT)
"Error: target result is TARGETRESULT=${TARGETRESULT}")
endif (NOT TARGETRESULT)
+# test APPEND and APPEND_STRING set_property()
+set_property(TARGET Properties PROPERTY FOO foo)
+set_property(TARGET Properties PROPERTY BAR bar)
+set_property(TARGET Properties APPEND PROPERTY FOO 123)
+set_property(TARGET Properties APPEND_STRING PROPERTY BAR 456)
+
+get_property(APPEND_RESULT TARGET Properties PROPERTY FOO)
+if (NOT "${APPEND_RESULT}" STREQUAL "foo;123")
+ message(SEND_ERROR
+ "Error: target result is APPEND_RESULT=${APPEND_RESULT}")
+endif ()
+
+get_property(APPEND_STRING_RESULT TARGET Properties PROPERTY BAR)
+if (NOT "${APPEND_STRING_RESULT}" STREQUAL "bar456")
+ message(SEND_ERROR
+ "Error: target result is APPEND_STRING_RESULT=${APPEND_STRING_RESULT}")
+endif ()
+
# test get_property SET
get_property(TARGETRESULT TARGET Properties PROPERTY TARGETTEST SET)
if (NOT TARGETRESULT)